-
Notifications
You must be signed in to change notification settings - Fork 186
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
Add examples to documentation: Part-7 (q-s) #1674
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1674 +/- ##
=======================================
Coverage 98.70% 98.70%
=======================================
Files 103 103
Lines 4489 4495 +6
=======================================
+ Hits 4431 4437 +6
Misses 58 58
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
can you check the coverage report? |
@@ -2,6 +2,19 @@ | |||
#' | |||
#' Check that all left parentheses have a space before them unless they are in a function call. | |||
#' | |||
#' @examples | |||
#' # will produce lints | |||
#' lint( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in an earlier linter (function_left_parentheses_linter? is that the name?) we showed if/function signature examples, should we do the reverse here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean by "reverse" here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Complementary examples to these:
lintr/R/function_left_parentheses_linter.R
Lines 21 to 40 in 615f72a
#' # okay | |
#' lint( | |
#' text = "mean(x)", | |
#' linters = function_left_parentheses_linter() | |
#' ) | |
#' | |
#' lint( | |
#' text = "stats::sd(c(x, y, z))", | |
#' linters = function_left_parentheses_linter() | |
#' ) | |
#' | |
#' lint( | |
#' text = "if (TRUE) x else y", | |
#' linters = function_left_parentheses_linter() | |
#' ) | |
#' | |
#' lint( | |
#' text = "foo <- function(x) (x + 1)", | |
#' linters = function_left_parentheses_linter() | |
#' ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So including the okay examples but with a space to show that this doesn't lint with spaces_left linter?
library(lintr)
lint(
text = "mean (x)",
linters = spaces_left_parentheses_linter()
)
lint(
text = "stats::sd (c (x, y, z))",
linters = spaces_left_parentheses_linter()
)
lint(
text = "if (TRUE) x else y",
linters = spaces_left_parentheses_linter()
)
lint(
text = "foo <- function (x) (x + 1)",
linters = spaces_left_parentheses_linter()
)
Created on 2022-10-11 with reprex v2.0.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, now I'm doubting everything :)
I definitely don't think examples like mean (x)
are helpful... but maybe the better thing to do is just remove the if()
example from function_left_parentheses_linter()
? Since if()
is irrelevant to that linter, and is covered here instead.
And then add cross-links between these two linters' help pages since they're so closely related.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM. I have made the necessary changes. See if this is better.
Part of #1492