Skip to content

Cppcheck support#2290

Closed
csordasmarton wants to merge 6 commits intoEricsson:masterfrom
csordasmarton:cppcheck
Closed

Cppcheck support#2290
csordasmarton wants to merge 6 commits intoEricsson:masterfrom
csordasmarton:cppcheck

Conversation

@csordasmarton
Copy link
Copy Markdown
Contributor

@csordasmarton csordasmarton commented Aug 27, 2019

Closes #484

@csordasmarton csordasmarton added enhancement 🌟 test ☑️ Adding or refactoring tests documentation 📖 Changes to documentation. analyzer 📈 Related to the analyze commands (analysis driver) labels Aug 27, 2019
@csordasmarton csordasmarton added this to the release 6.10.1 milestone Aug 27, 2019
@csordasmarton csordasmarton force-pushed the cppcheck branch 4 times, most recently from 2ab7e38 to e188c63 Compare August 27, 2019 15:12
@Ericsson Ericsson deleted a comment Aug 27, 2019
@Ericsson Ericsson deleted a comment Aug 27, 2019
@Ericsson Ericsson deleted a comment Aug 27, 2019
@Ericsson Ericsson deleted a comment Aug 27, 2019
@Ericsson Ericsson deleted a comment Aug 27, 2019
@Ericsson Ericsson deleted a comment Aug 27, 2019
@Ericsson Ericsson deleted a comment Aug 27, 2019
@Ericsson Ericsson deleted a comment Aug 27, 2019
@Ericsson Ericsson deleted a comment Aug 27, 2019
@Ericsson Ericsson deleted a comment Aug 27, 2019
@Ericsson Ericsson deleted a comment Aug 27, 2019
@Ericsson Ericsson deleted a comment Aug 27, 2019
@csordasmarton csordasmarton force-pushed the cppcheck branch 2 times, most recently from 360589d to b28793e Compare August 28, 2019 09:37
@Ericsson Ericsson deleted a comment Aug 28, 2019
@Ericsson Ericsson deleted a comment Aug 29, 2019
@Ericsson Ericsson deleted a comment Aug 29, 2019
@Ericsson Ericsson deleted a comment Aug 29, 2019
@Ericsson Ericsson deleted a comment Aug 29, 2019
@Ericsson Ericsson deleted a comment Aug 29, 2019
@Ericsson Ericsson deleted a comment Aug 29, 2019
@Ericsson Ericsson deleted a comment Aug 29, 2019
@Ericsson Ericsson deleted a comment Aug 29, 2019
@Ericsson Ericsson deleted a comment Aug 29, 2019
"""
raise NotImplementedError("Subclasses should implement this!")

@classmethod
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the @abstractmethod decorator wouldn't be better?

return clang

@classmethod
def version_compatible(cls, configured_binary, environ):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a classmethod?

return self.__available_checkers

def __gen_name_variations(self):
def get_analyzer_checkers(self, environ):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the @abstractmethod decorator wouldn't be better?

@@ -1,7 +1,7 @@
NORMAL#CodeChecker log --output $LOGFILE$ --build "make context_hash" --quiet
NORMAL#CodeChecker analyze $LOGFILE$ --output $OUTPUT$ --report-hash=context-free
NORMAL#CodeChecker analyze $LOGFILE$ --output $OUTPUT$ --report-hash=context-free --analyzers clang-tidy clangsa
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to disable cppcheck only for the context free hash tests?

@@ -0,0 +1 @@
-UHAVE_NULL_DEREFERENCE No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add comments to this file? A comment would be nice about the fact that this is how you can disable an error in cppcheck.

@Ericsson Ericsson deleted a comment Sep 2, 2019
@Ericsson Ericsson deleted a comment Sep 2, 2019
@dkrupp dkrupp modified the milestones: release 6.10.1, release 6.11.0 Sep 3, 2019
@gyorb
Copy link
Copy Markdown
Contributor

gyorb commented Dec 3, 2019

The support for cppcheck will be done differently after some discussion.

@gyorb gyorb closed this Dec 3, 2019
@gyorb gyorb removed this from the release 6.11.0 milestone Dec 3, 2019
@csordasmarton csordasmarton deleted the cppcheck branch December 19, 2019 09:32
vodorok added a commit to vodorok/codechecker that referenced this pull request Jun 9, 2022
This commit adds support for the Cppcheck analyzer.

The following two commits are also squashed into this:
* [test] Add new test cases for Cppcheck support
* [analyzer] Check version compatibility

This commit is the resurrection of works made by Márton Csordás.
The original pull request Ericsson#2290 had three more refactoring related change
sets which were omitted in this. Some changes were added in compared to
the original commits:
* The Cppcheck report converter is used to get the results in the
result_handler.
* Some small small compatibility changes were added because of the
changes in the code base.

Co-authored-by: bruntib <bruntib@users.noreply.github.com>
Co-authored-by: vodorok <vodorok@gmail.com>
vodorok added a commit to vodorok/codechecker that referenced this pull request Jun 9, 2022
This commit adds support for the Cppcheck analyzer.

The following two commits are also squashed into this:
* [test] Add new test cases for Cppcheck support
* [analyzer] Check version compatibility

This commit is the resurrection of works made by Márton Csordás.
The original pull request Ericsson#2290 had three more refactoring related change
sets which were omitted in this. Some changes were added in compared to
the original commits:
* The Cppcheck report converter is used to get the results in the
result_handler.
* The hash calculation logic has been uplifted to the latest one.
* Some small small compatibility changes were added because of the
changes in the code base.

Co-authored-by: bruntib <bruntib@users.noreply.github.com>
Co-authored-by: vodorok <vodorok@gmail.com>
@whisperity whisperity added the cppcheck 🐞 CppCheck is a static analysis tool for C++ code label Aug 4, 2022
vodorok added a commit to vodorok/codechecker that referenced this pull request Aug 10, 2022
This commit adds support for the Cppcheck analyzer.

The following two commits are also squashed into this:
* [test] Add new test cases for Cppcheck support
* [analyzer] Check version compatibility

This commit is the resurrection of works made by Márton Csordás.
The original pull request Ericsson#2290 had three more refactoring related change
sets which were omitted in this. Some changes were added in compared to
the original commits:
* The Cppcheck report converter is used to get the results in the
result_handler.
* The hash calculation logic has been uplifted to the latest one.
* Some small small compatibility changes were added because of the
changes in the code base.

Co-authored-by: bruntib <bruntib@users.noreply.github.com>
Co-authored-by: vodorok <vodorok@gmail.com>
whisperity pushed a commit that referenced this pull request Aug 19, 2022
[analyzer] Cppcheck support

This commit adds support for the Cppcheck analyzer.

The following two commits are also squashed into this:
* [test] Add new test cases for Cppcheck support
* [analyzer] Check version compatibility

This commit is the resurrection of works made by Márton Csordás.
The original pull request #2290 had three more refactoring-related change
sets which were omitted in this. Some changes were added in compared to
the original commits:
* The Cppcheck report converter is used to get the results in the
result_handler.
* The hash calculation logic has been uplifted to the latest one.
* Some small small compatibility changes were added because of the
changes in the code base.

Further changes:
* Cppcheck now works in a raw directory instead of directly into the
workspace folder.
* Exponential explosion of reports in plist files are now fixed.
* Checker disable now works on native levels.
* The `--disable <cppcheck_check>` now properly translates to
`--suppress <cppcheck_check>` in the cppcheck invocation.
* The current run configuration of cppcheck is `--enable=all`.

Added two new input paramaters:
* With `cppcheck-addons` extra cppcheck checkers can be specified.
* With `cppcheck-libraries` the cppcheck library definitions can be added.

Cppcheck reports have to be "fixed" for Codechecker to be able to
properly interpret them. The actual error message must be added to any
multistep report as a last bug path event.

Cppcheck checkers are prefixed with the `cppcheck-` prefix.

Co-authored-by: Márton Csordás <csordasmarton92@gmail.com>
Co-authored-by: bruntib <bruntib@gmail.com>
Co-authored-by: vodorok <vodorok@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

analyzer 📈 Related to the analyze commands (analysis driver) cppcheck 🐞 CppCheck is a static analysis tool for C++ code documentation 📖 Changes to documentation. enhancement 🌟 test ☑️ Adding or refactoring tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cppcheck?

5 participants