Skip to content

Squiz/CommentedOutCode: fix false positive + false negative #2139

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

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Aug 25, 2018

Squiz/CommentedOutCode: fix false positive for PHPMD suppression annotation

Updated the regex used to detect annotations from other tools, to also allow for PHPMD suppression annotations.

This gets rid of the false positive on unit test case file line 138.

Depending on end-user reports, the regex can be improved further.

Squiz/CommentedOutCode: fix false negative

After the changes I made in PR #1839, this code now added to the unit test case file was incorrectly no longer recognized as commented out code.

This PR further iterates on the previous changes and implements the following:

  • Treat a line comment followed by a block comment (and visa versa) as two separate comments.
  • Allow for blank lines within block comments, but not within line comment blocks.

jrfnl added 2 commits August 25, 2018 12:26
…tation

Updated the regex used to detect annotations from other tools to also allow for PHPMD suppression annotations.

This gets rid of the false positive on unit test case file line 138.

Depending on end-user reports, the regex can be improved further.
After the changes I made in PR 1839, this unit test case now added was incorrectly no longer recognized as commented out code.

This PR further iterates on the previous changes:
* Treat a line comment followed by a block comment (and visa versa) as two separate comments.
* Allow for blank lines within block comments, but not within line comment blocks.
@gsherwood gsherwood added this to the 3.3.2 milestone Aug 28, 2018
@gsherwood gsherwood merged commit bbf9846 into squizlabs:master Aug 28, 2018
gsherwood added a commit that referenced this pull request Aug 28, 2018
@gsherwood
Copy link
Member

Thanks

@jrfnl jrfnl deleted the feature/squiz-commented-out-code-more-improvements branch August 28, 2018 08:51
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