Lines Matching +full:method +full:- +full:complexity
1 .. title:: clang-tidy - readability-function-cognitive-complexity
3 readability-function-cognitive-complexity
6 Checks function Cognitive Complexity metric.
8 The metric is implemented as per the `COGNITIVE COMPLEXITY by SonarSource
13 -------
17 Flag functions with Cognitive Complexity exceeding this number.
21 ---------------
23 There are three basic building blocks of a Cognitive Complexity metric:
28 The following structures increase the function's Cognitive Complexity metric
33 - ``if()``
34 - ``else if()``
35 - ``else``
36 - ``cond ? true : false``
41 - ``for()``
42 - C++11 range-based ``for()``
43 - ``while()``
44 - ``do while()``
50 - ``boolean1 || boolean2``
51 - ``boolean1 && boolean2``
56 While by itself the nesting level not change the function's Cognitive Complexity
62 - ``if()``
63 - ``else if()``
64 - ``else``
65 - ``cond ? true : false``
70 - ``for()``
71 - C++11 range-based ``for()``
72 - ``while()``
73 - ``do while()``
78 - C++11 Lambda
79 - Nested ``class``
80 - Nested ``struct``
88 The following structures increase the function's Cognitive Complexity metric by
93 - ``if()``
94 - ``cond ? true : false``
99 - ``for()``
100 - C++11 range-based ``for()``
101 - ``while()``
102 - ``do while()``
107 --------
109 The simplest case. This function has Cognitive Complexity of `0`.
111 .. code-block:: c++
115 Slightly better example. This function has Cognitive Complexity of `1`.
117 .. code-block:: c++
125 Full example. This function has Cognitive Complexity of `3`.
127 .. code-block:: c++
139 -----------
144 * `each method in a recursion cycle` is not accounted for. It can't be fully
145 implemented, because cross-translational-unit analysis would be needed,
146 which is currently not possible in clang-tidy.