This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Add parametercount for readibility-function-size
ClosedPublic

Authored by JonasToth on Feb 5 2017, 3:49 AM.

Details

Summary

Add an option to function-size to warn about high parameter counts.

This might be relevant for cppcoreguidelines and the safety module as well. Since the safety module is not landed in master already, i did not create an alias, but that can be done later as well.

Diff Detail

Repository
rL LLVM

Event Timeline

JonasToth created this revision.Feb 5 2017, 3:49 AM
JonasToth edited the summary of this revision. (Show Details)Feb 5 2017, 3:51 AM
alexfh requested changes to this revision.Feb 5 2017, 3:27 PM

Looks good in general, but please revert unrelated changes (see the comments inline).

test/clang-tidy/readability-function-size.cpp
6 ↗(On Diff #87137)

I suppose, weird formatting is a part of the test: it needs to count empty statements, empty lines, etc. (and on the opposite: not count lines when multiple statements are on the same line). Please revert formatting changes. You can add a comment about bad formatting being intentional.

13 ↗(On Diff #87137)

The patterns are truncated on purpose: there's not much value in repeating to much static text, so we recommend to leave only what's needed to keep the test readable and unambiguous (ideally, this would also fit into 80 characters).

This revision now requires changes to proceed.Feb 5 2017, 3:27 PM
JonasToth updated this revision to Diff 87244.Feb 6 2017, 9:50 AM
JonasToth edited edge metadata.

Reverted formatting change to testing code

JonasToth marked 2 inline comments as done.Feb 6 2017, 9:50 AM
This revision is now accepted and ready to land.Feb 6 2017, 10:15 AM

i dont have commit rights, can you land it for me please?

hokein requested changes to this revision.Feb 23 2017, 12:29 PM

Could you please also update the document in docs/clang-tidy/checks/readability-function-size.rst?

This revision now requires changes to proceed.Feb 23 2017, 12:29 PM
JonasToth updated this revision to Diff 89807.Feb 26 2017, 2:56 AM
JonasToth edited edge metadata.
  • [Doc] adjust doc for the checker
JonasToth updated this revision to Diff 89808.Feb 26 2017, 3:00 AM

i adjusted the docs and release notes.

hokein accepted this revision.Feb 27 2017, 1:51 AM

LGTM with one nit.

docs/ReleaseNotes.rst
72 ↗(On Diff #89808)

s/function/functions

This revision is now accepted and ready to land.Feb 27 2017, 1:51 AM
JonasToth updated this revision to Diff 89852.Feb 27 2017, 2:28 AM
JonasToth marked an inline comment as done.
  • [Fix] typo fixed

fixed typo, updated diff

This revision was automatically updated to reflect the committed changes.