General plugins (Local): Code-checker

local_codechecker
Maintained by Tim at Lone Pine Koala SanctuaryTim Hunt, One poor developer...Eloy Lafuente (stronk7)
A tool for developers that helps them follow Moodle's coding style.
304 sites
319 downloads
31 fans
Current versions available: 4

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.

Screenshots

Screenshot #0
Screenshot #1

Contributors

Tim at Lone Pine Koala Sanctuary
Tim Hunt (Lead maintainer)
One poor developer...
Eloy Lafuente (stronk7)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • One poor developer...
    Tue, Aug 11, 2015, 12:27 AM
    LOL, Urs.

    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 smile
  • Picture of Nguyễn Tuấn Anh
    Tue, Dec 1, 2015, 10:30 PM
    I don't understand, used plugins like?
  • Picture of Ruslan Kabalin
    Tue, Mar 1, 2016, 10:50 PM
    "More documentation" link above should probably point to https://docs.moodle.org/dev/CodeSniffer rather than style documentation. Not sure though.
  • Picture of Derek Henderson
    Wed, Oct 5, 2016, 11:16 PM
    Would it be possible to include the latest version of the PHPCompatibility sniff and also add in the ability to pass in versions, so the code can be tested against different versions?
  • One poor developer...
    Mon, Nov 21, 2016, 5:19 AM
    Hi Derek, just for reference, there is https://tracker.moodle.org/browse/CONTRIB-5158 about that. It's old, but any movement towards that feature should happen there.
  • Picture of Dasu Gunathunga
    Tue, Aug 1, 2017, 10:59 AM
    Hi Tim,
    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)".
  • Tim at Lone Pine Koala Sanctuary
    Tue, Aug 1, 2017, 3:28 PM
    You should be using the XMLDB editor built in to Moodle, to edit your database definitions (Admin -> Development -> XMLDB editor). That checks the rules for you. I agree it would be nice to have the same checks in codechecker, but not essential.
  • This is a picture of me
    Tue, Jun 26, 2018, 3:38 AM
    Hi there,

    What are the thoughts of having the code checker ignore code folding? Does code folding need to be defined in the Moodle coding style before being allowed in the code checker?

    /// <editor-fold desc="This is a bunch of code that does stuff">
    /// </editor-fold>
  • Tim at Lone Pine Koala Sanctuary
    Tue, Jun 26, 2018, 5:43 AM
    If you want a 'bunch of code that does stuff' (with documentation, code folding, etc.) surely that is a function, and refactoring Moodle code to make it more understandable is encouraged.

    I don't know which editor you are using for that syntax to work. I have never seen it before, but doing something just for one editor is less likely to be a sensible decision.

    So, given we want to encourage well-factored code, not long sprawling blocks of code, and we want to be editor-neutral, I am not enthusiastic about your suggestion.
  • Picture of Joseph Rézeau
    Fri, Jan 18, 2019, 1:41 AM
    Cannot install latest version 2019011500 on my localhost moodle box. It keeps telling me "There is a new version 2019011500 available!
    Release 2.9.2 - Selectivenesses"
  • One poor developer...
    Fri, Jan 18, 2019, 1:53 AM
    Yeah, you're right Joseph!

    I did forget to bump version.php and just discovered it when publishing the new version in the Plugins directory. Expect a new release soon (2.9.3) fixing that. Sorry for the troubles!
  • Picture of Joseph Rézeau
    Fri, Jan 18, 2019, 6:44 AM
    Consider yourself repented and forgiven, Eloy. Happy New Year 2019!
  • One poor developer...
    Fri, Jan 18, 2019, 7:05 AM
    Best wishes there too! Thanks! smile
  • Picture of xvlcw zero
    Tue, Mar 12, 2019, 11:18 PM
    Can you run Code-checker via the command line (e.g. for CI)? Following the README didn't work: https://moodle.org/mod/forum/discuss.php?d=383557
1 2 3
Please login to post comments