moodlehq / moodle-cs

Moodle Coding Style
https://github.com/moodlehq/moodle-cs
GNU General Public License v3.0
18 stars 16 forks source link

New sniff to detect correct setUp/tearDown parent calls #165

Closed stronk7 closed 5 months ago

stronk7 commented 5 months ago

It detects various situations like:

And, when possible, tries to fix the missing ones (not others) by adding them in a correct place:

Only for 405 and above.

Of course, covered with tests.

Fixes #106

Note that this is built on top of #162.

stronk7 commented 5 months ago

These are the results when executing it against core (4.5dev). 492 cases detected and fixed.

https://github.com/stronk7/moodle/commit/c22f9e08f88c643bb3d56c694df9fb76ce233f96

Ciao :-)

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.99%. Comparing base (4431d70) to head (7d14837).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #165 +/- ## ============================================ + Coverage 97.93% 97.99% +0.06% - Complexity 860 886 +26 ============================================ Files 38 39 +1 Lines 2564 2647 +83 ============================================ + Hits 2511 2594 +83 Misses 53 53 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

stronk7 commented 5 months ago

Thanks @andrewnicols , I've cherry-picked your commit here, and applied a few small (comments, problem cases) modifications to it, to better understand what's going with those empty methods.

I think this now is perfect! 😎