Skip to content

Enable skipping linters #426

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

Closed
wants to merge 1 commit into from
Closed

Conversation

jonocarroll
Copy link

My specific use-case is that I want to use some variable names with dots (vs snake_case) and lintr doesn't like them, but I also want the other linters to run.

This PR adds a new --exclude_lintr argument that accepts a comma-separated list of linters to exclude, then runs the linter with these set to NULL.

I'm having trouble testing this - even though I've set my .pre-commit-config.yaml to

repos:
-   repo: https://github.com/jonocarroll/precommit
    rev: v0.3.1
    hooks: 
    -   id: lintr
        args: [--exclude_lintr=object_name_linter]

I still see the usage message for the original (which doesn't have this new argument). Is there something I'm missing to use an alternative config?

@lorenzwalthert
Copy link
Owner

lorenzwalthert commented Jul 1, 2022

Thanks @jonocarroll. However, since lintr already has its own config file, I am hesitant to add config options over the command line. Have you tried achieving your goal via the .lintr file? Also, you can deactivate lintr for certain lines. Maybe that’s even a better option?

@jonocarroll
Copy link
Author

Ah, I hadn't thought of that. I'll try adding that file. Thanks!

This can be closed as WONTFIX

@lorenzwalthert
Copy link
Owner

Yeah, you can’t test it like this, since 0.3.1 points to the git tag of the released version. You would have to point to your fork repo and then the hash of the branch you committed your changes to. Or just write unit tests that pass. pre-commit calls Rscript inst/hooks/exported/lintr.R —args… files…

@lorenzwalthert
Copy link
Owner

lorenzwalthert commented Jul 1, 2022

Also please note from CONTRIBUTING.md for another time:

Before making a pull request, discuss your ideas in an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants