[PATCH] D36836: [clang-tidy] Implement readability-function-cognitive-complexity check

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 2 11:26:30 PDT 2020


lebedev.ri updated this revision to Diff 295879.
lebedev.ri retitled this revision from "[clang-tidy] Implement sonarsource-function-cognitive-complexity check" to "[clang-tidy] Implement readability-function-cognitive-complexity check".
lebedev.ri added a comment.

@aaron.ballman @alexfh it is my understanding that i'm to proceed with commit. No explicit acknowledgement from your side is needed.

In D36836#2308981 <https://reviews.llvm.org/D36836#2308981>, @lattner wrote:

> Hi all,
>
> The LLVM foundation board discussed this offline

Yay, thank you!

> it looks like the contributor is a bit confused about the LLVM project policies towards copyright, license, patent stuff etc.

...

> I really appreciate the dilligence here to capture the ideas that went into this code.
>
> My understanding is that the code and documentation are not derived from anyone else's code or documentation -- they are fresh implementations based on a paper written in english prose.  If that is the case,

That is the case, yes. This is based on the spec <https://www.sonarsource.com/docs/CognitiveComplexity.pdf>.

> please remove the LICENSE.TXT file -- it isn't necessary and it is confusing for people.    I would also recommend replacing all the references to sonar source with a functional description of what this patch is doing - we aren't talking about adding a feature because of sonar source,

Done, as much as possible. I'd still prefer to maintain a reference to the spec on which it is based.
Note that it was done because that is what was requested previously by reviewers.

> my understanding is that this is adding a cyclomatic complexity checker.

Well, yes and no. Note that this is *NOT* a well-known `cyclomatic complexity` metric, but a novel `cognitive complexity` metric.

> If and when the feature evolves over time, it would be misleading for it to be called sonar source.

Yes.

> Please note that I didn't do a full code review here, others should do that.

All good on that front, this has been quite extensively reviewed years ago :)

> -Chris

Roman


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D36836/new/

https://reviews.llvm.org/D36836

Files:
  clang-tools-extra/clang-tidy/readability/CMakeLists.txt
  clang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp
  clang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.h
  clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/checks/readability-function-cognitive-complexity.rst
  clang-tools-extra/test/clang-tidy/checkers/readability-function-cognitive-complexity.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36836.295879.patch
Type: text/x-patch
Size: 68606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201002/fa8e8b04/attachment-0001.bin>


More information about the cfe-commits mailing list