-
Notifications
You must be signed in to change notification settings - Fork 241
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
Feature : Automated linting for files #3280
Comments
A while back Ben Bond-Lamberty did a lot of PRs where he did this sort of code cleaning package-by-package. While most of the automated checking was useful, some of it was not and had to be manually reverted. I'd worry that an automated linting would just reintroduce these mistakes in every single PR. I'll also note that GH itself is now doing a lot of these sort of automated tests -- code with issues is showing up in PRs now outside of the code that individuals have changed. |
Preserving comment from @mdietze in #3407 that seems relevant here:
|
My take: In principle I support using automation to get and keep the code uniformly formatted. But like @mdietze I do not want to fight with the stylizer. I do think the available linting/styling tools are better now than they were last time we tried this, but I think getting all the way to "no fighting" means we need all the following nontrivial components:
|
I think putting a script in the scripts folder as in #3413 that is available for anyone who wants to lint / style their code is helpful. And it doesn’t require anything. It will be available to clean up code if wanted. I agree that running it over the entire codebase may be more trouble than it is worth. But having it as an option can be useful. One issue we should avoid though is having functional changes in the same commit pr as formatting changes. So yes, it does add additional work. Maybe the script could run a git commit to isolate its changes. |
Having scripts available for folks who want them is fine and low-cost, but it doesn't address any of the needs I listed above. Building on my point 3, let's remember that {styler} and {lintr} already exist and are integrated into the editors/IDEs many contributors use already, so an approach that works with those instead of against them is much more likely to succeed. |
Description
PRIORITY : LOW/OPTIONAL
Is your feature request related to a problem? Please describe.
As our codebase grows, maintaining a consistent style and avoiding common coding issues becomes increasingly important.
Proposed Solution
Describe the solution you'd like
I propose that we use the
lintr
andstyler
packages in R to check for and fix common style issues. We can create alinter.R
script that users can run from the terminal to check their code and fix issues.Here's a basic example of how we can use
lintr
to check for issues:And here's how we can use
styler
to automatically fix some style issues:Alternatives Considered
Describe alternatives you've considered
An alternative would be to manually review the code for style issues. However, this can be time-consuming and error-prone. Automated linting and styling tools can help us maintain a consistent style with less effort.
Additional Context
This is an effort to improve the quality and maintainability of our R codebase. By enforcing a consistent style and catching common issues, we can make the code easier to read with less blue underlines :-)
The text was updated successfully, but these errors were encountered: