Skip to content

Ruleset: remove support for sniffs not following the naming conventions #987

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
Member

@jrfnl jrfnl commented Apr 14, 2025

Description

Revert "Common::getSniffCode(): be more lenient about sniffs not following naming conventions"

This reverts commit 71b4524.

Includes further enhancements to strictly apply the naming conventions by:

  1. Making sure that the FQN contains a Sniffs or Tests sub-namespace in the correct position.
  2. Making sure that the category is not called Sniffs.
  3. Making sure that a class ends on Sniff or UnitTest, and that that is a suffix, not the sole name of the class.

Includes updating the tests.

Related to #689
Related to #6

Ruleset: remove support for sniffs not following the naming conventions

The About Standards for PHP_CodeSniffer wiki page outlines exactly what the naming conventions are.

This PR changes the previously added Ruleset deprecation notice to an error and starts rejecting sniffs which do not comply with the naming conventions.

Includes updated tests.

Closes #689

Related to #6

Suggested changelog entry

Removed:

  • Support for sniffs not following the naming conventions.

jrfnl added 2 commits April 14, 2025 18:18
…owing naming conventions"

This reverts commit 71b4524.

Includes further enhancements to strictly apply the naming conventions by:
1. Making sure that the FQN contains a `Sniffs` or `Tests` sub-namespace in the correct position.
2. Making sure that the category is not called `Sniffs`.
3. Making sure that a class ends on `Sniff` or `UnitTest`, and that that is a suffix, not the sole name of the class.

Includes updating the tests.

Related to 689
Related to 6
The [About Standards for PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/About-Standards-for-PHP_CodeSniffer) wiki page outlines exactly what the naming conventions are.

This PR changes the previously added Ruleset deprecation notice to an error and starts rejecting sniffs which do not comply with the naming conventions.

Includes updated tests.

Closes 689

Related to 6
@jrfnl jrfnl force-pushed the phpcs-4.0/feature/689-remove-support-sniffs-breaking-naming-conventions branch from 3fa4bf6 to c2636f5 Compare April 14, 2025 16:18
@jrfnl
Copy link
Member Author

jrfnl commented Apr 14, 2025

Rebased to remove an outdated comment from one of the commit messages. No changes to the code.

@rodrigoprimo rodrigoprimo self-requested a review April 14, 2025 18:53
@jrfnl jrfnl merged commit 3c36ab5 into 4.x Apr 14, 2025
56 checks passed
@jrfnl jrfnl deleted the phpcs-4.0/feature/689-remove-support-sniffs-breaking-naming-conventions branch April 14, 2025 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants