Closed andrewfleming closed 3 years ago
Of course!
Here is a ruleset file I created: https://github.com/Automattic/vip-go-compatibility-scanner/blob/master/php-7.4-upgrade-ruleset.xml
Using this file to scan is easy:
./compatibility-scanner.php ... --phpcs-standard=$HOME/vip-go-ci-tools/vip-go-compatibility-scanner/php-7.4-upgrade-ruleset.xml
Does this look good? If so, I will add it to the README.md
Thanks for showing how this is achieved @gudmdharalds 🙂 I'm reading the Annotated Ruleset and I understand that the exclusion currently in vip-go-compatibility-scanner/php-7.4-upgrade-ruleset.xml will exclude the rule from all files scanned. This exclusion feels to broad.
How can we exclude the rule from the a specific file?
How can we exclude the rule from the a specific file?
I think this would have to be done with vip-go-compatibility-scanner
itself: We could create an exclusions-file whereby we specify rules to skip when specific files are scanned. For example:
{"file1.php":"PHPCompatibility.ParameterValues.NewIDNVariantDefault.NotSet","file2.php":"PHPCompatibility.OtherRule.Rule1"}
In this case, PHPCompatibility.ParameterValues.NewIDNVariantDefault.NotSet
is skipped for files named file1.php
and PHPCompatibility.OtherRule.Rule1
for files named file2.php
. It would be possible to specify more than one rule per file. The matching would be on file-name basis but we could use a relative path too.
😕 A custom exclusion file feels to me like it's moving too far from how PHPCS was designed to work. I'm happy or the team to review and identify false-positives manually for now. Marking as closed.
Are we able to provide a config file for the PHPCompatibilityWP where we can define exclusions or rules? I see this addressing false-positives so they don't continue to be flagged. See this issue for an example https://github.com/Automattic/vip-go-mu-plugins/issues/1851#issuecomment-727950607