diff options
author | Oliver Smith <osmith@sysmocom.de> | 2021-10-08 13:56:18 +0200 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2021-10-08 14:15:09 +0200 |
commit | b228c23e0804c784b8bed6331eef8021899aaada (patch) | |
tree | cacb936b9ccb7475c3eec146c9542304ead2e3a3 /lint/checkpatch | |
parent | c1bdb5b9ce182652f04d9ad6b7f12eaccbf662c0 (diff) |
lint: support project-specific exclude paths
While at it, put in the exact path to spelling.txt in osmo-ci.git.
Related: OS#5087
Change-Id: Ib23f9c65da1916ebf4654c5e641eaffe6c75315c
Diffstat (limited to 'lint/checkpatch')
-rwxr-xr-x | lint/checkpatch/checkpatch_osmo.sh | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/lint/checkpatch/checkpatch_osmo.sh b/lint/checkpatch/checkpatch_osmo.sh index 4710b7b..fd0e10a 100755 --- a/lint/checkpatch/checkpatch_osmo.sh +++ b/lint/checkpatch/checkpatch_osmo.sh @@ -1,12 +1,27 @@ #!/bin/sh -e SCRIPT_DIR="$(dirname "$(realpath "$0")")" +PROJECT="$(basename "$(git rev-parse --show-toplevel)")" -# Excluded paths: -# * \.(ok|err)$: stdout and stderr of regression tests -# * ^debian/changelog$: generated from commit log, which may contain spelling errors (OS#5232) -# * ^lint/checkpatch/: so it does not warn about spelling errors in spelling.txt :) -# * ^src/gsm/kdf/: libosmocore: imported code -# * ^src/gsm/milenage/: libosmocore: imported code +exclude_paths_common() { + # Stdout and stderr of regression tests + echo '--exclude \.(ok|err)$' + # Generated from commit log, which may contain spelling errors (OS#5232) + echo '--exclude ^debian/changelog$' +} + +exclude_paths_project() { + case "$PROJECT" in + libosmocore) + # Imported code + echo '--exclude ^src/gsm/kdf/' + echo '--exclude ^src/gsm/milenage/' + ;; + osmo-ci) + # Do not warn about spelling errors in spelling.txt :) + echo '--exclude ^lint/checkpatch/spelling.txt$' + ;; + esac +} # Ignored checks: # * ASSIGN_IN_IF: not followed (e.g. 'if ((u8 = gsup_msg->cause))') @@ -36,11 +51,8 @@ SCRIPT_DIR="$(dirname "$(realpath "$0")")" # * UNSPECIFIED_INT: not followed (doesn't seem useful for us) $SCRIPT_DIR/checkpatch.pl \ - --exclude '\.(ok|err)$' \ - --exclude '^debian/changelog$' \ - --exclude '^lint/checkpatch/' \ - --exclude '^src/gsm/kdf/' \ - --exclude '^src/gsm/milenage/' \ + $(exclude_paths_common) \ + $(exclude_paths_project) \ --ignore ASSIGN_IN_IF \ --ignore AVOID_EXTERNS \ --ignore BLOCK_COMMENT_STYLE \ |