tlint icon indicating copy to clipboard operation
tlint copied to clipboard

Add linter rule disallowing `test_` method prefix in tests

Open sbine opened this issue 2 years ago • 2 comments

Per @mattstauffer, this PR adds a rule disallowing the use of the test prefix on test methods, instead suggesting the /** @test */ annotation. It will catch any public test method beginning with test.

I've updated the Tighten preset to include this linter, so this PR is a breaking change.

sbine avatar Aug 19 '22 21:08 sbine

Looks good to me! I don't know how we handle breaking changes in the Tighten preset that aren't breaking changes in the tool itself. LMK if y'all need any input from me on that.

mattstauffer avatar Aug 20 '22 04:08 mattstauffer

@sbine this looks good! I'm inclined to add this to Tighten Coding Standard using php_unit_test_annotation. This will give us both linting and fixing without us having to maintain this functionality. After Tighten Coding Standard is updated, I have a PR to remove duplicate functionality in TLint, allowing us to focus TLint development on features not covered by other tools. Does that make sense?

If you have time, I'd love feedback on the above Tighten Coding Standard PR.

driftingly avatar Aug 23 '22 18:08 driftingly