Skip to main content

Making code quality easier and tailored for you.

Project description

Statick

Service Status
Build Travis-CI
PyPI PyPI version
Codecov Codecov

Python Versions License Doc Daily Downloads Weekly Downloads Monthly Downloads

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. 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 three 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.
  • Reporting plugins to output the analysis results in various formats.

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 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

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.2.14.tar.gz (65.5 kB view hashes)

Uploaded Source

Built Distribution

statick-0.2.14-py3-none-any.whl (136.2 kB view hashes)

Uploaded Python 3

Supported by

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