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

Add examples to documentation: Part-5 (l-n) #1655

Merged
merged 14 commits into from
Oct 10, 2022
Merged

Conversation

IndrajeetPatil
Copy link
Collaborator

Except nonportable_path_linter(); I will come back to it later.

Part of #1492

@codecov-commenter
Copy link

codecov-commenter commented Oct 9, 2022

Codecov Report

Merging #1655 (0ca63e2) into main (e05d994) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1655   +/-   ##
=======================================
  Coverage   98.49%   98.49%           
=======================================
  Files         101      101           
  Lines        4456     4456           
=======================================
  Hits         4389     4389           
  Misses         67       67           
Impacted Files Coverage Δ
R/lengths_linter.R 100.00% <ø> (ø)
R/line_length_linter.R 100.00% <ø> (ø)
R/literal_coercion_linter.R 100.00% <ø> (ø)
R/make_linter_from_regex.R 100.00% <ø> (ø)
R/missing_argument_linter.R 100.00% <ø> (ø)
R/missing_package_linter.R 100.00% <ø> (ø)
R/namespace_linter.R 98.80% <ø> (ø)
R/nested_ifelse_linter.R 100.00% <ø> (ø)
R/numeric_leading_zero_linter.R 100.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

#' lint(
#' text = "mean(x, )",
#' linters = missing_argument_linter(allow_trailing = TRUE)
#' )
Copy link
Collaborator

Choose a reason for hiding this comment

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

not a good example I think, since this may be erroneous to use. better to use a list2() example, maybe filter() or tibble() or mutate(), to demonstrate a case where the lint is more subjective as opposed to avoiding errors

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have changed the example, but still wanted to understand your comment.

Under what circumstances will this be the case?

this may be erroneous to use

x <- c(1, 2, 3)
mean(x, )
#> [1] 2

Created on 2022-10-10 with reprex v2.0.2

Copy link
Collaborator

@MichaelChirico MichaelChirico Oct 10, 2022

Choose a reason for hiding this comment

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

You're right, I was speaking a bit more generally (hadn't check if mean(x, ) works)... point being it's very hard to tell at a glance whether code like that will run or not (and hence a lint is really good), whereas I think allow_trailing=TRUE is intended to allow a common source of false positives through (namely, list2() usages)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Gotcha!

#' @examples
#' # will produce lints
#' lint(
#' text = "library(statts)",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I worry statts is too close to something that could conceivably be a real package name (if not now, then eventually). maybe pick something more obscure?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can't think of something that I don't see being a package name, so chose xyzxyz. Happy to change if you can think of something better.

Copy link
Collaborator

@MichaelChirico MichaelChirico Oct 10, 2022

Choose a reason for hiding this comment

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

SGTM, I also think a gibberish name is OK...

@MichaelChirico MichaelChirico merged commit 918fe0c into main Oct 10, 2022
@MichaelChirico MichaelChirico deleted the 1492_examples_5 branch October 10, 2022 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants