Kitware / KWStyle

Kitware Style Checker
Other
53 stars 30 forks source link

Incorrect line numbers of errors when LineLength rule isn't specified #60

Closed msmolens closed 5 years ago

msmolens commented 7 years ago

Line numbers aren't correct for errors when the "LineLength" rule isn't specified in the configuration file. This happens because GetLineNumber() assumes that CheckLineLength() has been run.

KWstyle.xml:

<?xml version="1.0" encoding="iso-8859-1"?>
<Description>
<SemicolonSpace>0</SemicolonSpace>
</Description>

example.cpp:

#include <iostream>

int main(int argc, char * argv[])
{
    int i = 3;;
    std::cerr << i << std::endl;
    return 0;
}

Command line:

$ KWStyle -xml ./KWStyle.xml -v -gcc example.cpp 
example.cpp:0: error: Too many semicolons

The error is on line 5, not line 0.

Tested with Kitware/KWStyle@76bf8fac39539a8835acf9e9db60c3f9b592df90.