Skip to content

Commit d688ba1

Browse files
committed
gcc-parser: do not dig Cppcheck events in comments
1 parent e314e40 commit d688ba1

File tree

5 files changed

+27
-0
lines changed

5 files changed

+27
-0
lines changed

gcc-parser.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,9 @@ void BasicGccParser::handleError() {
352352

353353
bool BasicGccParser::digCppcheckEvt(Defect *pDef) {
354354
DefEvent &keyEvt = pDef->events[pDef->keyEventIdx];
355+
if (keyEvt.event == "#")
356+
// this is just a comment, do not look for real events
357+
return false;
355358

356359
boost::smatch sm;
357360
if (!boost::regex_match(keyEvt.msg, sm, reCppcheck_))

tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ test_csgrep(csgrep "37-csgrep-json" )
147147
test_csgrep(csgrep "38-csparser-remediation" )
148148
test_csgrep(csgrep "39-csparser-remediation" )
149149
test_csgrep(csgrep "40-csparser-code-snippet" )
150+
test_csgrep(csgrep "41-gcc-parser-pylint" )
150151
test_csparser(csparser-5.8 00)
151152
test_csparser(csparser-5.8 01)
152153
test_csparser(csparser-5.8 02)

tests/csgrep/41-gcc-parser-pylint-args.txt

Whitespace-only changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/builddir/build/BUILDROOT/hplip-3.18.4-1.el8+7.x86_64/usr/share/hplip/base/vcard.py:69:0: C0326[pylint]: No space allowed before bracket
2+
_boms.append( (codecs.BOM_UTF16_LE, "utf_16_le") )
3+
^
4+
/builddir/build/BUILDROOT/hplip-3.18.4-1.el8+7.x86_64/usr/share/hplip/base/vcard.py:70:0: C0326[pylint]: Exactly one space required after :
5+
except: pass
6+
^
7+
/builddir/build/BUILDROOT/hplip-3.18.4-1.el8+7.x86_64/usr/share/hplip/base/vcard.py:74:0: W0311[pylint]: Bad indentation. Found 5 spaces, expected 4
8+
/builddir/build/BUILDROOT/hplip-3.18.4-1.el8+7.x86_64/usr/share/hplip/base/vcard.py:75:0: W0311[pylint]: Bad indentation. Found 5 spaces, expected 4
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Error: PROSPECTOR_WARNING:
2+
/builddir/build/BUILDROOT/hplip-3.18.4-1.el8+7.x86_64/usr/share/hplip/base/vcard.py:69: C0326[pylint]: No space allowed before bracket
3+
# _boms.append( (codecs.BOM_UTF16_LE, "utf_16_le") )
4+
# ^
5+
6+
Error: PROSPECTOR_WARNING:
7+
/builddir/build/BUILDROOT/hplip-3.18.4-1.el8+7.x86_64/usr/share/hplip/base/vcard.py:70: C0326[pylint]: Exactly one space required after :
8+
#except: pass
9+
# ^
10+
11+
Error: PROSPECTOR_WARNING:
12+
/builddir/build/BUILDROOT/hplip-3.18.4-1.el8+7.x86_64/usr/share/hplip/base/vcard.py:74: W0311[pylint]: Bad indentation. Found 5 spaces, expected 4
13+
14+
Error: PROSPECTOR_WARNING:
15+
/builddir/build/BUILDROOT/hplip-3.18.4-1.el8+7.x86_64/usr/share/hplip/base/vcard.py:75: W0311[pylint]: Bad indentation. Found 5 spaces, expected 4

0 commit comments

Comments
 (0)