Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add coverage info (and related Sniff) #143

Merged
merged 2 commits into from
Apr 22, 2021

Conversation

stronk7
Copy link
Member

@stronk7 stronk7 commented Apr 22, 2021

This includes 2 commits:

  1. Add the coverage.php file for the plugin, so when running with coverage enabled we get info about the files we are interested (keeping apart things like PHPCompatibilty, PHP_CodeSniffer... that are not ours).

  2. Add a new sniff that supports the "return new class extends..." anonymous classes.

Important note: This will be failing a number of the checks, because moodle-plugin-ci ( that is in charge of checking this) still doesn't know about the new moodlecheck and codechecker improvements, namely:

  • codechecker: Will fail with error in this patch line 19, because it's not aware of the new "return new class extends..." sniff that will allow those phpdoc blocks to exist.
  • moodlecheck: Will fail because it's not aware that now we can skip the file phpdoc block when the file is an 1-artifact one (that was recently added to moodlecheck, but it's not yet on moodle-plugin-ci).

That's pretty much the reason we want to release a new moodle-plugin-ci version this week, to get all those improvements incorporated.

But if you run codechecker and moodlecheck locally (or via CiBoT)... they all pass:

$ phpcs/bin/phpcs --standard=moodle tests/coverage.php && echo "all ok!"
all ok!
$ php local/moodlecheck/cli/moodlecheck.php -p local/codechecker/tests/coverage.php && echo "all ok!"
all ok!

Just define the paths we are interested one and enable
the text-coverage option in CI tools (travis and gha).
Enable text-coverage to

Everything not included are:

- External libraries (PHPCompatibility, phpcs...).
- Tests.
- Frontend/CLI scripts.
Mostly used by coverage info anon classes, but there may be
other cases, that sort of construction is allowed to have an
inline phpdoc block.

Covered with tests.
Copy link
Member

@sarjona sarjona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eloy, thanks for working on this. The patch looks good so I'm going to merge it.

@sarjona sarjona merged commit 93277c4 into moodlehq:master Apr 22, 2021
@stronk7
Copy link
Member Author

stronk7 commented Apr 22, 2021

Thanks!

@stronk7 stronk7 deleted the add_coverage_info branch April 22, 2021 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants