-
Notifications
You must be signed in to change notification settings - Fork 186
Who lints the linters? #584
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
Comments
Here are some stats on babe9f7 (current HEAD of #539) for By linter
R/ by linter
By filename
By directory
|
From the stats I can see a few things that we could make as a first step PR:
By making each file a single commit, potential bugs can be efficiently pinpointed with Since syntactic lints, such as |
Can we flag as 'good-first-issue' all single-file lint fixes. |
Would PRs by file or by linter be better? If the fix is going to introduce a bug, I guess it would be easy to introduce the same bug to multiple files, and easier to fix that same fix in multiple places at once. |
For style issues I really don't mimd a large PR as long as there are commits to bisect. For synatctic linters like cyclocomp I think we really should go function by function. |
Thanks for your analysis @AshesITR . Based on this, the following is a minimal .lintr that returns green on the current codebase:
|
But ultimately, we'd aim to get this back to the following (the original settings, but disregarding all test-examples)
|
Do you think it would be useful to keep a long-running PR going with the final If so, we'd need:
Number 3. could alternatively be organized per file. cc @jimhester |
@dragosmg Do you have an idea if we could somehow (e.g. by setting It would be awesome if the final set of linters could be automatically applied to all modified files in a PR without having to have the rest of the code lint red. |
Are there any default linters that we don't want to apply to lintr? Some linters may need commented code to explain what they do, so maybe the commented-code linter should be dropped |
The commented code can trivially be "fooled" by commenting the code with a special sequence. I like to use this:
On the other hand: WDYT about using more than the default set? Such as T_and_F_symbol_linter? |
The following functions have
|
On @russHyde's point about {usethis} and a potential |
@AshesITR is this still needed? If yes, I suggest we create a separate issue and look into this. |
Hi @dragosmg I still think this would be useful, yes. |
Just FYI when Edit: The guarantees currently don't hold for roxygen code examples. |
I think this issue can be closed -- check #1186 for the last vestige of it |
Although there is a
.lintr
file in the lintr root, linting is not done as part of the current travis-CI workflow (or the soon to be introduced GHA CI workflow).If people are keen to integrate lintr into their dev workflow, they're probably going to look at lintr as a good example of how to set this up. For those who read docs, the current docs explain how to set up lintr for running on Travis; they might need expanding to explain how to use lintr on GHA / other providers. For those who don't read docs, it would be good if
{lintr}
had exemplary lint-running code that they can copy/paste into their own projects (or perhaps ause_lintr
hook could be constructed for{usethis}
that makes setting up linting trivial).Nonetheless, the current linting setup fails:
With master: f878ec9
if we run
Rscript -e "devtools::load_all(); lint_package()"
in thelintr
root, we get the following:If we run
Rscript -e "devtools::load_all(); lint_dir('R')"
we get a long list of lints. (and also forlint_dir("tests")
)Some of these lints
paren_brace_linter
false positive within regex strings: "(match_group){quantifier}" #441, Equals na comment #546Should we fixup the lintr PR process so that linting is always run?
And if we do, how do we change the current code base so that linting the current code comes back green?
What we shouldn't do is a monolithic PR using
{styler}
or something that fixes hundreds offunction(arg=123)
tofunction(arg = 123)
; when these wholesale-change commits introduce bugs they are hell to fix.I'd suggest we rewrite the .lintr:
<lintr>/R
An alternative would be to write up a .lintr that defines the linters that we definitely do want to apply to lintr and write up a CI workflow script that applies these linters to just those files that were modified in a submitted PR; and if a lint crops up on a line that was touched by the PR author then linting should return red from CI.
The text was updated successfully, but these errors were encountered: