Kitware / KWStyle

Kitware Style Checker
Other
53 stars 30 forks source link

Initializing member variable in class declaration masks variable name error #69

Open msmolens opened 7 years ago

msmolens commented 7 years ago

With KWStyle.xml:

<?xml version="1.0" encoding="iso-8859-1"?>
<Description>
<InternalVariables>m_[A-Z],0,1</InternalVariables>
</Description>

and Test.h:

#ifndef Test_h
#define Test_h

class Test
{
public:
    Test() {}

private:
    float score = 0.0f;
};

#endif

KWStyle fails to show the error in the name of the member variable.

Without the initialization of the variable in the header the error is detected correctly:

$ KWStyle -xml KWStyle.xml -v Test.h -gcc
Test.h:0: error: Internal variable (score) doesn't match regular expression (m_[A-Z])

The error should still show even when the variable is initialized in the class declaration.

Tested with https://github.com/Kitware/KWStyle/commit/e03980ff514d5248a9f95ea355dcd9eff78c62d3.

wasim6691 commented 4 years ago

Variables inside the class should be m_[variable_Name] to represent it as the member variable. Close the issue please. Thanks

aylward commented 4 years ago

Has this bug been fixed? If so, which was the pull request and merge?

On Mon, Feb 24, 2020 at 2:47 AM Muhammad Wasim Akhtar Khan < notifications@github.com> wrote:

Variables inside the class should be m_[variable_Name] to represent it as the member variable. Close the issue please. Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Kitware/KWStyle/issues/69?email_source=notifications&email_token=AACEJLZG4QJ6QJWI4JJQ46DREN3PHA5CNFSM4DL526GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMW3ZJQ#issuecomment-590199974, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACEJL2YQRYLWPKLQWT6ANDREN3PHANCNFSM4DL526GA .

-- Stephen R. Aylward, Ph.D. Senior Director of Strategic Initiatives

Kitware: Advancing the frontiers of understanding by developing innovative open-source software platforms and integrating them into research, processes, and products.