Remove size checks from .clang-tidy
These two checks around cognative complexity and function size were put
in this file aspirationally. To date no repositories have been able to
successfully enable these two checks. This maintainer has personally
tried and we'd either have to bypass so many functions that the check
became more cumbersome to maintain, or we'd have to raise the limits to
where they were not useful. While I'm hopeful that these checks could
be enabled in the future, they don't match the reality of where tidy is
at.
As a side note, one thing asio-based repos suffer from is overly large
inline lambdas. cognative complexity and length checks do not take
those into account when measuring line count, and in some cases seem to
actively disable the checks, so even if we were able to enable these
checks, as implemented in clang they're not useful in a lot of scenarios
today.
To ensure that the content is not lost, these two checks are moved into
documentation (tidy-desired.md) that can track the desire to enable
these checks, even if we're not able to do so today.
Change-Id: Ic86066f21f0c01a4d7b27a02829564f693f8b00b
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/style/cpp/.clang-tidy b/style/cpp/.clang-tidy
index 0643780..9c9ca5c 100644
--- a/style/cpp/.clang-tidy
+++ b/style/cpp/.clang-tidy
@@ -1,26 +1,9 @@
Checks: '-*,
bugprone-unchecked-optional-access,
modernize-use-nullptr,
- readability-function-size,
- readability-function-cognitive-complexity
'
-CheckOptions:
-- key: readability-function-size.LineThreshold
- value: 60 # [1]
-- key: readability-function-size.ParameterThreshold
- value: 6 # [2]
-- key: readability-function-cognitive-complexity.Threshold
- value: 25 # [3]
-
HeaderFilterRegex: '(?!^subprojects).*'
WarningsAsErrors: '*'
-# [1] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f3-keep-functions-short-and-simple
-# [2] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f2-a-function-should-perform-a-single-logical-operation
-# [3] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f3-keep-functions-short-and-simple
-# However cognitive complexity != cyclomatic complexity. Therefore using the clang-tidy default value,
-# as cyclomatic complexity seems to not be implemented in clang-tidy.
-
-# [1],[2],[3] do not have to be enforced or applied project-wide yet.
diff --git a/style/cpp/tidy-desired.md b/style/cpp/tidy-desired.md
new file mode 100644
index 0000000..2ea33a9
--- /dev/null
+++ b/style/cpp/tidy-desired.md
@@ -0,0 +1,28 @@
+# Desired clang-tidy checks
+
+The following file contains checks and settings that the project would like to
+enable, but has had trouble either in engineering or has other higher priority
+rework. There is general agreement that the below checks _should_ be useful, but
+have not concretely enabled them across the project.
+
+```yaml
+Checks: "-*, readability-function-size,
+ readability-function-cognitive-complexity
+ "
+
+CheckOptions:
+ - key: readability-function-size.LineThreshold
+ value: 60 # [1]
+ - key: readability-function-size.ParameterThreshold
+ value: 6 # [2]
+ - key: readability-function-cognitive-complexity.Threshold
+ value: 25 # [3]
+
+# [1] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f3-keep-functions-short-and-simple
+# [2] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f2-a-function-should-perform-a-single-logical-operation
+# [3] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f3-keep-functions-short-and-simple
+# However cognitive complexity != cyclomatic complexity. Therefore using the clang-tidy default value,
+# as cyclomatic complexity seems to not be implemented in clang-tidy.
+
+# [1],[2],[3] do not have to be enforced or applied project-wide yet.
+```