Skip to content

add name attribute to Linter class - #753

Merged
AshesITR merged 11 commits into
masterfrom
fix/746-linter-name
Feb 16, 2021
Merged

AshesITR merged 11 commits into
masterfrom
fix/746-linter-name

Conversation

@AshesITR

@AshesITR AshesITR commented Feb 13, 2021 •

Copy link
Copy Markdown
Collaborator

fixes #746

Things that should be done in this PR:

  • remove linter argument from Lint. It's overwritten during lint() anyway.
  • refactor expect_lint() to nevertheless recognize linter as a lint_fields despite not being an argument of Lint().
  • document the new behaviour.
  • add NEWS bullet.

@AshesITR
AshesITR marked this pull request as draft February 13, 2021 15:15
@AshesITR
AshesITR requested a review from russHyde February 13, 2021 16:20
@AshesITR
AshesITR marked this pull request as ready for review February 13, 2021 21:44
Comment thread R/function_left_parentheses.R Outdated
function(id) {

parsed <- source_file$parsed_content[id, ]
parsed <- source_file$parsed_content[id,]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the lint is correct, isn't it?

Comment thread R/utils.R Outdated

linter_auto_name <- function(which = -3L) {
call <- sys.call(which = which)
nm <- paste(deparse(call, 500L), collapse = "")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collapse should be " " IINM

Comment thread R/utils.R Outdated
if (inherits(x, "linter")) {
attr(x, "name", exact = TRUE)
} else {
paste(deparse(x, 500L), collapse = "")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Comment thread tests/testthat/test-methods.R Outdated

expect_warning(
Lint("dummy.R", linter = "deprecated"),
fixed = "deprecated"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't fixed the argument passed to grepl?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, the warning should contain the text "deprecated", no?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then fixed=TRUE and I think warning="deprecated" if you want to name it right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, thanks for pointing that out.
We have a lot of these calls in test-lint_file.R

Comment thread tests/testthat/test-methods.R Resolved

@MichaelChirico MichaelChirico left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically looks good, small changes

fix test expectation
@AshesITR
AshesITR merged commit db83181 into master Feb 16, 2021
@AshesITR
AshesITR deleted the fix/746-linter-name branch February 16, 2021 08:40
MichaelChirico added a commit that referenced this pull request Feb 17, 2021
* add name attribute to Linter class

fixes #746

* fix test failures

* document()

* restore 100% coverage for utils.R

* deprecate Lint(linter = ...) and remove all calling instances

make expect_lint() resilient to complete removal of the argument

* add NEWS bullet

* document()

* fix lint, collapse with space

fix test expectation

Co-authored-by: Michael Chirico <[email protected]>
MichaelChirico added a commit that referenced this pull request Feb 17, 2021
* add name attribute to Linter class

fixes #746

* fix test failures

* document()

* restore 100% coverage for utils.R

* deprecate Lint(linter = ...) and remove all calling instances

make expect_lint() resilient to complete removal of the argument

* add NEWS bullet

* document()

* fix lint, collapse with space

fix test expectation

Co-authored-by: Michael Chirico <[email protected]>
AshesITR added a commit that referenced this pull request Feb 18, 2021
* initial formalization of Russ's branch comparison script

* tweaks

* tweak again

* debugging

* workaround for Depends

* more tweak

* skip empty depends

* add to buildignore

* use optparse

* consolidate TODO

* add name attribute to Linter class (#753)

* add name attribute to Linter class

fixes #746

* fix test failures

* document()

* restore 100% coverage for utils.R

* deprecate Lint(linter = ...) and remove all calling instances

make expect_lint() resilient to complete removal of the argument

* add NEWS bullet

* document()

* fix lint, collapse with space

fix test expectation

Co-authored-by: Michael Chirico <[email protected]>

* typo in optparse funciton

skip Depends except on object_usage_linter

typo

need check higher up

forgot to supply arg

just exit early if Depends unavailable

provide an interactive() experience for debugging

tweak

* add name attribute to Linter class (#753)

* add name attribute to Linter class

fixes #746

* fix test failures

* document()

* restore 100% coverage for utils.R

* deprecate Lint(linter = ...) and remove all calling instances

make expect_lint() resilient to complete removal of the argument

* add NEWS bullet

* document()

* fix lint, collapse with space

fix test expectation

Co-authored-by: Michael Chirico <[email protected]>

* typo

* vestigial variable name

not working from command line

testing more

debugging Rscript sucks

progress -- we need to skip missing Imports too

more progress -- skip on platforms without tcl/tk

need testing again

need to exit early

* skip directories with encoding issues

* switch conditions

* remove tracing

Co-authored-by: AshesITR <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter exclusions bug

2 participants