moodlehq / moodle-cs

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

Disable package checks whenever missing a target component #118

Closed stronk7 closed 8 months ago

stronk7 commented 8 months ago

All the Sniffs that play with components (package, namespaces,...) need to skip all the checks related with null components returned by MoodleUtil::getMoodleComponent().

That happens when moodle-cs is executed against a standalone directory that is not within a moodle structure, so it cannot find all the component => paths mappings or a file with that structure has been provided using the moodleComponentsListPath config option.

This commit just ensures that the moodle.Commenting.Package sniff does not run any check requiring a expected component. And covers it with tests (note that some checks still work, because they don't require any expected component).

codecov[bot] commented 8 months ago

Codecov Report

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

Project coverage is 97.29%. Comparing base (f71d22b) to head (f06fa34).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #118 +/- ## ========================================= Coverage 97.29% 97.29% - Complexity 655 656 +1 ========================================= Files 29 29 Lines 1957 1959 +2 ========================================= + Hits 1904 1906 +2 Misses 53 53 ```

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