-
-
Notifications
You must be signed in to change notification settings - Fork 490
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
Add documentation for each sniff #1722
Comments
@Mike-Hermans, @marconmartins, @Ipstenu, @NielsdeBlaauw, @fkeijzer, @GaryJones, @ckanitz Just wanted to drop you all a note that I'm sorry that I haven't managed to review your PRs yet, even though I'm so incredibly happy with them all. |
Adds documentation for the WordPress.WhiteSpace.CastStructureSpacing Related to #1722
Adds documentation for the WordPress.WhiteSpace.PrecisionAlignmentSniff Related to #1722
Adds documentation for the WordPress.WhiteSpace.DisallowInlineTabs sniff Related to #1722
Adds documentations for the WordPress.Arrays.ArrayIndentation sniff Related to #1722
All sniffs should be accompanied by documentation in the form of a
SniffNameStandard.xml
file.A
SniffNameStandard.xml
file contains a (short) description of each rule(s) the sniff checks and a code comparison for each check.Examples can be found in the PHP_CodeSniffer repository:
The sniff documentation for the complete standard can be shown using the following command:
The sniff documentation for an individual sniff can be shown using the following command:
Aside from the
text
generator, there are also generators available for HTML and Markdown, which will allow us to use these documentation files to auto-generate documentation about the sniffs to be placed in, for instance, the wiki.At this time, none of the WPCS native sniffs have this kind of documentation available.
This issue is intended to track progress for adding this documentation.
Adding this documentation is a focus-task for the WCEU contributor day 2019.
During the WCEU Contributor day Gary (@GaryJones ) and Juliette (@jrfnl) will be available to help contributors get set up and answer any questions they may have.
Process
#core-coding-standards
channel and mention your GitHub nickname (during the WCEU contributor day) or leave a comment in this issue (after WCEU Contributor day).Creating the documentation
Preparation
composer install
from the command line in the root directory of your local clone of this repo.For each sniff:
develop
and name itdocs/sniffname
.WordPress/Docs/Category/
directory.You may need to create the directory if it doesn't yet exist.
addWarning()
and/oraddError()
function calls in the sniff file in theWordPress/Sniffs/Category/
directory to see the error messages the sniff generates.WordPress/Tests/Category/SniffNameUnitTest.inc
file.Correct code will generally be marked with
// OK.
, incorrect code will be marked with// Bad
or// Error
.If the sniff generates several error messages and you are unsure which error applies to which code, you can run the following command to get a better understanding of which code triggers which error/warning:
title
of a "good" code sample should start withValid:
.The
title
of a "bad" code sample should start withInvalid:
.<em> ...</em>
tags.These will be removed automatically when using the text generator, but ensure highlighting of the code in Markdown/HTML.
This applies not only to the code samples, but throughout the file.
Please mention this issue in your pull request description
Related to #1722
so your pull request will show up in this issue.To Do
Claimed
WordPress.DB.SlowDBQuery
#2464Finished
WordPress.WhiteSpace.DisallowInlineTabs
sniff #1912)WordPress.WhiteSpace.PrecisionAlignment
sniff #2129)Not needed
WordPress.CodeAnalysis.EmptyStatementReplaced by PHPCS native sniff, see 3.0: Replace theWordPress.CodeAnalysis.EmptyStatement
sniff #1910The text was updated successfully, but these errors were encountered: