Skip to content

Unexpected findings #65

@ruedbi

Description

@ruedbi

based on 96c8b87

  1. looks like that a constructor is not checked for the class name pattern, but the one of the function (here: lowerCamel), like so:
    File = 2.04.initializer.list.cpp
    Config = cppnamelint.toml
    Checked = 16 [File:0 | Func: 4 | Param: 4 | Var: 8 | Enum: 0 | Struct: 0 | Union: 0 | Class: 2]
    Error = 2 [File:0 | Func: 2 | Param: 0 | Var: 0 | Enum: 0 | Struct: 0 | Union: 0 | Class: 0]

< 18, 5> Function : Foo
< 24, 5> Function : MagicFoo

The same applies to structs:
File = 10.2.concepts.cpp
Config = cppnamelint.toml
Checked = 35 [File:0 | Func: 13 | Param: 7 | Var: 12 | Enum: 0 | Struct: 3 | Union: 0 | Class: 1]
Error = 26 [File:0 | Func: 7 | Param: 7 | Var: 10 | Enum: 0 | Struct: 2 | Union: 0 | Class: 0]

< 30, 5> Function : Person

  1. "Parameters" are reported without configuration that could be set, and disable reporting is also not possible (the TODO?)

  2. Add any namespace around the code in e.g. 10.2.concepts.cpp and the errors will melt down to a few only:

File = 10.2.concepts.cpp
Config = cppnamelint.toml
Checked = 13 [File:0 | Func: 3 | Param: 3 | Var: 4 | Enum: 0 | Struct: 3 | Union: 0 | Class: 0]
Error = 9 [File:0 | Func: 2 | Param: 3 | Var: 2 | Enum: 0 | Struct: 2 | Union: 0 | Class: 0]

< 40, 16> Parameter : a (double)
< 40, 26> Parameter : b (double)
< 41, 9> Function : to_string
< 50, 9> Function : to_string
< 50, 26> Parameter : l (list)
< 52, 13> Variable : s (string)
< 62, 5> Variable : to_string (string)

  1. I have some cases where cppnamelint stops after the first line of code. I cannot say when that happens / what the rule is,
    baut at least "VariableName = 2" (or 3) seems to be required with UpperCamel classe name (other combinations not tested).
    I could create a simple class like
    class BlaBla
    {
    int someVar;
    };
    then the class gets detected as a variable
    Checked = 1 [File:0 | Func: 0 | Param: 0 | Var: 1 | Enum: 0 | Struct: 0 | Union: 0 | Class: 0]
    Error = 1 [File:0 | Func: 0 | Param: 0 | Var: 1 | Enum: 0 | Struct: 0 | Union: 0 | Class: 0]

< 1, 1> Variable : BlaBla (class)
the log then ends with
[2021-04-20 12:49:39.948] [] [info] Program is going to close. (iRet=1)
the real variable someVar does not even get checked

Can you reproduce that issue?

All for now, thanks a lot for your efforts!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions