Our test framework doesn't allow to add tests for sniffs that can auto-fix stuff. addshore was going to look into fixing it :)
- Mentioned In
- T130382: GSoC/Outreachy Proposal for Improving static analysis tools for Mediawiki
T130456: Improving static analysis tools for MediaWiki(GSoC 2016 Proposal)
T115585: Outreachy proposal for : Improving static analysis tools for MediaWiki
- Mentioned Here
- rMCSN80210fe43e1d: Assert fixers do as intended
I have addressed this issue in https://gerrit.wikimedia.org/r/#/c/237899/ - but have not tested it out yet. Would like a review before I work more on it, so that I know that the approach is fine.
I used the same method that phpcs is using in it's git repository. It has a "AbstractSnifTest" which is inherited by a Test class for each sniff and it runs phpcs only with that sniff and disables the others. It runs phpcs on a file and verifies whether the number of warnings and errors per line are the same. After running the analysis, it can also take the diff from the PHP_CodeSniff_File class and check that it's the same as the *.fixed file of the input being tested.