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

Allow phpcs annotations + report wrong testcase classes in class lines instead of line 0 #172

Merged
merged 2 commits into from
Jan 10, 2022

Conversation

stronk7
Copy link
Member

@stronk7 stronk7 commented Jan 9, 2022

  1. Allow phpcs:xxxx comments / annotations in first line of the files

    This implies modifying the BoilerplateComment sniff to detect them
    and, conditionally, do things slightly differently.

    Also, part of WIP, the existing tests have been moved to own testcase
    and completeted to 100% cover the Sniff.

  2. Report missing testcase classes in the line the classes are

    Instead of reporting the moodle.PHPUnit.TestCaseNames.Missing error
    in line 0, when classes have been found incorrect, issue an error
    on the lines they are declared.

    If no classes are found, then the reporting line will continue being 0.

This fixes #171.

This implies modifying the BoilerplateComment sniff to detect them
and, conditionally, do things slightly differently.

Also, part of WIP, the existing tests have been moved to own testcase
and completeted to 100% cover the Sniff.

This fixes moodlehq#171.
Instead of reporting the moodle.PHPUnit.TestCaseNames.Missing error
in line 0, when classes have been found incorrect, issue an error
on the lines they are declared.

If no classes are found, then the reporting line will continue being 0.

Covered with tests.
@stronk7 stronk7 force-pushed the allow_phpcs_annotations branch from 8d5cc8c to 58d8c25 Compare January 9, 2022 12:26
@andrewnicols andrewnicols merged commit fc98ff5 into moodlehq:master Jan 10, 2022
@andrewnicols
Copy link
Contributor

These changes look good to me. Merged :)

@stronk7 stronk7 deleted the allow_phpcs_annotations branch January 25, 2022 21:48
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.

Not possible to disable this rule moodle.PHPUnit.TestCaseNames.Missing
2 participants