Skip to main content

Tool for running static analysis tools against packages of code.

Project description

# Statick

Statick is a set of tools to analyze software packages.

This README only covers basic usage of Statick. For more detailed information, see the [Statick User Guide](GUIDE.md). The User Guide is especially important for tips on creating and using your own testing levels and exceptions.

Statick uses a plugin system to load plugins from both a default resource location and also user-definable locations to run against software.

The plugins for the statick scans are divided into two categories:

  • Discovery plugins that find files to scan inside of a code package.

  • Tool plugins to run analysis programs against the files discovered by the discovery plugins.

## Install Required Tools

The below commands are for Ubuntu 16.04. The exact package names may vary for other systems.

These packages are for the tools used by the default configuration of Statick. Depending on your usage and configuration, you may not need these packages.

$ cat install.txt | xargs sudo apt-get install $ pip install -r requirements.txt

To run against ROS packages there are a few more system packages to get. This command assumes you have setup the [ROS apt repository](http://wiki.ros.org/ROS/Installation) for your system.

$ cat ros-deps.txt | xargs sudo apt-get install

## Setup cppcheck

cppcheck is a static analysis tool for C++. It is possible to set a required version of the tool to ensure consistency of output. The required version of the tool can be passed in as part of the tool flags in the config.yaml file. If a flag is not set for the version then any installed version of the tool will run. If a required version is set but not found then the tool will not run. An example of how to install a specific version of cppcheck is below.

In some spot on your filesystem (for example ~/src)

$ git clone –branch 1.81 https://github.com/danmar/cppcheck.git $ cd cppcheck $ make SRCDIR=build CFGDIR=/usr/share/cppcheck/ HAVE_RULES=yes $ sudo make install SRCDIR=build CFGDIR=/usr/share/cppcheck/ HAVE_RULES=yes

## Statick Installation (Optional)

To install Statick on your system and make it part of your $PATH:

$ sudo python setup.py install

## Running

If you are running from an installed version, you will use the statick or statick_ws command. If you are running job from a local version in your workspace, you can run it like ~/src/my_ws/src/ssc/statick/statick or ~/src/my_ws/src/ssc/statick/statick_ws.

For a description of all available arguments, pass the –help option to either program.

### For single packages

$ statick <path of package> <output path>

“Path of package” is the path of the package to be scanned.

“Output path” is the path where build and output files are stored. This should initially be an empty directory separate from your regular source and build directories. This directory must already exist before running the program.

If you are using this with a ROS Ament/Catkin workspace, you must have your workspace setup.bash sourced before running the tool.

### For a whole or partial ament/catkin workspace

$ statick_ws <path of src tree> <output path>

“path of src tree” is the src directory underneath your ament/catkin workspace root or any directory under that.

“Output path” is the path where build and output files are stored. This should initially be an empty directory separate from your regular source and build directories. This directory must already exist before running the program.

## Example Usage

Here are some example use cases for the level of compliance we are enforcing for now.

### For a single package

$ cd ~/src/my_ws $ . devel/setup.bash $ mkdir statick_output $ statick src/my_org/my_pkg statick_output

### For a part of a workspace

$ cd ~/src/my_ws $ . devel/setup.bash $ mkdir statick_output $ statick_ws src/my_org statick_output

### For a whole workspace

$ cd ~/src/my_ws $ . devel/setup.bash $ mkdir statick_output $ statick_ws src statick_output

# Statick Gauntlet

The statick gauntlet runs make against a set of targets individually from a clean workspace that allows it to catch dependency issues that may crop up on catkin_make. These issues usually manifest themselves as build failures that crop up and seem to magically resolve themselves by running the build again.

## Running

If you are running from an installed version, you will use the statick_gauntlet command. If you are running job from a local version in your workspace, you can run it like ~/src/my_ws/src/ssc/statick/statick_gauntlet

For a description of all available arguments, pass the –help option to the program.

$ gauntlet <path of catkin src> <output path>

“Path of catkin src” is the src dir underneath your catkin workspace root. There should be the default CMakeLists.txt there from running catkin_init_workspace or catkin_make.

“Output path” is the path where build and output files are stored. This should initially be an empty directory separate from your regular source and build directories. This directory must already exist before running the program.

You must NOT have your workspace sourced before running this tool. If there is a workspace sourced, it won’t do its job properly.

This command can not be run against individual packages, it must be run against a whole workspace. However, you can use the –targets_file option listed below to select which targets get tested. By default, it tests all targets.

You can pass the –failed-only option after a run that has failed targets to run only those targets that failed again.

You can pass the –targets-file <file> option to use the given file as a listing of targets to run. The file contents should look something like

target1 target2 target3

You can pass the –force-cmake option to force the gauntlet tool to rerun CMake. This may resolve any weird issues you experience.

## Example Usage

Here are some example use cases for running the gauntlet. Note that you are NOT sourcing the setup.bash.

### For a whole workspace

$ cd ~/src/my_ws $ mkdir gauntlet $ statick_gauntlet src gauntlet

### Running against failed packages

If you have failures, you can rerun the gauntlet against only those failures

$ cd ~/src/my_ws $ statick_gauntlet src gauntlet –failed-only

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

statick-0.1.9.tar.gz (54.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

statick-0.1.9-py3-none-any.whl (109.6 kB view details)

Uploaded Python 3

File details

Details for the file statick-0.1.9.tar.gz.

File metadata

  • Download URL: statick-0.1.9.tar.gz
  • Upload date:
  • Size: 54.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.9.1 setuptools/20.7.0 requests-toolbelt/0.8.0 tqdm/4.19.7 CPython/2.7.12

File hashes

Hashes for statick-0.1.9.tar.gz
Algorithm Hash digest
SHA256 d8d3f0316d3526df8195e356b240562a1bfabe5ec52fa6340a20e1d11c9ce2de
MD5 e1ee70553d796c529be8617c9be60a55
BLAKE2b-256 9d738a6b2b12bd10879f50dfb891b902f1081e3e27ec60b2f76ec1c3fe6ecf98

See more details on using hashes here.

File details

Details for the file statick-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: statick-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 109.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.3.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.2

File hashes

Hashes for statick-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 7490a07561d3bc0efbd4ba610bfe02673c8dd3aebd2a61bb929b3344cac91c83
MD5 8801ada7331531697891c46645d32003
BLAKE2b-256 a1d6f6096139b40e24a9c715df973471fbaef40cf3cfdc3d506b965325243125

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page