Skip to content

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

Merged
jrfnl merged 2 commits into
4.xfrom
phpcs-4.0/feature/689-remove-support-sniffs-breaking-naming-conventions
Apr 14, 2025
Merged

jrfnl merged 2 commits into
4.xfrom
phpcs-4.0/feature/689-remove-support-sniffs-breaking-naming-conventions

Conversation

@jrfnl

@jrfnl jrfnl commented Apr 14, 2025 •

Copy link
Copy Markdown
Member

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

jrfnl commented Apr 14, 2025

Copy link
Copy Markdown
Member Author

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
@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