[PATCH] D44602: [clang-tidy] readability-function-size: add VariableThreshold param.
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 17 14:04:09 PDT 2018
lebedev.ri created this revision.
lebedev.ri added reviewers: alexfh, hokein, xazax.hun, JonasToth, aaron.ballman.
lebedev.ri added a project: clang-tools-extra.
Herald added a subscriber: rnkovacs.
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:
> Another measure of the function is the number of local variables. They shouldn’t exceed 5-10, or you’re doing something wrong.
rCTE Clang Tools Extra
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 10597 bytes
Desc: not available
More information about the cfe-commits