Skip to content

Commit 0c2efe0

Browse files
authored
Merge pull request #2925 from guwirth/cppcheck-2.17
Cppcheck 2.17 support
2 parents 014402a + 0e9ac78 commit 0c2efe0

File tree

4 files changed

+78
-3
lines changed

4 files changed

+78
-3
lines changed

cxx-sensors/src/main/resources/cppcheck.xml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8154,6 +8154,81 @@ Pointer arithmetic overflow.
81548154
<tag>cwe</tag>
81558155
<severity>MINOR</severity>
81568156
</rule>
8157+
<!-- ########### New in Cppcheck 2.17.1 ########### -->
8158+
<rule>
8159+
<key>class_X_Y</key>
8160+
<name>The code ' ' is not handled. You can use -I or --include to add handling of this code</name>
8161+
<description><![CDATA[
8162+
The code ' ' is not handled. You can use -I or --include to add handling of this code.
8163+
]]></description>
8164+
<severity>MINOR</severity>
8165+
<remediationFunction>CONSTANT_ISSUE</remediationFunction>
8166+
<remediationFunctionBaseEffort>5min</remediationFunctionBaseEffort>
8167+
</rule>
8168+
<rule>
8169+
<key>invalidConstFunctionType</key>
8170+
<name>It is unspecified behavior to const qualify a function type</name>
8171+
<description><![CDATA[
8172+
It is unspecified behavior to const qualify a function type.
8173+
]]></description>
8174+
<severity>MINOR</severity>
8175+
<type>BUG</type>
8176+
<remediationFunction>CONSTANT_ISSUE</remediationFunction>
8177+
<remediationFunctionBaseEffort>5min</remediationFunctionBaseEffort>
8178+
</rule>
8179+
<rule>
8180+
<key>macroWithSemicolon</key>
8181+
<name>Ensure that '' is defined either using -I, --include or -D</name>
8182+
<description><![CDATA[
8183+
Ensure that '' is defined either using -I, --include or -D.
8184+
]]></description>
8185+
<severity>MINOR</severity>
8186+
<remediationFunction>CONSTANT_ISSUE</remediationFunction>
8187+
<remediationFunctionBaseEffort>5min</remediationFunctionBaseEffort>
8188+
</rule>
8189+
<rule>
8190+
<key>nonStandardCharLiteral</key>
8191+
<name>Non-standard character literal. </name>
8192+
<description><![CDATA[
8193+
Non-standard character literal.
8194+
]]></description>
8195+
<severity>MINOR</severity>
8196+
<type>BUG</type>
8197+
<remediationFunction>CONSTANT_ISSUE</remediationFunction>
8198+
<remediationFunctionBaseEffort>5min</remediationFunctionBaseEffort>
8199+
</rule>
8200+
<rule>
8201+
<key>nullPointerOutOfMemory</key>
8202+
<name>Null pointer dereference</name>
8203+
<description><![CDATA[
8204+
<p>
8205+
Null pointer dereference
8206+
</p>
8207+
<h2>References</h2>
8208+
<p><a href="https://cwe.mitre.org/data/definitions/476.html" target="_blank">CWE-476</a></p>
8209+
]]></description>
8210+
<tag>cwe</tag>
8211+
<severity>MINOR</severity>
8212+
<type>BUG</type>
8213+
<remediationFunction>CONSTANT_ISSUE</remediationFunction>
8214+
<remediationFunctionBaseEffort>5min</remediationFunctionBaseEffort>
8215+
</rule>
8216+
<rule>
8217+
<key>nullPointerOutOfResources</key>
8218+
<name>Null pointer dereference</name>
8219+
<description><![CDATA[
8220+
<p>
8221+
Null pointer dereference
8222+
</p>
8223+
<h2>References</h2>
8224+
<p><a href="https://cwe.mitre.org/data/definitions/476.html" target="_blank">CWE-476</a></p>
8225+
]]></description>
8226+
<tag>cwe</tag>
8227+
<severity>MINOR</severity>
8228+
<type>BUG</type>
8229+
<remediationFunction>CONSTANT_ISSUE</remediationFunction>
8230+
<remediationFunctionBaseEffort>5min</remediationFunctionBaseEffort>
8231+
</rule>
81578232
<!-- ########### Internal Cppcheck errors (not in errorlist) ########### -->
81588233
<rule>
81598234
<key>internalAstError</key>

cxx-sensors/src/test/java/org/sonar/cxx/sensors/cppcheck/CxxCppCheckRuleRepositoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void createRulesTest() {
3737
def.define(context);
3838

3939
RulesDefinition.Repository repo = context.repository(CxxCppCheckRuleRepository.KEY);
40-
assertThat(repo.rules()).hasSize(688);
40+
assertThat(repo.rules()).hasSize(694);
4141
}
4242

4343
}
127 KB
Binary file not shown.

cxx-sensors/src/tools/generate_cppcheck_resources.cmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cls
33

44
SET SCRIPT_DIR=%~dp0
55
SET CPPCHECK_DIR=C:\Program Files\Cppcheck\
6-
SET PYTHON_DIR=C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\
6+
SET PYTHON_DIR=C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\
77

88
setlocal ENABLEDELAYEDEXPANSION
99

@@ -22,7 +22,7 @@ ECHO create Cppcheck errorlist cppcheck-errorlist.xml...
2222
"%CPPCHECK_DIR%cppcheck.exe" %CPPCHECK_LIBRARY_ARGS% --errorlist --xml-version=2 > cppcheck-errorlist.xml
2323

2424
ECHO create SonarQube rules file cppcheck.xml...
25-
"%CPPCHECK_DIR%cppcheck.exe" %CPPCHECK_LIBRARY_ARGS% --errorlist --xml-version=2 | "%PYTHON_DIR%python.exe" cppcheck_createrules.py rules cwec_v4.13.xml > cppcheck.xml
25+
"%CPPCHECK_DIR%cppcheck.exe" %CPPCHECK_LIBRARY_ARGS% --errorlist --xml-version=2 | "%PYTHON_DIR%python.exe" cppcheck_createrules.py rules cwec_v4.17.xml > cppcheck.xml
2626

2727
ECHO create cppcheck-comparison.md...
2828
"%PYTHON_DIR%python.exe" utils_createrules.py comparerules "%SCRIPT_DIR%\..\main\resources\cppcheck.xml" .\cppcheck.xml > cppcheck-comparison.md

0 commit comments

Comments
 (0)