Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Updated to include info on how to use git hook to validate code #4484

Merged
merged 1 commit into from
Sep 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/Developing/Using-Git.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ git pull upstream master
git push origin master
```

At this stage it's worth pointing out that we have some standard checks that are performed when you submit a
pull request, you can run these checks [yourself](Validating-Code.md) to be sure no issues are present in your
pull request.

Now, create a new branch to do you work on. It's important that you do this as you are then able to work on more than
one feature at a time and submit them as pull requests individually. If you did all your work in the master branch then
it gets a bit messy!
Expand Down
17 changes: 17 additions & 0 deletions doc/Developing/Validating-Code.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
source: Developing/Validating-Code.md

#### Validating Code

As part of the pull request process with GitHub we run some automated build tests to ensure that
the code is error free, standards [compliant](http://docs.librenms.org/Developing/Code-Guidelines/)
and our test suite builds successfully.
Expand All @@ -26,3 +28,18 @@ Once composer is installed you can now run the code validation script:

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 `pre-commit.php`
you can make this part of your commit process. You can do this in two ways:

1. If you already make use of `.git/hooks/pre-commit` then you can add:

./scripts/pre-commit.php

to be excecuted when you run `git commit`.

2. You can symlink the `pre-commit.php` file so it's executed directly on a `git commit`:

`ln -s /opt/librenms/scripts/pre-commit.php /opt/librenms/.git/hooks/pre-commit`