Skip to content

Commit 073a607

Browse files
committed
Cppcheck v2.15.0 support
- new rule in Cppcheck 2.15.0 - suspiciousFloatingPointCast - update unit test
1 parent 8c53778 commit 073a607

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8111,6 +8111,20 @@ Pointer arithmetic overflow.
81118111
<remediationFunction>CONSTANT_ISSUE</remediationFunction>
81128112
<remediationFunctionBaseEffort>5min</remediationFunctionBaseEffort>
81138113
</rule>
8114+
<!-- ########### New in Cppcheck 2.15.0 ########### -->
8115+
<rule>
8116+
<key>suspiciousFloatingPointCast</key>
8117+
<name>Floating-point cast causes loss of precision</name>
8118+
<description><![CDATA[
8119+
<p>
8120+
If this cast is not intentional, remove it to avoid loss of precision
8121+
</p>
8122+
<h2>References</h2>
8123+
<p><a href="https://cwe.mitre.org/data/definitions/398.html" target="_blank">CWE-398</a></p>
8124+
]]></description>
8125+
<tag>cwe</tag>
8126+
<severity>MINOR</severity>
8127+
</rule>
81148128
<!-- ########### Internal Cppcheck errors (not in errorlist) ########### -->
81158129
<rule>
81168130
<key>internalAstError</key>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* C++ Community Plugin (cxx plugin)
3-
* Copyright (C) 2010-2023 SonarOpenCommunity
3+
* Copyright (C) 2010-2024 SonarOpenCommunity
44
* http://github.com/SonarOpenCommunity/sonar-cxx
55
*
66
* This program is free software; you can redistribute it and/or
@@ -37,7 +37,7 @@ void createRulesTest() {
3737
def.define(context);
3838

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

4343
}

0 commit comments

Comments
 (0)