Skip to content

Commit

Permalink
Cppcheck 2.14.0 support
Browse files Browse the repository at this point in the history
- https://sourceforge.net/p/cppcheck/news/2024/04/cppcheck-2140/
- new rules:
  - eraseIteratorOutOfBounds
  - eraseIteratorOutOfBoundsCond
  - returnByReference
  - uselessOverride
- close SonarOpenCommunity#2668
  • Loading branch information
guwirth committed May 7, 2024
1 parent dd96ca6 commit 50b8f0e
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
55 changes: 55 additions & 0 deletions cxx-sensors/src/main/resources/cppcheck.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8056,6 +8056,61 @@ Pointer arithmetic overflow.
</description>
<severity>MINOR</severity>
</rule>
<!-- ########### New in Cppcheck 2.14.0 ########### -->
<rule>
<key>eraseIteratorOutOfBounds</key>
<name>Calling function 'erase()' on the iterator 'iter' which is out of bounds</name>
<description><![CDATA[
<p>
Calling function 'erase()' on the iterator 'iter' which is out of
bounds.
</p>
<h2>References</h2>
<p><a href="https://cwe.mitre.org/data/definitions/628.html" target="_blank">CWE-628</a></p>
]]></description>
<tag>cwe</tag>
<type>BUG</type>
<remediationFunction>CONSTANT_ISSUE</remediationFunction>
<remediationFunctionBaseEffort>5min</remediationFunctionBaseEffort>
</rule>
<rule>
<key>eraseIteratorOutOfBoundsCond</key>
<name>Either the condition 'x' is redundant or function 'erase()' is called on the iterator 'iter' which is out of bounds</name>
<description><![CDATA[
<p>
Either the condition 'x' is redundant or function 'erase()' is called
on the iterator 'iter' which is out of bounds.
</p>
<h2>References</h2>
<p><a href="https://cwe.mitre.org/data/definitions/628.html" target="_blank">CWE-628</a></p>
]]></description>
<tag>cwe</tag>
<severity>MINOR</severity>
<type>BUG</type>
<remediationFunction>CONSTANT_ISSUE</remediationFunction>
<remediationFunctionBaseEffort>5min</remediationFunctionBaseEffort>
</rule>
<rule>
<key>returnByReference</key>
<name>Function 'func()' should return member 'var' by const reference</name>
<description><![CDATA[
Function 'func()' should return member 'var' by const reference.
]]></description>
<severity>MINOR</severity>
<type>BUG</type>
<remediationFunction>CONSTANT_ISSUE</remediationFunction>
<remediationFunctionBaseEffort>5min</remediationFunctionBaseEffort>
</rule>
<rule>
<key>uselessOverride</key>
<name>The function '' overrides a function in a base class but just delegates back to the base class</name>
<description><![CDATA[
The function '' overrides a function in a base class but just delegates back to the base class.
]]></description>
<severity>MINOR</severity>
<remediationFunction>CONSTANT_ISSUE</remediationFunction>
<remediationFunctionBaseEffort>5min</remediationFunctionBaseEffort>
</rule>
<!-- ########### Internal Cppcheck errors (not in errorlist) ########### -->
<rule>
<key>internalAstError</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void createRulesTest() {
def.define(context);

RulesDefinition.Repository repo = context.repository(CxxCppCheckRuleRepository.KEY);
assertThat(repo.rules()).hasSize(681);
assertThat(repo.rules()).hasSize(685);
}

}

0 comments on commit 50b8f0e

Please sign in to comment.