-
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
Sniff properties not set when referencing a sniff using relative paths or non-native slashes #2497
Comments
I've just tried to reproduce this and found something which I believe is relevant:
<!-- Works. -->
<rule ref="TestCode.Test.Test">
<properties>
<property name="test" value="ruleset value" />
</properties>
</rule>
<!-- Works too. -->
<rule ref="D:\path\to\TestCode\TestCode\Sniffs\Test\TestSniff.php">
<properties>
<property name="test" value="ruleset value" />
</properties>
</rule>
<!-- Uh oh, this fails. -->
<rule ref="D:/path/to/TestCode/TestCode/Sniffs/Test/TestSniff.php">
<properties>
<property name="test" value="ruleset value" />
</properties>
</rule>
<!-- This fails too. -->
<rule ref="./../../TestCode/TestCode/Sniffs/Test/TestSniff.php">
<properties>
<property name="test" value="ruleset value" />
</properties>
</rule>
So this looks to be related to the path resolution when including sniffs like this. |
@jrfnl I'm not on Windows, I'm running on Linux. I'll test the PR ASAP, thank you |
Keeping my fingers crossed 🤞 |
There is obviously a Windows issue in there if you've been able to replicate one, but I'm also keen to know if this change has any impact on the original issue given it targets Windows slashes. |
@gsherwood So was I, which is why I added unit tests for various ways of including sniffs to the fix to try and verify (and make sure I wasn't breaking anything else). Based on the unit tests (run on Windows + Linux via Travis), the original case has also been fixed by the fix now pulled, but verification by the Op would still be helpful. |
The technical explanation of the change I made is as follows:
|
@yguedidi Did you ever manage to test the fix? I'm going to look into this soon, but it would be great to have your feedback if you did manage to try it out. |
When using this syntax:
The sniff will the value from the class, not the one configured.
The text was updated successfully, but these errors were encountered: