-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
3.x: <autoload> file not loaded when custom ruleset includes only category or sniff #1582
Comments
I ran into this problem too. Adding the entry into my own ruleset would be a really ugly path-specific dependency. Another solution would be great. |
I'm not sure if this is an easy change. When you're including a specific sniff or category of sniffs, you aren't asking for anything in the ruleset.xml to be processed, so I'm not sure if I can just load up the ruleset and look for autoloaders. Having said that, it makes sense in this case because the sniffs only work with the autoloader. I'm just not sure if the custom standard that includes the specific sniff should be defining the autoloader or if PHPCS should be going into a ruleset.xml it finds to try and find it. This gets a lot more complicated if the standard you are pulling a sniff from includes other whole standards and their autoloaders, and so doesn't define one itself. I'm not really sure if PHPCS should keep looking through rulesets to find all autoloaders. |
Closing as there hasn't been any movement on this and I still think this far more complicated than the specific use case here. Needs a lot more thought and a probable rethink of rulesets, which isn't on the todo list. |
While debugging issue #1581, I also came across another bug in the autoloader.
When a custom ruleset does not include a complete external standard, but includes a category or an individual sniff from a standard, and the external standard has defined the
<autoload>
directive in the ruleset, the autoload file is not included.This can be tested using the WordPress Coding Standards
develop
branch in combination with this custom ruleset:The
autoload
file in that case provides class aliases to sort out PHPCS cross-version compatibility and as that file is not loaded, the aliases are not in place.The text was updated successfully, but these errors were encountered: