General plugins (Local): Code-checker

local_codechecker
Maintained by Tim at Lone Pine Koala Sanctuary Tim Hunt, One poor developer... Eloy Lafuente (stronk7)
A tool for developers that helps them follow Moodle's coding style.

Code-checker 2.9.3 - Selectivenesses (take #2)

Release notes

Moodle Code Checker

Build Status

Changes in version 2.9.3 (20190118) - Selectivenesses (take #2)

  • NOBUG: Some minor changes towards stable travis builds.
  • INCOMPETENCE: Fix the version.php information that Eloy missed for 2.9.2 smile

Information

This Moodle plugin uses the Pear CodeSniffer library to check that code follows the Moodle coding guidelines, available @ .

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 .

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 , 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 @ , 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.

Sublime Text

Find documentation here: https://docs.moodle.org/dev/Setting_up_Sublime2#Sublime_PHP_CS.
After step 3 in the Sublime PHP CS section: 1. Go in your Sublime Text to Preferences -> Package Control -> Package Control: Install Package 2. Write 'phpcs' in the search field, if you see Phpcs and SublimeLinter-phpcs, click on them to install them. 3. If not, check if they are already installed Preferences -> Package Control -> Package Control: Remove Package. 4. To set your codecheck to moodle standards go to Preferences -> Package Settings -> PHP Code Sniffer -> Settings-User and write:

               {   "phpcs_additional_args": {
                      "--standard": "moodle",
                       "-n": ""
                   },
               }
  1. If you don’t have the auto-save plugin turned on, YOU’RE DONE!
  2. If you have the auto-save plugin turned on, because the codecheck gets triggered on save, the quick panel will keep popping making it impossible to type. To stop quick panel from showing go to Settings-User file and add:
               "phpcs_show_quick_panel": false,

The line with the error will still get marked and if you’ll click on it you’ll see the error text in the status bar.

Moodle 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7

Version information

Version build number
2019011800
Version release name
2.9.3 - Selectivenesses (take #2)
Can be updated from
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), 2.7.1 - Slowly yours (2018012000), 2.7.2 - Barcelona awesomeness (2018070100), 2.9.2 - Selectivenesses (2019011500)
Maturity
Stable version
MD5 Sum
21c493e5c3b691fa6c4ff0d2a985bbaa
Supported software
PHP 5.6, PHP 7.0, Moodle 3.1, Moodle 3.2, Moodle 3.3, PHP 7.1, Moodle 3.4, PHP 7.2, Moodle 3.5, Moodle 3.6, Moodle 3.7
  • This is the latest release for Moodle 3.1
  • This is the latest release for Moodle 3.2
  • This is the latest release for Moodle 3.3
  • This is the latest release for Moodle 3.4
  • This is the latest release for Moodle 3.5
  • This is the latest release for Moodle 3.6
  • This is the latest release for Moodle 3.7

Version control information

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

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.