This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Fix hicpp-named-paramater
ClosedPublic

Authored by njames93 on Jun 28 2020, 3:36 AM.

Details

Summary

Currently this alias instantiates the readability-identifier-naming check, just swap it out to use the readability-named-paramater check.

Diff Detail

Event Timeline

njames93 created this revision.Jun 28 2020, 3:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 28 2020, 3:36 AM

I do not understand the justification here -- IdentifierNamingCheck and NamedParameterCheck are two different checks. How do you know that this swap continues to honor the HIC++ coding standard?

njames93 added a comment.EditedJun 29 2020, 5:15 AM

I do not understand the justification here -- IdentifierNamingCheck and NamedParameterCheck are two different checks. How do you know that this swap continues to honor the HIC++ coding standard?

Because thats what the documentation says
In docs/checks/hicpp-named-paramater.rst:

hicpp-named-parameter
This check is an alias for readability-named-parameter.

Implements rule 8.2.1.

From https://www.perforce.com/resources/qac/high-integrity-cpp-coding-standard/definitions:

8.2.1 Make parameter names absent or identical in all declarations

Its fairly obvious this has been incorrect since its inception. Arguable readability-named-paramater doesn't quite cover the extent of the HIC++ coding standard, but it goes a lot further than the identifier-naming-check does.

EDIT: Down the line I may create a check that fully enforces rule 8.2.1, but for now this is a good small step

aaron.ballman accepted this revision.Jun 29 2020, 5:24 AM

I do not understand the justification here -- IdentifierNamingCheck and NamedParameterCheck are two different checks. How do you know that this swap continues to honor the HIC++ coding standard?

Because thats what the documentation says
In docs/checks/hicpp-named-paramater.rst:

hicpp-named-parameter
This check is an alias for readability-named-parameter.

Implements rule 8.2.1.

From https://www.perforce.com/resources/qac/high-integrity-cpp-coding-standard/definitions:

8.2.1 Make parameter names absent or identical in all declarations

Its fairly obvious this has been incorrect since its inception. Arguable readability-named-paramater doesn't quite cover the extent of the HIC++ coding standard, but it goes a lot further than the identifier-naming-check does.

Oof! Good catch! Thanks for the explanation, I was missing that bit.

EDIT: Down the line I may create a check that fully enforces rule 8.2.1, but for now this is a good small step

Agreed. LGTM

This revision is now accepted and ready to land.Jun 29 2020, 5:24 AM
This revision was automatically updated to reflect the committed changes.