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

Check package tags #110

Merged
merged 1 commit into from
Feb 23, 2024
Merged

Conversation

andrewnicols
Copy link
Contributor

@andrewnicols andrewnicols commented Feb 18, 2024

This is a first attempt at migrating one of the checks in moodlecheck as part of #30

This change starts the work required to migrate the @package check.

There's a lot of duplicated code here right now, and a lot of missing tests, but I've tried to abstract out useful features or use phpcsextra where possible.

Copy link

codecov bot commented Feb 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.06%. Comparing base (61a380a) to head (dbbffda).

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #110      +/-   ##
============================================
+ Coverage     96.73%   97.06%   +0.32%     
- Complexity      586      632      +46     
============================================
  Files            26       28       +2     
  Lines          1625     1807     +182     
============================================
+ Hits           1572     1754     +182     
  Misses           53       53              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stronk7
Copy link
Member

stronk7 commented Feb 20, 2024

I won't merge this, coz my #111 will conflict then (I imagine, coz both are moving MoodleUtilTest)!

(joking, of course)

Copy link
Member

@stronk7 stronk7 left a comment

Choose a reason for hiding this comment

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

Thanks @andrewnicols , this looks perfect for me.

I just would ask for a couple of details:

  • Confirmation: Does this cover all the related tests and fixtures that we have in local_moodlecheck. Or, with other words, is this a complete replacement?
  • Maybe, getting used to feed the CHANGELOG as part of the PR is good thing.

And, final reflexion... I think I commented elsewhere... let's give to this initiative a little bit of visibility (chat, forum, integration exposed, ...). Maybe there is something in the plan that we haven't detected, or somebody has a say about it...

Ciao :-)

PS: Feel free to self-merge whenever you read and consider the points above.

Replaces the Package checks in moodle-local_moodlecheck
@andrewnicols
Copy link
Contributor Author

Confirmation: Does this cover all the related tests and fixtures that we have in local_moodlecheck. Or, with other words, is this a complete replacement?

From what I can see in moodlecheck, there is very little testing of the package tests. See https://github.com/moodlehq/moodle-local_moodlecheck/blob/main/tests/moodlecheck_rules_test.php - there are 7 mentions of the packagevalid string, bug they're just checking that an error was raised in unrelated tests. There are no specific tests, nor any tests which check that it's in the right place.

As far as I'm aware, this is a complete replacement. There are two rules for packages:

The specified check notes:

Checks if all functions (outside class) and classes have package package tag may be inherited from file-level phpdocs

The new checks do the same thing.

The valid check notes:

Checks that wherever the package token is specified it is valid

It does this by checking the package against a list returned from local_moodlecheck_package_names. That list basically comes from \core_component, as does the new test.

Maybe, getting used to feed the CHANGELOG as part of the PR is good thing.

Bah - yes. I must get in this habit (done).

And, final reflexion... I think I commented elsewhere... let's give to this initiative a little bit of visibility (chat, forum, integration exposed, ...). Maybe there is something in the plan that we haven't detected, or somebody has a say about it...

Yes - you suggested this in PM. I'd say let's do:

  • announcement in chat
  • include in exposed post
  • possibly a forum post

@andrewnicols andrewnicols merged commit 254d707 into moodlehq:main Feb 23, 2024
8 checks passed
@stronk7
Copy link
Member

stronk7 commented Feb 23, 2024

Cool all!

@andrewnicols
Copy link
Contributor Author

@andrewnicols andrewnicols deleted the correctPackageTag branch February 23, 2024 07:43
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