[PATCH] D86671: [clang-tidy] Add new case type to check variables with Hungarian notation

Douglas Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 10 21:46:57 PDT 2020


dougpuob added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-hungarian-notation.cpp:25
+// RUN:     {key: readability-identifier-naming.FunctionCase       , value: CamelCase },           \
+// RUN:     {key: readability-identifier-naming.ClassCase          , value: szHungarianNotation }, \
+// RUN:     {key: readability-identifier-naming.TypedefCase        , value: szHungarianNotation }, \
----------------
aaron.ballman wrote:
> dougpuob wrote:
> > njames93 wrote:
> > > Class names shouldn't use hungarian notation.
> > OK~ I have classified CheckOptions, and all test cases one by one in the next diff.
> > 
> > ```
> > // RUN:   -config='{ CheckOptions: [ \
> > // RUN:     { key: readability-identifier-naming.ClassMemberCase              , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.ConstantCase                 , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.ConstantMemberCase           , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.ConstantParameterCase        , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.ConstantPointerParameterCase , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.ConstexprVariableCase        , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.GlobalConstantCase           , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.GlobalConstantPointerCase    , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.GlobalVariableCase           , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.LocalConstantCase            , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.LocalConstantPointerCase     , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.LocalPointerCase             , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.LocalVariableCase            , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.MemberCase                   , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.ParameterCase                , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.PointerParameterCase         , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.PrivateMemberCase            , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.StaticConstantCase           , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.StaticVariableCase           , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.StructCase                   , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.UnionCase                    , value: szHungarianNotation }, \
> > // RUN:     { key: readability-identifier-naming.VariableCase                 , value: szHungarianNotation }  \
> > // RUN:   ]}'
> > ```
> > Class names shouldn't use hungarian notation.
> 
> That may be debatable as I've definitely seen `C` used as a prefix for class names and `I` used as a prefix for pure virtual class names (interfaces). Doing a quick search on Google brings up evidence that this isn't uncommon.
Agree both of you because I saw them in different projects. I will add this feature as an option (default is off, user can enable it in .clang-tidy).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86671



More information about the cfe-commits mailing list