Skip to content
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

available_linters(tags = "deprecated") should "just work" #1959

Closed
MichaelChirico opened this issue Apr 9, 2023 · 3 comments · Fixed by #1961
Closed

available_linters(tags = "deprecated") should "just work" #1959

MichaelChirico opened this issue Apr 9, 2023 · 3 comments · Fixed by #1961
Labels
feature a feature request or enhancement

Comments

@MichaelChirico
Copy link
Collaborator

MichaelChirico commented Apr 9, 2023

I find the current behavior a bit strange:

available_linters(tags = "deprecated")
# [1] linter  package tags   
# <0 rows> (or 0-length row.names)

Almost surely, that's not what the user wanted. The problem is exclude_tags = "deprecated" by default, so we need to also specify exclude_tags = NULL:

nrow(available_linters(tags = "deprecated", exclude_tags = NULL))
# [1] 7

I see two options:

  1. Special case "deprecated" with an if (missing(exclude_tags) && identical(tags, "deprecated")) exclude_tags <- NULL
  2. Always run exclude_tags <- setdiff(exclude_tags, tags), i.e., exclude_tags takes priority over tags if there's any collision

Either way, it will simplify the implementation for #1958.

Any thoughts?

@MichaelChirico MichaelChirico added the feature a feature request or enhancement label Apr 9, 2023
@AshesITR
Copy link
Collaborator

I think option 2 is a more elegant solution (what the code says, not the description; i.e. tags should take priority).

@MichaelChirico
Copy link
Collaborator Author

hmm it looks like we've already declared the opposite prioritization for linters_with_tags():

expect_length(linters_with_tags("default", exclude_tags = "default"), 0L)

@AshesITR
Copy link
Collaborator

The change in behavior makes sense to me -- we should find another way to produce a zero-row output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants