osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/42204?usp=email )
Change subject: checkpatch.conf: lint more code ......................................................................
checkpatch.conf: lint more code
The current linter configuration misses to find lots of formatting errors as we've seen here: https://gerrit.osmocom.org/c/osmo-trx/+/42198/comments/f8f1b5a2_3c7e1389
This is caused by the following exclude rules in .checkpatch.conf, which were added there to avoid that some of the checkpatch rules don't work correctly with C++ code:
---exclude .*h ---exclude Transceiver52M/grgsm_vitac/.* ---exclude utils/va-test/.*
Fix this by splitting the .checkpatch.conf into two files, .checkpatch.c.conf and .checkpatch.c++.conf. Let the C version use the default rules. Let the C++ version ignore the rules that don't work with C++ code:
* SPACING Fails on: std::vectorstd::string With: ERROR:SPACING: spaces required around that '<' (ctx:VxV) ERROR:SPACING: spaces required around that '>' (ctx:VxW)
* FUNCTION_ARGUMENTS Fails on: ScopedLock lock(mLock); With: WARNING:FUNCTION_ARGUMENTS: function definition argument 'mLock' should also have an identifier name
* INDENTED_LABEL Fails on: private: protected: With: WARNING:INDENTED_LABEL: labels should not be indented
* NEW_TYPEDEFS Fails on: typedef std::map<K,D*> Map; With: WARNING:NEW_TYPEDEFS: do not add new typedefs
With the new config, the linter only complains about the following things across the existing C++ code, which seem to be legitimate linting problems (and if not, can be ignored as well):
BRACES_NOT_NECESSARY, CODE_INDENT, LEADING_SPACE, MULTISTATEMENT_MACRO_USE_DO_WHILE, OPEN_BRACE, POINTER_LOCATION, PRINTF_I_OSMO, SINGLE_STATEMENT_DO_WHILE_MACRO, SPACE_BEFORE_TAB, STATIC_CONST_CHAR_ARRAY, TABSTOP, TRAILING_WHITESPACE
Depends: osmo-ci Ia2e75d9783382cefc3900a4ab51a5a919a2cbbbc Change-Id: I0df5b6f2f0bf1469a80a1f5859809c30f523f683 --- A .checkpatch.c++.conf A .checkpatch.c.conf D .checkpatch.conf 3 files changed, 10 insertions(+), 5 deletions(-)
Approvals: laforge: Looks good to me, but someone else must approve osmith: Looks good to me, approved Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve
diff --git a/.checkpatch.c++.conf b/.checkpatch.c++.conf new file mode 100644 index 0000000..907c8b3 --- /dev/null +++ b/.checkpatch.c++.conf @@ -0,0 +1,7 @@ +--exclude osmocom-bb/.* +--exclude ^.*.c$ +--ignore FUNCTION_ARGUMENTS +--ignore FUNCTION_WITHOUT_ARGS +--ignore INDENTED_LABEL +--ignore NEW_TYPEDEFS +--ignore SPACING diff --git a/.checkpatch.c.conf b/.checkpatch.c.conf new file mode 100644 index 0000000..6974059 --- /dev/null +++ b/.checkpatch.c.conf @@ -0,0 +1,3 @@ +--exclude osmocom-bb/.* +--exclude ^.*.cpp$ +--exclude ^.*.h$ diff --git a/.checkpatch.conf b/.checkpatch.conf deleted file mode 100644 index 1699801..0000000 --- a/.checkpatch.conf +++ /dev/null @@ -1,5 +0,0 @@ ---exclude osmocom-bb/.* ---exclude .*h ---exclude Transceiver52M/grgsm_vitac/.* ---exclude utils/va-test/.* ---ignore FUNCTION_WITHOUT_ARGS \ No newline at end of file