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

New CodeCoverageIgnoreDeprecated sniff #96

Merged
merged 1 commit into from
Sep 21, 2018

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Sep 20, 2018

This sniff will check that functions which have a @deprecated tag in the function docblock, also have a @codeCoverageIgnore tag in the same docblock.

If a codeCoverageIgnore text is found without the @ sign, it will be recognized by the sniff and can be auto-fixed.

Individual plugins may have certain files excluded for codeCoverage in the PHPUnit configuration file.
For those plugins corresponding excludes need to be added to the PHPCS configuration file to ignore those files completely for the purposes of this sniff.

Example:

<rule ref="Yoast.Commenting.CodeCoverageIgnoreDeprecated">
    <exclude-pattern>*/deprecated/*\.php$</exclude-pattern>
</rule>

Fixes #95

This sniff will check that functions which have a `@deprecated` tag in the function docblock, also have a  `@codeCoverageIgnore` tag in the same docblock.

If a `codeCoverageIgnore` text is found without the `@` sign, it will be recognized by the sniff and can be auto-fixed.

Individual plugins may have certain files `exclude`d for codeCoverage in the PHPUnit configuration file.
For those plugins a corresponding `exclude`s needs to be added to the PHPCS configuration file to ignore those files completely for the purposes of this sniff.

Example:
```xml
<rule ref="Yoast.Commenting.CodeCoverageIgnoreDeprecated">
    <exclude-pattern>*/deprecated/*\.php$</exclude-pattern>
</rule>
```
@moorscode
Copy link
Contributor

Looks good to me 👍

@moorscode moorscode merged commit 3d276b6 into develop Sep 21, 2018
@moorscode moorscode deleted the JRF/95-new-sniff-deprecated-no-code-coverage branch September 21, 2018 07:18
@moorscode moorscode modified the milestones: Next release, 1.1 Sep 21, 2018
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.

Suggestion: sniff to check that deprecated methods are ignored for code coverage
3 participants