diff --git a/cxx-sensors/src/main/resources/cppcheck.xml b/cxx-sensors/src/main/resources/cppcheck.xml index 95d76b628f..b9eb0a5a4f 100644 --- a/cxx-sensors/src/main/resources/cppcheck.xml +++ b/cxx-sensors/src/main/resources/cppcheck.xml @@ -2115,11 +2115,11 @@ Memory allocation size is negative.Negative allocation size has no specified beh noConstructor - The class 'classname' does not have a constructor although it has private member variables + The class 'classname' does not declare a constructor although it has private member variables which likely require initialization -The class 'classname' does not have a constructor although it has +The class 'classname' does not declare a constructor although it has private member variables. Member variables of builtin types are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. @@ -8129,12 +8129,12 @@ Same iterator is used with different containers 'container1' and iterators3 - Same iterator is used with containers 'container' that are defined in different scopes + Same iterator is used with containers 'container' that are temporaries or defined in different scopes -Same iterator is used with containers 'container' that are defined in -different scopes. +Same iterator is used with containers 'container' that are temporaries +or defined in different scopes.

References

CWE-664: Improper Control of a Resource Through its Lifetime

@@ -8504,11 +8504,11 @@ Parameter 'x' can be declared with const
danglingTemporaryLifetime - Using object to temporary + Using object that is a temporary -Using object to temporary. +Using object that is a temporary.

References

CWE-562: Return of Stack Variable Address

@@ -8981,6 +8981,24 @@ missing return statement LINEAR 5min
+ + + missingMemberCopy + Member variable 'classname::varnamepriv' is not assigned in the copy constructor + +Member variable 'classname::varnamepriv' is not assigned in the copy +constructor. Should it be copied? +

+

References

+

CWE-398: 7PK - Code Quality

+ ]]>
+ cwe + MINOR + BUG + LINEAR + 5min +
misra-c2012-1.1 diff --git a/cxx-sensors/src/test/java/org/sonar/cxx/sensors/cppcheck/CxxCppCheckRuleRepositoryTest.java b/cxx-sensors/src/test/java/org/sonar/cxx/sensors/cppcheck/CxxCppCheckRuleRepositoryTest.java index 06faa131df..c2fa7dd671 100644 --- a/cxx-sensors/src/test/java/org/sonar/cxx/sensors/cppcheck/CxxCppCheckRuleRepositoryTest.java +++ b/cxx-sensors/src/test/java/org/sonar/cxx/sensors/cppcheck/CxxCppCheckRuleRepositoryTest.java @@ -37,7 +37,7 @@ public void createRulesTest() { def.define(context); RulesDefinition.Repository repo = context.repository(CxxCppCheckRuleRepository.KEY); - assertEquals(665, repo.rules().size()); + assertEquals(666, repo.rules().size()); } } diff --git a/cxx-sensors/src/tools/cwec_latest.xml.zip b/cxx-sensors/src/tools/cwec_latest.xml.zip index 2bb2b35b19..9abc5ee6e3 100644 Binary files a/cxx-sensors/src/tools/cwec_latest.xml.zip and b/cxx-sensors/src/tools/cwec_latest.xml.zip differ diff --git a/cxx-sensors/src/tools/generate_cppcheck_resources.cmd b/cxx-sensors/src/tools/generate_cppcheck_resources.cmd index c77733fbb1..8904bd1319 100644 --- a/cxx-sensors/src/tools/generate_cppcheck_resources.cmd +++ b/cxx-sensors/src/tools/generate_cppcheck_resources.cmd @@ -16,7 +16,7 @@ ECHO create Cppcheck errorlist cppcheck-errorlist.xml... "%CPPCHECK_DIR%cppcheck.exe" %CPPCHECK_LIBRARY_ARGS% --errorlist --xml-version=2 > cppcheck-errorlist.xml ECHO create SonarQube rules file cppcheck.xml... -"%CPPCHECK_DIR%cppcheck.exe" %CPPCHECK_LIBRARY_ARGS% --errorlist --xml-version=2 | "%PYTHON_DIR%python.exe" cppcheck_createrules.py rules cwec_v4.5.xml > cppcheck.xml +"%CPPCHECK_DIR%cppcheck.exe" %CPPCHECK_LIBRARY_ARGS% --errorlist --xml-version=2 | "%PYTHON_DIR%python.exe" cppcheck_createrules.py rules cwec_v4.6.xml > cppcheck.xml ECHO create cppcheck-comparison.md... "%PYTHON_DIR%python.exe" utils_createrules.py comparerules "%SCRIPT_DIR%\..\main\resources\cppcheck.xml" .\cppcheck.xml > cppcheck-comparison.md diff --git a/cxx-sensors/src/tools/generate_cppcheck_resources.sh b/cxx-sensors/src/tools/generate_cppcheck_resources.sh index 4f63c42e4e..c4a2f01d9b 100644 --- a/cxx-sensors/src/tools/generate_cppcheck_resources.sh +++ b/cxx-sensors/src/tools/generate_cppcheck_resources.sh @@ -18,5 +18,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" wget https://cwe.mitre.org/data/xml/cwec_latest.xml.zip --output-document=cwec_latest.xml.zip && unzip -j -o cwec_latest.xml.zip cppcheck ${CPPCHECK_LIBRARY_ARGS} --errorlist --xml-version=2 > cppcheck-errorlist.xml -cppcheck ${CPPCHECK_LIBRARY_ARGS} --errorlist --xml-version=2 | python cppcheck_createrules.py rules cwec_v4.2.xml > cppcheck.xml +cppcheck ${CPPCHECK_LIBRARY_ARGS} --errorlist --xml-version=2 | python cppcheck_createrules.py rules cwec_v4.6.xml > cppcheck.xml python utils_createrules.py comparerules $SCRIPT_DIR/../main/resources/cppcheck.xml cppcheck.xml > cppcheck-comparison.md