Skip to content

cppcheck missing "nullPointerArithmeticRedundantCheck" rule #1636

@VirtualTim

Description

@VirtualTim

Description

Sonarqube cppcheck is missing the "nullPointerArithmeticRedundantCheck" rule. I believe it should be under https://github.com/SonarOpenCommunity/sonar-cxx/blob/master/cxx-sensors/src/main/resources/cppcheck.xml

The following is logged (filenames removed):

ERROR: Could not add the issue 'CxxReportIssue [ruleRepoKey=cppcheck, ruleId=nullPointerArithmeticRedundantCheck, locations=CxxReportLocation [file=C:████/████.cpp, line=448, info=Either the condition '!████' is redundant or there is pointer arithmetic with NULL pointer.], CxxReportLocation [file=C:████/████.cpp, line=448, info=Null pointer addition], CxxReportLocation [file=C:████/████.cpp, line=450, info=Assuming that condition '!████' is not redundant]]':The rule 'cppcheck:nullPointerArithmeticRedundantCheck' does not exist.
', skipping issue

If it helps here is an exert from the cppcheck xml report:

<results version="2">
<cppcheck version="1.84"/>
  <errors>
    <error id="nullPointerArithmeticRedundantCheck" severity="warning" msg="Either the condition '!████' is redundant or there is pointer arithmetic with NULL pointer." verbose="Either the condition '!████' is redundant or there is pointer arithmetic with NULL pointer." cwe="682">
      <location file0="C:████/████.cpp" file="C:████/████.cpp" line="448" info="Null pointer addition"/>
      <location file0="C:████/████.cpp" file="C:████/████.cpp" line="450" info="Assuming that condition '!████' is not redundant"/>
    </error>
  </errors>
</results>

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions