Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

#### Validating Code
As part of the pull request process with GitHub we run some automated
2022-02-09 00:02:28 +01:00
build tests to ensure that the code is error free, standards compliant
2016-08-26 00:40:11 +01:00
and our test suite builds successfully.
Rather than submit a pull request and wait for the results, you can
run these checks yourself to ensure a more seamless merge.
2016-08-26 00:40:11 +01:00
> All of these commands should be run from within the librenms
> directory and can be run as the librenms user unless otherwise noted.
2016-08-26 00:40:11 +01:00
Install composer (you can skip this if composer is already installed).
`curl -sS https://getcomposer.org/installer | php`
Composer will now be installed into /opt/librenms/composer.phar.
Now install the dependencies we require:
2017-06-06 22:49:53 +01:00
`./composer.phar install`
2016-08-26 00:40:11 +01:00
Once composer is installed you can now run the code validation script:
`./lnms dev:check`
2016-08-26 00:40:11 +01:00
If you see `Tests ok, submit away :)` then all is well. If you see
other output then it should contain what you need to resolve the issues and re-test.
#### Git Hooks
Git has a hook system which you can use to trigger checks at various
stages. Utilising the `./lnms dev:check` you can make this part of your
commit process.
Add `./lnms dev:check` to your `.git/hooks/pre-commit`:
echo "/opt/librenms/lnms dev:check" >> /opt/librenms/.git/hooks/pre-commit
chmod +x /opt/librenms/.git/hooks/pre-commit