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.

Code-checker 2.5.1 - Valentinius release!

Moodle 2.7, 2.8, 2.9, 3.0
Released: Sunday, 14 February 2016, 6:23 PM

Moodle Code Checker

Changes in version 2.5.1 (20160214) - Valentinius release!

  • Pull request #19. Minor changes to make it work with CS 2.x (Corey Wallis).
  • CONTRIB-5175: Better modifiers matching in regexps.
  • CONTRIB-5732: Upgrade to recent version (Mark Nielsen):
    • Upgrade PHP_CodeSniffer to 2.5.1+ (b506fcd).
    • Upgrade PHPCompatibility to PHP 5.6 release.
    • Renew various moodle Sniffs using their updated sources.
    • Fixes to reporting API, unit tests...
    • Allow the UI to skip warnings (warningSeverity).
  • CONTRIB-6025, CONTRIB-6105: Allow type hinting phpdoc blocks, supported both in variable/list assignments and variable actions.
  • NOBUG: Improve moodle standard unit test coverage.
  • NOBUG: Added some UI acceptance tests.

Information

This Moodle plugin uses the Pear CodeSniffer library to check that code follows the Moodle coding guidelines, available @ http://docs.moodle.org/en/Development:Coding_style.

It was created by developers at the Open University, including Sam Marshall, Tim Hunt and Jenny Gray. It is now maintained by Moodle HQ.

Available releases can be downloaded and installed from https://moodle.org/plugins/view.php?plugin=local_codechecker.

To install it using git, type this command in the root of your Moodle install:

git clone git://github.com/moodlehq/moodle-local_codechecker.git local/codechecker

Then add /local/codechecker to your git ignore.

Alternatively, download the zip from https://github.com/moodlehq/moodle-local_codechecker/zipball/master, unzip it into the local folder, and then rename the new folder to "codechecker".

After you have installed this local plugin, you should see a new option in the settings block:

Site administration -> Development -> Code checker

We hope you find this tool useful. Please feel free to enhance it. Report any idea or bug @ https://tracker.moodle.org/browse/CONTRIB/component/12130, thanks!

IDE Integration

Eclipse:

  1. If if you use Eclipse for development, you might want to install the PHP CodeSniffer plugin (http://www.phpsrc.org/).
  2. Create a new "CodeSniffer standard" in the preferences page.
  3. Point it at the moodle directory inside the codechecker folder.
  4. Thank Michael Aherne from University of Strathclyde who worked this out!

PhpStorm

  1. Install the phpcs cli tool
  2. Open PhpStorm preferences
  3. Go to PHP > CodeSniffer and supply the path to the phpcs executable
  4. Go to Inspections > PHP > PHP Code Sniffer Validation
  5. In the 'coding standard' dropdown select 'custom' and press the [...] button next to the path to the coding standard. Point is at the moodle directory inside the this plugin directory.

Version information

Version build number
2016021400
Version release name
2.5.1 - Valentinius release!
Can be updated from
2.3.0 (2014021700), 2.3.1 - San Fermín release! (2014070700), 2.3.2 - Candelaria, mojo's paradise! (2014081500)
Can be updated to
2.5.2 - The March begins (2016031400), 2.5.3 - Another dent to indent (2016060800), 2.5.4 (2016093000), 2.7.0 - Boosting you! (2017052700)
Maturity
Stable version
MD5 Sum
3dfd7d0d25422569852726acd328c802
Supported software
PHP 5.4, PHP 5.5, Moodle 2.7, PHP 5.6, Moodle 2.8, Moodle 2.9, Moodle 3.0

Version control information

Version control system (VCS)
GIT
VCS repository URL
VCS branch
master
VCS tag
v2.5.1

Default installation instructions for plugins of the type General plugins (Local)

  1. Make sure you have all the required versions.
  2. Download and unpack the module.
  3. Place the folder in the "local" subdirectory.
  4. Visit http://yoursite.com/admin to finish the installation.