Code-checker

General plugins (Local) ::: local_codechecker
Maintained by One poor developer...Eloy Lafuente (stronk7), TimTim Hunt, Víctor Déniz Falcón, Sara Arjona Téllez
Part of set Moodle development.
A tool for developers that helps them follow Moodle's coding style.
Latest release:
618 sites
724 downloads
60 fans
Current versions available: 8

This Moodle plugin uses the PHP CodeSniffer tool to check that code follows the Moodle coding styleIt implements and reuses a set of 'sniffs' that check many aspects of the code, including the awesome PHPCompatibility ones.

They also present a nice web interface for viewing the results.

Screenshots

Screenshot #0
Screenshot #1

Contributors

One poor developer...
Eloy Lafuente (stronk7) (Lead maintainer)
Víctor Déniz Falcón
Sara Arjona Téllez
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • One poor developer...
    Tue, 11 Aug 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
  • Nguyễn Tuấn Anh
    Tue, 1 Dec 2015, 10:30 PM
    I don't understand, used plugins like?
  • Ruslan Kabalin
    Tue, 1 Mar 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.
  • Derek Henderson
    Wed, 5 Oct 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, 21 Nov 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.
  • Dasu Gunathunga
    Tue, 1 Aug 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
    Tue, 1 Aug 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, 26 Jun 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
    Tue, 26 Jun 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.
  • Joseph Rézeau
    Fri, 18 Jan 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, 18 Jan 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!
  • Joseph Rézeau
    Fri, 18 Jan 2019, 6:44 AM
    Consider yourself repented and forgiven, Eloy. Happy New Year 2019!
  • One poor developer...
    Fri, 18 Jan 2019, 7:05 AM
    Best wishes there too! Thanks! smile
  • xvlcw zero
    Tue, 12 Mar 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