Skip to content

add name attribute to Linter class #753

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Feb 16, 2021
Merged

add name attribute to Linter class #753

merged 11 commits into from
Feb 16, 2021

Conversation

AshesITR
Copy link
Collaborator

@AshesITR AshesITR commented Feb 13, 2021

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
@@ -7,7 +7,7 @@ function_left_parentheses_linter <- function() { # nolint: object_length_linter.
ids_with_token(source_file, "'('"),
function(id) {

parsed <- source_file$parsed_content[id, ]
parsed <- source_file$parsed_content[id,]
Copy link
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?

R/utils.R Outdated
@@ -62,13 +62,30 @@ names2 <- function(x) {
names(x) %||% rep("", length(x))
}

linter_auto_name <- function(which = -3L) {
call <- sys.call(which = which)
nm <- paste(deparse(call, 500L), collapse = "")
Copy link
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

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

Choose a reason for hiding this comment

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

ditto

"lint"
)

expect_warning(
Lint("dummy.R", linter = "deprecated"),
fixed = "deprecated"
Copy link
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
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
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
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

Copy link
Collaborator

@MichaelChirico MichaelChirico left a comment

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 <michaelchirico4@gmail.com>
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 <michaelchirico4@gmail.com>
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 <michaelchirico4@gmail.com>

* 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 <michaelchirico4@gmail.com>

* 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 <alexander.rosenstock@web.de>
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