-
-
Notifications
You must be signed in to change notification settings - Fork 74
docs and output are unclear on what counts as a sniff code #319
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
See also squizlabs/PHP_CodeSniffer#2646 |
@joachim-n Might be good to update that to "error codes". Want to submit a PR for this ? For reference:
Build up like so: From the command line, you can (currently) only include/exclude sniff codes. In a ruleset, you can include/exclude based on any variation: (Slide source: https://speakerdeck.com/jrf/managing-code-quality-and-code-consistency?slide=22 / https://speakerdeck.com/jrf/dont-work-for-phpcs-make-phpcs-work-for-you-4?slide=29 ) |
I've made a PR with the fix, but I can't see any mention of the term 'error code' in the docs at https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Advanced-Usage. |
Could the PR at squizlabs/PHP_CodeSniffer#2646 be brought into this repo? |
@joachim-n You could ask the OP to pull it here, but considering that the OP never responded to the PR review and never made the requested changes and those changes would still need to be made, I'm not sure you'll get much of a response. |
@joachim-n If you have any suggestions on where updates are needed, please leave them here and I'll update the wiki. Other than that, I'd very much like to (eventually) move the docs from the wiki to a dedicated GH Pages based website. This would allow for them to be updated via pull requests and make it more managable in general. Maybe we should start collecting topics on which articles should be written for the website by opening issues in the website repo. Do you want to open an issue for this ? |
I would probably break up this paragraph on the home page:
into this:
I've not seen docs on the |
@joachim-n Looking at the wiki now. Your suggestion feels a little too detailed for the homepage, though I agree that expanding the text a little would be good. What about something like this:
There is a section on the use of the |
+1 to your suggestion -- I agree that getting into the details of how the names are formed was rather detailed for the home page, but wasn't sure where else to put it.
Yup, but the -s option for showing error code names in the output doesn't seem to be mentioned in the wiki docs. That's where I'd put something about the difference between sniff codes and error codes. |
@joachim-n The |
Ah! I hadn't looked on that page :/ The docs there say "To include source codes in the report, use the -s command line argument" - should that be changed to 'error codes' since that's the term we've just used in the command help? I would suggest adding a paragraph after the screenshot to explain how to pass the error codes to the --sniffs and --exclude options. |
@joachim-n Not sure what you mean with "the screenshot" ? |
@joachim-n Been playing around a bit with this, what about this: (sorry for the screenshots, but the wiki doesn't allow for branches and linking to them) |
That looks great, thanks! (By screenshot I meant the sample of terminal output showing the report with the error codes.) |
@joachim-n Thanks. Pushed! |
Do the terms of how contributions are licensed allow someone else to push that branch onto the new repository and make a MR here? |
@joachim-n You'd have to be careful to make sure the original commit(s) are retained as they were as otherwise, we'd be talking copyright violation. |
Describe the bug
Using the -s option shows sniffs in the report, like this:
However, passing that sniff name to the --sniffs or --exclude flag produces this error:
It turns out that that's because this isn't a full sniff. Passing
PEAR.WhiteSpace.ScopeIndent
DOES work.Expected behavior
The docs and the behaviour are contradicting each other, and misleading the user. The output for --help says:
Therefore the user assumes that the output added by this option consists of sniff codes, and that, for example, 'PEAR.WhiteSpace.ScopeIndent.Incorrect' is one such sniff code.
But help for --sniffs and --excludes options says:
This also says 'sniff codes' but it disagrees with -s on what a sniff code actually consists of!
Versions (please complete the following information)
Additional context
Add any other context about the problem here.
Please confirm:
master
branch of PHP_CodeSniffer.The text was updated successfully, but these errors were encountered: