Generic/Todo-Fixme sniffs: improve handling of docblock tags and efficiency fix#3771
Closed
jrfnl wants to merge 3 commits intosquizlabs:masterfrom
Closed
Generic/Todo-Fixme sniffs: improve handling of docblock tags and efficiency fix#3771jrfnl wants to merge 3 commits intosquizlabs:masterfrom
jrfnl wants to merge 3 commits intosquizlabs:masterfrom
Conversation
The sniffs as-they-were, would sniff all comment related tokens, including `T_DOC_COMMENT_STAR`, `T_DOC_COMMENT_WHITESPACE` etc. Sniffing those tokens is redundant and makes the sniffs slower than is needed. Fixed now by making the tokens being registered by the sniffs more selective/targetted.
Until now, the sniff would only examine an individual comment token, while when a `@todo` tag is used in a docblock, the "task description" is normally in the next `T_DOC_COMMENT_STRING` token. This commit fixes this and the sniff will now take docblock `@todo` tags into account. Includes additional unit tests.
Essentially the same fix as applied in the sister-commit for the `Generic.Commenting.Todo` sniff. Until now, the sniff would only examine an individual comment token, while when a `@fixme` tag is used in a docblock, the "task description" is normally in the next `T_DOC_COMMENT_STRING` token. This commit fixes this and the sniff will now take docblock `@fixme` tags into account. Includes additional unit tests.
Contributor
Author
|
Closing as replaced by PHPCSStandards/PHP_CodeSniffer#53 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generic/Todo-Fixme: make the sniffs more selective
The sniffs as-they-were, would sniff all comment related tokens, including
T_DOC_COMMENT_STAR,T_DOC_COMMENT_WHITESPACEetc.Sniffing those tokens is redundant and makes the sniffs slower than is needed.
Fixed now by making the tokens being registered by the sniffs more selective/targeted.
Generic/Todo: improve handling of "todo" tags in docblocks
Until now, the sniff would only examine an individual comment token, while when a
@todotag is used in a docblock, the "task description" is normally in the nextT_DOC_COMMENT_STRINGtoken.This commit fixes this and the sniff will now take docblock
@todotags into account.Includes additional unit tests.
Generic/Fixme: improve handling of "fixme" tags in docblocks
Essentially the same fix as applied in the sister-commit for the
Generic.Commenting.Todosniff.Until now, the sniff would only examine an individual comment token, while when a
@fixmetag is used in a docblock, the "task description" is normally in the nextT_DOC_COMMENT_STRINGtoken.This commit fixes this and the sniff will now take docblock
@fixmetags into account.Includes additional unit tests.
Fixes #3769 (well, aside from tags without a description, but that can't be helped)