Skip to content

This is an Eclipse plugin that shows C/C++ static analysis results found by Clang Static Analyzer and Clang Tidy

License

Notifications You must be signed in to change notification settings

Ericsson/CodeCheckerEclipsePlugin

Repository files navigation

CodeChecker Eclipse Plugin

Build Status

This is a C/C++ code analysis plugin for Eclipse that shows bugs detected by the Clang Static Analyzer and Clang Tidy analyzers, using CodeChecker as a backend,

Requirements

  • Linux operating system

  • Recent CodeChecker (6.8.0 and up)

  • Every eclipse version since Phtoton (v4.8.0) is supported

    • Should work with v4.7.0 Oxygen, but this version is untested currently.
  • Eclipse CDT

  • Java SE 1.8 (for building, an equivalent jdk).

Build and install CodeChecker Eclipse Plugin

Build

Run mvn -f mavendeps/pom.xml p2:site && mvn clean verify in the root of the project.

Install

  • Add the generated update site thats located under path/to/cloned/project/releng/org.codechecker.eclipse.update/target/repository/ to Help -> Install New Software... in Eclipse
    • Alternatively, use the archive from the Releases page, as an update site.
  • Select the newly added repository if not already selected
  • Mark CodeChecker Eclipse Plugin then hit next.
  • If an alert box comes up with unsigned content. Just accept it.

How to use

Make sure that before staring Eclipse:

  • CodeChecker/bin directory is included in PATH (e.g.: export PATH="/home/<username>/CodeChecker/bin/:$PATH")

Currently the plugin is only usable with a CDT project.

1. Setup Perspective

In Eclipse, select Window, Perspectives, and activate the CodeChecker perspective. Alternatively, you can manually add the two windows under the CodeChecker category into any perspective, using the Window - Views menu.
Make sure to check if CDT is installed properly if you do not see the CodeChecker perspective on the list!

Window->Perspective->Open Perspective->Other

2. Setup Nature

The plugin is activated on a per project basis, first you have to add the CodeChecker Nature to a CDT project using the projects context menu in the project explorer with Add CodeChecker Nature command.

CodeChecker Nature Add

3. Configure CodeChecker and checkers

After the CodeChecker Nature is added to the the project, the plugin can be configured globally in Window -> Preferences -> CodeChecker panel, or for the individual project, from the right click context menu -> Properties -> CodeChecker page. In the first section, you select how and which CodeChecker will be used. After that set some analysis related settings. You should build CodeChecker in a standalone package configuration.

cd codechecker
make standalone_package
export PATH=$PWD/build/CodeChecker/bin:$PATH

Then add it to the PATH environment variable, and use the Search in PATH option. Alternatively you can specify a different instance with the Pre built package option. But be aware that the plugin not supports virtual environment, that CodeChecker needs in the default configuration. You can download and compile CodeChecker from here.

To specify checkers or profiles, please add them to the Extra analysis options field.

At the bottom the command that is similar to that to be executed is displayed, for easier commandline reproduction.

CodeChecker Configure

After the plugin is successfully configured for a project, it'll listen to build events, and automatically rechecks the project with CodeChecker when needed.

4. Analyze C/C++ project and view results

By default the plugin displays the problems related to the currently selected file on the current file reports view. Here the viewer can decide to check the individual reports selected from the reports tree, and view the related bug-path. Double clicking on a bug-path item will jump and set the cursor to that line in the editor.

The analysis is triggered when opening a file, or on a file save event, for that particular file. Currently there is no full project analysis. Please note that codechecker will only show analysis results for files that you built. in the Current project View

CodeChecker Runtime Example

Contributing

For further information see developer documentation.

About

This is an Eclipse plugin that shows C/C++ static analysis results found by Clang Static Analyzer and Clang Tidy

Resources

License

Stars

Watchers

Forks

Packages

No packages published