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

turn off particular tests? .puppet-lintrc? #34

Closed
pdurbin opened this issue Oct 24, 2011 · 15 comments
Closed

turn off particular tests? .puppet-lintrc? #34

pdurbin opened this issue Oct 24, 2011 · 15 comments

Comments

@pdurbin
Copy link

pdurbin commented Oct 24, 2011

Is it possible to turn off particular tests in puppet-lint? For example, one test is "Should not exceed an 80 character line width" but what if I wanted to disable this test altogether?

In perltidy I do something similar, using the option --noblanks-before-blocks in my .perltidyrc, per the documentation because I don't like the default behavior.

It would be great to have a .puppet-lintrc. Apologies if there already is one and I missed it.

@rodjek
Copy link
Owner

rodjek commented Oct 24, 2011

I'm actually working on the ability to selectively disable checks at the moment, it shouldn't be too long.

@pdurbin
Copy link
Author

pdurbin commented Oct 25, 2011

Great news!

@rodjek
Copy link
Owner

rodjek commented Dec 28, 2011

This is being worked on as part of the modularise branch. Coming real soon now.

@rodjek
Copy link
Owner

rodjek commented Jan 11, 2012

OK, so you can now disable checks! puppet-lint --help to get the check names then just add whatever flags you want to either ~/.puppet-lintrc or a per-project .puppet-lintrc

@rodjek rodjek closed this as completed Jan 11, 2012
@rodjek
Copy link
Owner

rodjek commented Jan 11, 2012

Sorry, should mention you'll need to upgrade to 0.1.11

@pdurbin
Copy link
Author

pdurbin commented Feb 1, 2012

Thanks for implementing my feature request! I finally got around to upgrading (jumped up from 0.1.5 to 0.1.12) and it works great! My only suggestion is to document the ability to use ~/.puppet-lintrc in the output of puppet-lint --help.

@rodjek
Copy link
Owner

rodjek commented Feb 1, 2012

Yep, documentation is really lacking. Updating it all and explaining what each warning/error means & how to fix it is a project for a rainy weekend (like this coming one actually).

On Thursday, 2 February 2012 at 6:38 AM, Philip Durbin wrote:

Thanks for implementing my feature request! I finally got around to upgrading (jumped up from 0.1.5 to 0.1.12) and it works great! My only suggestion is to document the ability to use ~/.puppet-lintrc in the output of puppet-lint --help.


Reply to this email directly or view it on GitHub:
#34 (comment)

@ccaviness
Copy link

I would love the ability to disable particular tests from within the manifest, either on a line-by-line basis on within a block, or both.

Specifically, I want the >80 char check everywhere except on the lines that have our revision control tags, which frequently expand to >80 chars.

@ccaviness
Copy link

If you want a new feature request for this, I'd gladly write it up.

@vStone
Copy link
Contributor

vStone commented Feb 2, 2012

I don't think thats gonna be an easy one, since some checks run on the lines while others depend on the tokens. Tokens don't contain comments since those don't get included by the puppet parser by default.

I wanted to write some checks on proper puppet docs so I've run into this barrier before.

@rodjek
Copy link
Owner

rodjek commented Feb 2, 2012

We can access the comments through the lexer's commentstack however it is a bit of a pain in the arse. If in doubt, monkey patch the lexer again.

@rodjek
Copy link
Owner

rodjek commented Feb 2, 2012

To follow up, the way I'd see this potentially working is

  1. puppet-lint finds a problem on line n
  2. puppet-lint checks for a comment on the line above (Puppet::Parser::Lexer#getcomment)
  3. If the comment matches "# skip-check-" (or something similar), don't alert on this infraction.

@ccaviness
Copy link

I'm hoping for something like what pylint (http://www.logilab.org/card/pylint_manual) can do, where you put a comment like "# puppet-lint: disable=80chars-check" or similar at the end of a line and it doesn't lint that line for that check. Also able to disable a check for a block of lines by surrounding with "# puppet-lint: disable=whatever" [...] "# puppet-lint: enable=whatever"

@rodjek
Copy link
Owner

rodjek commented Feb 2, 2012

That is going to be rather tricky. As @vStone pointed out earlier, the Puppet parser basically discards any comments in your manifests. It's not impossible though. I'd suggest taking this discussion into a new issue for clarity.

@ccaviness
Copy link

#68

ekohl pushed a commit to ekohl/puppet-lint that referenced this issue Feb 4, 2022
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

No branches or pull requests

4 participants