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

Stop after maximum issues found #2705

Open
lbogaardt opened this issue Jan 9, 2025 · 3 comments
Open

Stop after maximum issues found #2705

lbogaardt opened this issue Jan 9, 2025 · 3 comments
Labels
feature a feature request or enhancement help wanted ❤️ we'd love your help!

Comments

@lbogaardt
Copy link

lbogaardt commented Jan 9, 2025

I am turning existing scripts into an R package. It's a large amount of code, written by a former colleague. I use the lintr package and get many, many comments which I need to work through. This causes lintr to take a long time to run (15 minutes), and it produces an unworkable long list of suggestions. It would be easier for me if lintr could simply stop analysing after, say, 100 suggestions. That takes less time and gives me the chance to iteratively work through the list. Is that a useful new feature?

This #55 is related but focusses on limiting the printed output. I want to limit the analysis part to reduce the time lintr takes.

@AshesITR
Copy link
Collaborator

AshesITR commented Jan 9, 2025

What I did with such a case was store as.data.frame(lintr::lint_dir()) in a variable and use e.g. dplyr to filter the lints as needed.

Does that help you?

@lbogaardt
Copy link
Author

lbogaardt commented Jan 9, 2025

What I did with such a case was store as.data.frame(lintr::lint_dir()) in a variable and use e.g. dplyr to filter the lints as needed.

Does that help you?

I think this would be a good solution for limiting the visual output (similar to what was asked in #55). But I want to limit the analysis part, to reduce the time lintr takes. I edited my OP to emphasise this point.

@MichaelChirico
Copy link
Collaborator

I feel it can be useful, and in line with how some other related tooling works (what comes to mind is ?llvm? compiler quitting after too many issues).

That said, I think there are enough "OK" workarounds that I haven't really needed this myself in practice.

  • As @AshesITR mentioned, to reduce the output noise, I do l = lint*(...) then work from as.data.frame(l)
  • I rarely find lint speed a constraint
    • lint_dir(all_linters()) works in a few minutes on all of r-devel. This is not ideal but it really only need be run quite rarely if the output is saved like l= above
    • lint_dir(linters = specific_linter()) is quite fast in general for checking a single linter is fixed

Overall, I don't think I'd put any development effort on this myself, but would be more than happy to review PR(s). It could be as easy as a few lines' change -- not sure.

@MichaelChirico MichaelChirico added help wanted ❤️ we'd love your help! feature a feature request or enhancement labels Jan 9, 2025
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 help wanted ❤️ we'd love your help!
Projects
None yet
Development

No branches or pull requests

3 participants