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

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 5 08:08:22 PDT 2017


lebedev.ri updated this revision to Diff 117824.
lebedev.ri added a comment.

Ping.

- Rebased
- Added the legal status info into `LICENSE.txt`, referencing `clang-tidy/readability/FunctionCognitiveComplexityCheck.LICENSE.txt`, as suggested by @aaron.ballman

Question:
Is it expected that clang-tidy somehow parses the `DiagnosticIDs::Note`'s as `FixIt`'s, and thus fails with the following assert:

  Running ['clang-tidy', '/build/llvm-build-Clang-release/tools/clang/tools/extra/test/clang-tidy/Output/readability-function-cognitive-complexity.cpp.tmp.cpp', '-fix', '--checks=-*,readability-function-cognitive-complexity', '-config={CheckOptions: [{key: readability-function-cognitive-complexity.Threshold, value: 0}]}', '--', '-std=c++11', '-nostdinc++']...
  clang-tidy failed:
  Fix conflicts with existing fix! The new replacement overlaps with an existing replacement.
  New replacement: /build/llvm-build-Clang-release/tools/clang/tools/extra/test/clang-tidy/Output/readability-function-cognitive-complexity.cpp.tmp.cpp: 3484:+5:""
  Existing replacement: /build/llvm-build-Clang-release/tools/clang/tools/extra/test/clang-tidy/Output/readability-function-cognitive-complexity.cpp.tmp.cpp: 3485:+2:"&"
  clang-tidy: /build/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp:86: virtual void (anonymous namespace)::ClangTidyDiagnosticRenderer::emitCodeContext(clang::FullSourceLoc, DiagnosticsEngine::Level, SmallVectorImpl<clang::CharSourceRange> &, ArrayRef<clang::FixItHint>): Assertion `false && "Fix conflicts with existing fix!"' failed.


Repository:
  rL LLVM

https://reviews.llvm.org/D36836

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

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


More information about the cfe-commits mailing list