[clang-tidy] Add options to describe individual core increments to readability-functi...
authorJens Massberg <massberg@google.com>
Thu, 4 Mar 2021 20:02:26 +0000 (21:02 +0100)
committerKirill Bobyrev <kbobyrev@google.com>
Thu, 4 Mar 2021 20:02:27 +0000 (21:02 +0100)
commitbff7faea2034abed4535645d7c771e67c1f2bb23
treed422741045773a257128f8e4f770d5e31d2fe191
parent6bc767cd071ccdb41b5532f7d9cae22999e0fac4
[clang-tidy] Add options to describe individual core increments to readability-function-cognitive-complexity check.

Often you are only interested in the overall cognitive complexity of a
function and not every individual increment. Thus the flag
'DescribeBasicIncrements' is added. If it is set to 'true', each increment
is flagged. Otherwise, only the complexity of function with complexity
of at least the threshold are flagged.

By default 'DescribeBasisIncrements' is set to 'true', which is the original behavior of the check.

Added a new test for different flag combinations.

(The option to ignore macros which was original part of this patch will be added in another path)

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D96281
clang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp
clang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.h
clang-tools-extra/docs/clang-tidy/checks/readability-function-cognitive-complexity.rst
clang-tools-extra/test/clang-tidy/checkers/readability-function-cognitive-complexity-flags.cpp [new file with mode: 0644]