Linting » History » Revision 3
« Previous |
Revision 3/12
(diff)
| Next »
osmith, 06/17/2021 08:27 AM
Linting¶
Patches submitted to Gerrit are automatically linted to ensure patches follow our coding standards and to catch common spelling errors. Jenkins runs checkpatch.pl
from the Linux kernel (with an Osmocom specific configuration) against the diff of the current patch.
Run locally¶
Go to the directory above your Osmocom sources, then run the following:
$ git clone https://git.osmocom.org/osmo-ci $ cd libosmocore $ ../osmo-ci/lint/lint_diff.sh
Pre-commit hook¶
The linting script is very fast, it makes sense to configure it locally as pre-commit hook. Then it will run whenever attempting to git commit
.
After cloning osmo-ci.git (see above), go to the directory above your Osmocom sources again and run the following. Replace libosmocore with any checked out Osmocom project.
$ ln -sv $PWD/osmo-ci/lint/lint_diff.sh libosmocore/.git/hooks/pre-commit
Osmocom specific configuration¶
Find the Osmocom specific configuration in osmo-ci/lint/checkpatch/checkpatch_osmo.sh
.
If you see the script generating errors with checks that don't apply for Osmocom code (see the ignores and excludes already in the script), please submit a patch against osmo-ci.git that disables this specific check.
Testing¶
Run osmo-ci/lint/lint_all.sh
in a git repository to run the script against all files in that repository and to report the total amount of errors. It is also possible to run only a specific check of checkpatch.pl
by passing it as argument. For example:
$ cd libosmocore $ ../osmo-ci/lint/lint_all.sh CODE_INDENT
See also¶
- #5087
Updated by osmith almost 3 years ago · 3 revisions