
General plugins (Local): Code-checker
local_codechecker
Maintained by
Tim Hunt,
Eloy Lafuente (stronk7)
A tool for developers that helps them follow Moodle's coding style.
257 sites
408 downloads
23 fans
Moodle 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0
The code checker tool is based on the PHP CodeSniffer library. It implements a set of 'sniffs' that check for many parts of the Moodle coding style. They also present a nice web interface for viewing the results.
Useful links
Contributors
Please login to view contributors details and/or to contact them
Member variable "unique_performance_info_token" must not contain underscores.« error. I always thought compound variable names must be separated by underscores. How should that variable name be written conforming to the coding style?
The comment style is really not important. I don't know why Eloy implemented it. (Eloy says he implemented it because I said he should, but I don't remember that.)
Anyway, the point of coding style is readability, so that when you are trying to understand some code, there are as few irrelevant distractions as possible.
I don't complain - it's just a complex field and I am just starting dig deeper into Moodle coding style.
sorry for the delay, I've been out last weeks and has been long to catch up with everything on return.
Mimicking (and joking) Tim: The comment style is really not important. I don't know why Tim proposed it. It was proposed, voted and agreed, so I don't think we are going to vote it again soon. I just implemented it.
In any case, it's only a warning. If anything you should be looking for errors only, warnings are recommendations, basically.
Ciao
somehow I missed your comment above about some operators not being detected properly when looking for whitespace around them. I've create CONTRIB-5862 about that, for reference.
Ciao
I don't recommend to ignore warnings. In fact, I do recommend to check both errors and warnings. More yet, I do check both always.
I only say that, while errors are clear violations, warnings can be understood as recommendations. If you decide to follow or ignore them it's up to you. Personally I follow them, it's not so hard, really. But your choice, anyway.
Ciao
Looking at the code I believe that this: https://github.com/moodlehq/moodle-local_codechecker/blob/master/moodle/tests/moodlestandard_test.php#L344 should be a failure of 'Expected 1 space before "="; 2 found' given: https://github.com/moodlehq/moodle-local_codechecker/blob/master/moodle/tests/fixtures/squiz_whitespace_operatorspacing.php#L18
Cheers,
Gareth
This doesn't check the column names in install.xml file. There is a coding standard for the column names as well. "Column names should be always lowercase, simple and short, following the same rules as for variable names. (https://docs.moodle.org/dev/Database)".