Skip to content

Siyavula/moodle-styleguide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 

Repository files navigation

moodle-styleguide

Moodle coding style

Moodle has some very specific styling that should be followed, check out the coding style guide at:

www.moodledev.io

Setting up your linter

The linter recommended for moodle development is PHP Sniffer. PHP Sniffer is a tool used to analyse PHP code using a set of rules. In many cases these rules can be used to automatically fix the errors they identify.

The following are the steps to set up PHP Codesniffer:

  1. Start by installing composer, the steps are provided in the link below:

    www.digitalocean.com

  2. Install composer dependencies:

    composer global require "squizlabs/php_codesniffer=*"
    
    composer global require moodlehq/moodle-cs
  3. Add composer's path to your bashrc:

    export PATH="$PATH:$HOME/.config/composer/vendor/bin"
  4. Install PHP Sniffer in VS Code:

    • Press Ctrl+P on Linux/Windows or Cmd+P on Mac to open the Quick Open dialog.

    • Type ext install wongjn.php-sniffer to find the extension.

    • Press Enter or click the cloud icon to install it.

    • Restart Visual Studio Code when prompted.

  5. Test that PHP Sniffer is working:

    • Open any php file.

    • Add a variable in camel case.

    • Save changes and check that an error pops up for the incorrect case used.

Upgrading Plugin

To upgrade your plugin, certain files must be updated for moodle to detect that there is a new version of your plugin, please see the following links below:

Moodle Upgrade Plugin Guide

Moodle Upgrade API Guide

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published