Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyorgy Orban committed Nov 23, 2018
1 parent ed094fc commit dff4161
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 33 deletions.
18 changes: 10 additions & 8 deletions docs/developer.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@

## Troubleshooting
# Troubleshooting

* In case of compile error, attach the maven output
* Runtime logging is still a big todo, currently most log will appear on stdout/stderr

## Development Notes
# Development Notes

* Requires the Tycho Connector, Eclipse will automatically install it for you when you first import the project
* Requires Eclipse PDE (Plug-in Development Environment)
* [Requires Eclipse PDE](https://www.eclipse.org/pde/) (Plug-in Development Environment)
* WindowMaker plugin is recommended
* Adherence to the [Google Java Style](https://google.github.io/styleguide/javaguide.html) is mandatory
* An IntelliJ Idea autoformatter XML configuration file is included in the repo for convenience

## Version Update
# Update plugin version

Execute the following command in CodeCheckerEclipsePlugin/eclipse-plugin.
Execute the following command in CodeCheckerEclipsePlugin/eclipse-plugin:
``` mvn -Dtycho.mode=maven org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=X.X.X-SNAPSHOT -Dartifacts=cc.codechecker.eclipse.plugin ```

## Log
# Logging

Logging in the plugin is handled by `log4j` from Apache. The default loglevel is `ERROR`, and the following loglevels are used, in increasing severity order:

Expand All @@ -30,10 +30,12 @@ Logging in the plugin is handled by `log4j` from Apache. The default loglevel is

The log configuration file's location is `eclipse-plugin/eclipse/cc.codechecker.eclipse.plugin/log4j.properties` before compilation.

After compiling the plugin, you may change the log level (which specifies which *least severe* category will be logged) by opening the built `cc.codechecker.eclipse.plugin-0.0.1-SNAPSHOT.jar` file (with `mc` or any `zip` editor) and changing the `log4j.properties` file therein.
After compiling the plugin, you may change the log level (which specifies which *least severe* category will be logged) by opening the built `cc.codechecker.eclipse.plugin-0.0.6.jar` file (with `mc` or any `zip` editor) and changing the `log4j.properties` file therein.

The loglevel is specified as follows:

log4j.appender.log.threshold=ERROR
```
log4j.appender.log.threshold=ERROR
```

After modifying the jar file, you will need to restart eclipse for the changes to take effect.
52 changes: 27 additions & 25 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,69 @@

[![Build Status](https://travis-ci.org/Ericsson/CodeCheckerEclipsePlugin.svg?branch=master)](https://travis-ci.org/Ericsson/CodeCheckerEclipsePlugin)

This is a C/C++ code analysis plugin for Eclipse that shows bugs detected by the [Clang Static Analyzer](http://clang-analyzer.llvm.org/) and [Clang Tidy](http://clang.llvm.org/extra/clang-tidy/) analyzers, using [CodeChecker](https://github.com/Ericsson/codechecker) as a backend,
This is a C/C++ code analysis plugin for Eclipse that shows bugs detected by the [Clang Static Analyzer](http://clang-analyzer.llvm.org/) and [Clang Tidy](http://clang.llvm.org/extra/clang-tidy/) analyzers, using [CodeChecker](https://github.com/Ericsson/codechecker) as a backend to run the analyzers.

## Requirements
# Requirements

* Linux operating system
* Recent [CodeChecker](https://github.com/Ericsson/codechecker)
* [Eclipse](www.eclipse.org): the plugin is currently tested with Eclipse Neon, but any recent Eclipse version should work
* Eclipse CDT
* Linux operating system (Tested on Ubuntu 16.04)
* Recent [CodeChecker](https://github.com/Ericsson/codechecker) (v6.8.0 or newer)
* [Eclipse](https://www.eclipse.org): the plugin is currently tested with Eclipse Neon, but any recent Eclipse version should work
* [Eclipse CDT](https://www.eclipse.org/cdt/) (C/C++ Development Tooling)
* Java 1.7

## Build and install CodeChecker Eclipse Plugin
### Build
run `mvn package` in the project's directory in:
# Build and install CodeChecker Eclipse Plugin
## Build

`./eclipse-plugin/`
```sh
cd ./eclipse-plugin
mvn package # build the plugin and run the tests
```

### Install
* Copy the `cc.codechecker.eclipse.plugin-0.0.6-SNAPSHOT.jar`:
* From: ./eclipse-plugin/eclipse/cc.codechecker.eclipse.plugin/target/
* To: the dropins directory of Eclipse
## Install
Copy the `cc.codechecker.eclipse.plugin-0.0.6-SNAPSHOT.jar`:
* From: `./eclipse-plugin/eclipse/cc.codechecker.eclipse.plugin/target/`
* To: the `dropins` directory of Eclipse

## How to use
Make sure that before staring Eclipse:
# How to use
Make sure that before starting Eclipse:

* CodeChecker/bin directory is included in PATH (e.g.: `export PATH="/home/<username>/CodeChecker/bin/:$PATH"`)
* Python virtualenv with CodeChecker dependencies is sourced (e.g.: `source /home/<username>/venv/bin/activate`)
* CodeChecker/bin directory is included in PATH (e.g.: `export PATH="/home/<username>/CodeChecker/bin/:$PATH"`)
* Python virtualenv with CodeChecker dependencies is sourced (e.g.: `source /home/<username>/venv/bin/activate`)

__Currently the plugin is only usable with a CDT project.__
__Currently the plugin is only usable with a CDT project!__

#### 1. Setup Perspective
## 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.

![Window->Perspective->Open Perspective->Other](docs/allperspective.png)

#### 2. Setup Nature
## 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](docs/nature.png)

#### 3. Configure CodeChecker and checkers
## 3. Configure CodeChecker and checkers
After that, the settings can be customized in the project preferences window under the CodeChecker panel. For the plugin to work correctly, it is mandatory to add the correct path to the root of the CodeChecker package. You can download and compile CodeChecker from [here](https://github.com/Ericsson/codechecker).

![CodeChecker Configure](docs/config.png)
![CodeChecker Checkers Configure](docs/checkershow.png)

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. Set up eclipse C/C++ build environment
## 4. Set up eclipse C/C++ build environment

The code analysis runs only if your project can be built by Eclipse (as it intercepts gcc build commands).
Please check that your builder is set up correctly in properties/C/C++ Build settings.
If all goes well, you should be able to build your project from Eclipse using the Project/Build Project menu item.

#### 5. Analyze C/C++ project and view results
## 5. 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 bugpath. Double clicking on a bugpath item will jump and set the cursor to that line in the editor.

*Please note that codechecker will only show analysis results for files that you built. This means that if you want to see all bugs for your project you will need to do a full (clean) build. After you update a source file, analysis results will be updated when you rebuild your project.*

![CodeChecker Runtime Example](docs/example.png)

## Contributing
# Contributing

For further information see [developer documentation](docs/developer.md).

0 comments on commit dff4161

Please sign in to comment.