Page MenuHomePhabricator

[clang-tidy] readability-identifier-naming checks configs for included files
ClosedPublic

Authored by njames93 on Jul 28 2020, 6:09 PM.

Details

Summary

When checking for the style of a decl that isn't in the main file, the check will now search for the configuration that the included files uses to gather the style for its decls.

This can be useful to silence warnings in header files that follow a different naming convention without using header-filter to silence all warnings(even from other checks) in the header file.

Diff Detail

Event Timeline

njames93 created this revision.Jul 28 2020, 6:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2020, 6:09 PM
njames93 requested review of this revision.Jul 28 2020, 6:09 PM
njames93 updated this revision to Diff 281439.Jul 28 2020, 6:12 PM

Add missing new lines in test files.

gribozavr2 added inline comments.Jul 28 2020, 9:51 PM
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
125

I think it would be better to return the vector by value.

clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
63

I'd suggest to inline the definition of this typedef, because it makes code more obscure for the benefit of shortening the name by a couple of characters.

75

It would be nice to add the comment that explains what the keys for the map and the vector are.

njames93 updated this revision to Diff 281494.Jul 29 2020, 3:16 AM
  • Address comments
gribozavr2 accepted this revision.Jul 29 2020, 4:35 AM
gribozavr2 added inline comments.
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
77

And could you please document what the indices for the vector are?

clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp
8

"isn't"

This revision is now accepted and ready to land.Jul 29 2020, 4:35 AM
njames93 updated this revision to Diff 281756.Jul 29 2020, 3:48 PM

Rebase from parent and address comments.

njames93 marked 5 inline comments as done.Jul 29 2020, 3:49 PM
njames93 updated this revision to Diff 282172.Jul 31 2020, 3:14 AM

Added Option GetConfigPerFile to control this behaviour.
Ensure the check is enabled in the header files configuration before using any configuration found.

njames93 requested review of this revision.Jul 31 2020, 3:15 AM
njames93 added a reviewer: Eugene.Zelenko.
aaron.ballman accepted this revision.Jul 31 2020, 4:36 AM

This looks reasonable to me.

clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style-disabled/header.h
4

Can you add a newline to the end of this file?

This revision is now accepted and ready to land.Jul 31 2020, 4:36 AM
Eugene.Zelenko added inline comments.Jul 31 2020, 6:25 AM
clang-tools-extra/docs/ReleaseNotes.rst
76

Please enclose GetConfigPerFile in single back-quotes.

clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
719

Please use single back-quotes for option values. Same below.

720

I think will be good idea to reformulate without you, like header file included.

njames93 updated this revision to Diff 282379.Aug 1 2020, 1:14 AM
njames93 marked 4 inline comments as done.
  • Address comments.
  • Added test case for when this behaviour is disabled.
njames93 updated this revision to Diff 282380.Aug 1 2020, 1:19 AM

Fix unpunctuated comment and simplify second check command.