-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement linter tags file compatible lintr 3.0.0 #130
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #130 +/- ##
=======================================
Coverage 97.21% 97.21%
=======================================
Files 23 23
Lines 1112 1112
=======================================
Hits 1081 1081
Misses 31 31 ☔ View full report in Codecov by Sentry. |
#' `linters_csv_location` variable to "./inst/lintr/linters.csv", then running | ||
#' tests in the console. | ||
#' | ||
linters_csv_location <- "../../box.linters/lintr/linters.csv" |
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.
To switch between local file and package file, how about checking if it is running under R CMD check? Refer to https://testthat.r-lib.org/reference/is_testing.html.
Also, take a look at {rprojroot}
functions to determine the root path for the two different situations.
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.
Thanks for the pointers, the following could be done to clean up the code a little:
linters_csv_location <- file.path(
rprojroot::find_root_file(criterion = rprojroot::is_r_package),
"lintr/linters.csv"
)
and later in the tests:
skip_if(!is_checking())
But I don't think I follow the logic with switching files? To my understanding, changing the linters_csv_location
based on execution context does not matter, as it is the lintr::available_tags()
function that is failing to read the file when running devtools::test()
, and we cannot change the bahaviour of that function. Am I missing or misunderstanding something?
It might be worth adding https://lintr.r-lib.org/articles/creating_linters.html#writing-the-linter |
rd_tags is not exported from Since the Alternatively, a different schema could be created for this usecase (like section with list of tags, without links to further doc). What do you think would be the best for this case? For details, see rd_tags(), rd_linters(), linter_tags_docs.R file and generated example doc for |
@m-kolomanski Try looking at the following lines of code to use non-exported functions from packages: box.linters/R/get_box_module_exports.R Lines 21 to 24 in e5658e4
Maybe, it will work. Maybe, it won't. |
@radbasa Importing the functions themselves does work, however both needed functions contain call to |
@jakubnowicki It would be nice if we had a list of linter tags similar to lintr Meta-tooling. But, that is automatically generated by Do we have time to manually write documentation pages for these tags? We have 12 tags, and 15 functions. |
I would rather leave it for the next release. |
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.
LGTM
Issue #102
Description
Added linters.csv file in /inst/lintr/ with linters and tags, compatiblie with linter 3.0.0. and
lintr::available_linters()
,lintr::available_tags()
functions.Added unit tests for this feature, although those need to be run with
devtools::check()
as the mentioned functions expect the package to be installed. Otherwise, related tests will be skipped.Definition of Done
R CMD check
, linter, unit tests, spelling)..Rd
files withroxygen2::roxygenise()
)