2021-06-16 12:15:27 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
|
|
|
|
|
|
|
|
# Excluded paths:
|
2021-07-07 08:53:00 +00:00
|
|
|
# * \.(ok|err)$: stdout and stderr of regression tests
|
2021-09-15 14:38:35 +00:00
|
|
|
# * ^debian/changelog$: generated from commit log, which may contain spelling errors (OS#5232)
|
2021-07-07 08:47:09 +00:00
|
|
|
# * ^lint/checkpatch/: so it does not warn about spelling errors in spelling.txt :)
|
2021-07-19 12:26:07 +00:00
|
|
|
# * ^src/gsm/kdf/: libosmocore: imported code
|
|
|
|
# * ^src/gsm/milenage/: libosmocore: imported code
|
2021-06-16 12:15:27 +00:00
|
|
|
|
|
|
|
# Ignored checks:
|
|
|
|
# * ASSIGN_IN_IF: not followed (e.g. 'if ((u8 = gsup_msg->cause))')
|
|
|
|
# * AVOID_EXTERNS: we do use externs
|
|
|
|
# * BLOCK_COMMENT_STYLE: we don't use a trailing */ on a separate line
|
2021-07-07 08:57:08 +00:00
|
|
|
# * COMPLEX_MACRO: we don't use parentheses when building macros of strings across multiple lines
|
2021-06-16 12:15:27 +00:00
|
|
|
# * CONSTANT_COMPARISON: not followed: "Comparisons should place the constant on the right side"
|
2021-07-12 14:54:08 +00:00
|
|
|
# * DEEP_INDENTATION: warns about many leading tabs, not useful if changing existing code without refactoring
|
2021-08-16 09:25:34 +00:00
|
|
|
# * EMBEDDED_FILENAME: this is useful sometimes (e.g. explaining how to use a script), so do not fail here
|
2021-06-16 12:15:27 +00:00
|
|
|
# * EMBEDDED_FUNCTION_NAME: often __func__ isn't used, arguably not much benefit in changing this when touching code
|
|
|
|
# * EXECUTE_PERMISSIONS: not followed, files need to be executable: git-version-gen, some in debian/
|
|
|
|
# * FILE_PATH_CHANGES: we don't use a MAINTAINERS file
|
|
|
|
# * FUNCTION_WITHOUT_ARGS: not followed: warns about func() instead of func(void)
|
|
|
|
# * GLOBAL_INITIALISERS: we initialise globals to NULL for talloc ctx (e.g. *tall_lapd_ctx = NULL)
|
|
|
|
# * IF_0: used intentionally
|
|
|
|
# * INITIALISED_STATIC: we use this, see also http://lkml.iu.edu/hypermail/linux/kernel/0808.1/2235.html
|
2021-07-07 09:04:47 +00:00
|
|
|
# * LINE_CONTINUATIONS: false positives
|
2021-06-16 12:15:27 +00:00
|
|
|
# * LINE_SPACING: we don't always put a blank line after declarations
|
2021-09-01 09:23:55 +00:00
|
|
|
# * LONG_LINE*: should be 120 chars, but exceptions are done often so don't fail here
|
2021-07-12 14:58:51 +00:00
|
|
|
# * PREFER_DEFINED_ATTRIBUTE_MACRO: macros like __packed not defined in libosmocore
|
2021-07-12 14:46:04 +00:00
|
|
|
# * PREFER_FALLTHROUGH: pseudo keyword macro "fallthrough" is not defined in libosmocore
|
2021-06-16 12:15:27 +00:00
|
|
|
# * REPEATED_WORD: false positives in doxygen descriptions (e.g. '\param[in] data Data passed through...')
|
|
|
|
# * SPDX_LICENSE_TAG: we don't place it on line 1
|
|
|
|
# * SPLIT_STRING: we do split long messages over multiple lines
|
|
|
|
# * STRING_FRAGMENTS: sometimes used intentionally to improve readability
|
2021-09-13 08:32:15 +00:00
|
|
|
# * UNNECESSARY_INT: not followed (see https://gerrit.osmocom.org/c/libosmocore/+/25345)
|
2021-09-13 08:35:45 +00:00
|
|
|
# * UNSPECIFIED_INT: not followed (doesn't seem useful for us)
|
2021-06-16 12:15:27 +00:00
|
|
|
|
|
|
|
$SCRIPT_DIR/checkpatch.pl \
|
2021-07-07 08:53:00 +00:00
|
|
|
--exclude '\.(ok|err)$' \
|
2021-09-15 14:38:35 +00:00
|
|
|
--exclude '^debian/changelog$' \
|
2021-07-07 08:47:09 +00:00
|
|
|
--exclude '^lint/checkpatch/' \
|
2021-07-19 12:26:07 +00:00
|
|
|
--exclude '^src/gsm/kdf/' \
|
|
|
|
--exclude '^src/gsm/milenage/' \
|
2021-06-16 12:15:27 +00:00
|
|
|
--ignore ASSIGN_IN_IF \
|
|
|
|
--ignore AVOID_EXTERNS \
|
|
|
|
--ignore BLOCK_COMMENT_STYLE \
|
2021-07-07 08:57:08 +00:00
|
|
|
--ignore COMPLEX_MACRO \
|
2021-06-16 12:15:27 +00:00
|
|
|
--ignore CONSTANT_COMPARISON \
|
2021-07-12 14:54:08 +00:00
|
|
|
--ignore DEEP_INDENTATION \
|
2021-08-16 09:25:34 +00:00
|
|
|
--ignore EMBEDDED_FILENAME \
|
2021-06-16 12:15:27 +00:00
|
|
|
--ignore EMBEDDED_FUNCTION_NAME \
|
|
|
|
--ignore EXECUTE_PERMISSIONS \
|
|
|
|
--ignore FILE_PATH_CHANGES \
|
|
|
|
--ignore FUNCTION_WITHOUT_ARGS \
|
|
|
|
--ignore GLOBAL_INITIALISERS \
|
|
|
|
--ignore IF_0 \
|
|
|
|
--ignore INITIALISED_STATIC \
|
2021-07-07 09:04:47 +00:00
|
|
|
--ignore LINE_CONTINUATIONS \
|
2021-06-16 12:15:27 +00:00
|
|
|
--ignore LINE_SPACING \
|
2021-07-29 17:17:05 +00:00
|
|
|
--ignore LONG_LINE \
|
2021-09-01 09:23:55 +00:00
|
|
|
--ignore LONG_LINE_COMMENT \
|
|
|
|
--ignore LONG_LINE_STRING \
|
2021-07-12 14:58:51 +00:00
|
|
|
--ignore PREFER_DEFINED_ATTRIBUTE_MACRO \
|
2021-07-12 14:46:04 +00:00
|
|
|
--ignore PREFER_FALLTHROUGH \
|
2021-06-16 12:15:27 +00:00
|
|
|
--ignore REPEATED_WORD \
|
|
|
|
--ignore SPDX_LICENSE_TAG \
|
|
|
|
--ignore SPLIT_STRING \
|
|
|
|
--ignore STRING_FRAGMENTS \
|
2021-09-13 08:32:15 +00:00
|
|
|
--ignore UNNECESSARY_INT \
|
2021-09-13 08:35:45 +00:00
|
|
|
--ignore UNSPECIFIED_INT \
|
2021-06-16 12:15:27 +00:00
|
|
|
--max-line-length 120 \
|
|
|
|
--no-signoff \
|
|
|
|
--no-tree \
|
|
|
|
"$@"
|