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 a new moodle-extra coding style #57

Merged
merged 1 commit into from
Sep 15, 2023

Conversation

andrewnicols
Copy link
Contributor

As dicussed in #45, and #25 it would be good to have a strict option.

This is an attempt largely based on the one I use daily (https://github.com/andrewnicols/moodle-cs-strict) with a few additions and removals.

@codecov
Copy link

codecov bot commented Sep 14, 2023

Codecov Report

Merging #57 (d7a9810) into main (57bd4db) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##               main      #57   +/-   ##
=========================================
  Coverage     95.53%   95.53%           
  Complexity      440      440           
=========================================
  Files            19       19           
  Lines          1165     1165           
=========================================
  Hits           1113     1113           
  Misses           52       52           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@stronk7
Copy link
Member

stronk7 commented Sep 14, 2023

I like this, and we can go promoting things from the "extra" ruleset to the "normal" one while things evolve...

BTW, does "extra" sound ok for you? For some reason (not sure why, to be honest, maybe because of Spanish...) I'm not sure. Maybe "plus", "strict", "get_it_serious" (lol)...

In any case I'm not strong at all with the above, if you're happy with "extra", I'm happy too. Just tell and I will proceed.

Ciao :-)

@andrewnicols
Copy link
Contributor Author

BTW, does "extra" sound ok for you? For some reason (not sure why, to be honest, maybe because of Spanish...) I'm not sure. Maybe "plus", "strict", "get_it_serious" (lol)...

I went for extra because that's what WordPress do for theirs: https://github.com/WordPress/WordPress-Coding-Standards#standards-subsets

Their description is:

extended ruleset with recommended best practices, not sufficiently covered in the WordPress core coding standards

I've also taken the liberty of updating the readme here to:

  • describe both of the coding tsyles
  • update information on how to use the new coding styles
  • remove the old information on configuration (moodle-local_codecheck is now wrong, and the other options are far from ideal).

This was linked to issues Sep 15, 2023
@stronk7
Copy link
Member

stronk7 commented Sep 15, 2023

Here we go! (note, I'll be making a release later today if that's ok for you)

@andrewnicols
Copy link
Contributor Author

Works for me.

I considered adding some more rules but I feel we should add unit tests for what we have first.

I was also wondering about writing a sniff for data providers to make them statically defined.

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,

it looks great!

@stronk7 stronk7 merged commit ef04fab into moodlehq:main Sep 15, 2023
7 checks passed
@stronk7 stronk7 mentioned this pull request Sep 15, 2023
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.

Strict Standard option Add a sniff for unused class imports
2 participants