hanchenye-llvm-project/clang-tools-extra/clang-tidy
Roman Lebedev 4d37af003f [clang-tidy] readability-function-size: add VariableThreshold param.
Summary:
Pretty straight-forward, just count all the variable declarations in the function's body, and if more than the configured threshold - do complain.

Note that this continues perverse practice of disabling the new option by default.
I'm not certain where is the balance point between not being too noisy, and actually enforcing the good practice.
If we really want to not disable this by default, but also to not cause too many new warnings, we could default to 50 or so.
But that is a lot of variables too...

I was able to find one coding style referencing variable count:
  - https://www.kernel.org/doc/html/v4.15/process/coding-style.html#functions

    > Another measure of the function is the number of local variables. They shouldn’t exceed 5-10, or you’re doing something wrong.

Reviewers: hokein, xazax.hun, JonasToth, aaron.ballman, alexfh

Reviewed By: aaron.ballman

Subscribers: kimgr, Eugene.Zelenko, rnkovacs, cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D44602

llvm-svn: 329902
2018-04-12 12:06:42 +00:00
..
abseil [clang-tidy] fix header guard 2018-03-09 11:47:37 +00:00
android [clang-tidy] Add a `android-comparison-in-temp-failure-retry` check 2018-04-10 21:22:22 +00:00
boost [tidy] Move private ast matchers into anonymous namespaces to avoid ODR conflicts. 2018-02-18 19:02:35 +00:00
bugprone Fix unused variable warning. 2018-04-09 07:26:42 +00:00
cert [clang-tidy] Fix link error in clang-tidy after the recent check renames. 2017-11-27 15:17:13 +00:00
cppcoreguidelines [tidy] Move private ast matchers into anonymous namespaces to avoid ODR conflicts. 2018-02-18 19:02:35 +00:00
fuchsia [clang-tidy][Fuchsia]: don't forget to actually link to Google Module. 2018-04-10 20:07:02 +00:00
google [clang-tidy] Remove google-runtime-member-string-references 2018-04-05 14:51:01 +00:00
hicpp [clang-tidy] add missing assignment operations in hicpp-signed-bitwise 2018-04-11 09:53:08 +00:00
llvm [clang-tidy] Unify the way IncludeStyle and HeaderFileExtesions options are used 2017-07-20 12:02:03 +00:00
misc [clang-tidy] rename_check.py misc-unused-raii bugprone-unused-raii --check_class_name=UnusedRAIICheck 2018-03-15 08:27:42 +00:00
modernize [clang-tidy] [modernize-use-auto] Get only a length of token, not the token itself 2018-04-12 05:41:24 +00:00
mpi
objc do not register matcher for objc-only checks when analyzing non-objc sources to save resources 2018-03-07 18:59:25 +00:00
performance [clang-tidy] ObjC ARC objects should not trigger performance-unnecessary-value-param 2018-02-02 15:34:33 +00:00
plugin [clang-tidy] Add check: replace string::find(...) == 0 with absl::StartsWith 2018-03-09 10:47:14 +00:00
portability [clang-tidy] Add "portability" module and rename readability-simd-intrinsics to portability-simd-intrinsics 2018-03-07 16:57:42 +00:00
readability [clang-tidy] readability-function-size: add VariableThreshold param. 2018-04-12 12:06:42 +00:00
tool [clang-tidy] Return non-zero exit code for clang errors. 2018-04-09 15:12:10 +00:00
utils [clang-tidy] ObjC ARC objects should not trigger performance-unnecessary-value-param 2018-02-02 15:34:33 +00:00
zircon [clang-tidy] Add Zircon module to clang-tidy 2018-03-14 23:47:50 +00:00
CMakeLists.txt [clang-tidy] Add Zircon module to clang-tidy 2018-03-14 23:47:50 +00:00
ClangTidy.cpp Revert r328932 as it caused Windows and MacOS bot failures. 2018-04-02 18:02:36 +00:00
ClangTidy.h [clang-tidy] Add -vfsoverlay flag 2018-01-23 12:31:06 +00:00
ClangTidyDiagnosticConsumer.cpp Add support for NOLINT and NOLINTNEXTLINE comments mentioning specific check names. 2017-12-14 16:13:57 +00:00
ClangTidyDiagnosticConsumer.h [clang-tidy] Optimize GlobList::contains 2017-05-18 01:13:51 +00:00
ClangTidyModule.cpp Change getChecksFilter() interface to hide implementation details. 2017-05-17 14:39:47 +00:00
ClangTidyModule.h
ClangTidyModuleRegistry.h
ClangTidyOptions.cpp Fix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR 2017-06-30 20:57:16 +00:00
ClangTidyOptions.h [clang-tidy] Add FormatStyle configuration option. 2017-04-06 13:41:29 +00:00
add_new_check.py [clang-tidy] Enable Python 3 support for add_new_check.py 2018-03-24 10:49:17 +00:00
rename_check.py [clang-tidy] Use :doc: for check links in Release Notes. 2018-03-21 17:06:13 +00:00