Kitware / KWStyle

Kitware Style Checker
Other
53 stars 30 forks source link

Forward declaration of function masks errors in class #68

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

// Forward declaration
bool runTest();

class Test
{
public:
    Test() {}

protected:
    bool result;
};

#endif

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

Without the forward declaration the error is detected correctly:

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

The forward declaration shouldn't mask errors in the class below.

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

wasim6691 commented 4 years ago

dude the variable naming inside the class should be as member variable i.e. mbool .. something like that .. m as prefix for variables.

aylward commented 4 years ago

Good catch! Forward declaration of classes hide errors in those classes.

S


Sent via phone.

On Thu, May 18, 2017, 10:42 AM Max Smolens notifications@github.com wrote:

With KWStyle.xml:

<?xml version="1.0" encoding="iso-8859-1"?>

m_[A-Z],0,1

and Test.h:

ifndef Test_h

define Test_h

// Forward declaration bool runTest();

class Test { public: Test() {}

protected: bool result; };

endif

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

Without the forward declaration the error is detected correctly:

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

The forward declaration shouldn't mask errors in the class below.

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

— 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/68, or mute the thread https://github.com/notifications/unsubscribe-auth/AAREr5ZYXmYASibBXjFjvhxof7CG7BJ0ks5r7FjygaJpZM4NfVr0 .

wasim6691 commented 4 years ago

please close the issue if possible. many thnaks

aylward commented 4 years ago

Has this bug been fixed? If so, what is the pull request # and merge?

s

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

please close the issue if possible. many thnaks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Kitware/KWStyle/issues/68?email_source=notifications&email_token=AACEJL43T4N746RZQ6B4HF3REN3STA5CNFSM4DL5LL2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMW33EA#issuecomment-590200208, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACEJL4GXWD3R3TG3OMQK33REN3STANCNFSM4DL5LL2A .

-- 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.