Skip to main content

Statick analysis plugins for Tooling files.

Project description

Statick Tooling Plugins

Unit Tests PyPI version Codecov Python Versions License Checked with mypy Daily Downloads Weekly Downloads Monthly Downloads

This is a set of plugins for Statick that will discover tooling related files and perform static analysis on those files.

Custom exceptions can be applied the same way they are with Statick exceptions.

Table of Contents

Installation

The recommended method to install these Statick plugins is via pip:

python3 -m pip install statick-tooling

You can also clone the repository and use it locally.

Usage

Make sure you install all the dependencies from apt/npm:

cat install.txt | xargs sudo apt-get install -y
cat npm-deps.txt | xargs sudo npm install -g

Pip Install

The most common usage is to use statick and statick-tooling from pip. In that case your directory structure will look like the following:

project-root
 |- tooling-project
 |- statick-config

To run with the default configuration for the statick-tooling tools use:

statick tooling-project/ --output-directory statick-output/ --profile tooling-profile.yaml

Pip Install and Custom Configuration

There are times when you will want to have a custom Statick configuration. This is usually done to run a different set of tools than are called out in the default profile, or to add exceptions. For this case you will have to add the new Statick configuration somewhere. This example will have custom exceptions in the tooling-project, such that the directory structure is:

project-root
 |- tooling-project
 |- statick-config
     |- rsc
         |- exceptions.yaml
 |- statick-output

For this setup you will run the following:

statick tooling-project/ --output-directory statick-output/ --user-paths tooling-project/statick-config/ --profile tooling-profile.yaml

Source Install and Custom Configuration

The last type of setup will be to have all of the tools available from cloning repositories, not installing from pip. The directory structure will look like:

project-root
 |- tooling-project
 |- statick-config
     |- rsc
         |- exceptions.yaml
 |- statick-output
 |- statick
 |- statick-tooling

Using the example where we want to override the default exceptions with custom ones in the tooling-project, the command to run would be:

./statick/statick tooling-project/ --output-directory statick-output/ --user-paths statick-tooling/,tooling-project/statick-config/ --profile tooling-profile.yaml

Existing Plugins

Discovery Plugins

Note that if a file exists without the extension listed it can still be discovered if the file command identifies it as a specific file type. This type of discovery must be supported by the discovery plugin and only works on operating systems where the file command exists.

File Type Extensions
dockerfile Dockerfile*

Tool Plugins

Tool About
dockerfilelint A rule based 'linter' for Dockerfiles.
dockerfile-lint A rule based 'linter' for Dockerfiles.
hadolint Dockerfile linter, validate inline bash, written in Haskell.

Contributing

If you write a new feature for Statick or are fixing a bug, you are strongly encouraged to add unit tests for your contribution. In particular, it is much easier to test whether a bug is fixed (and identify future regressions) if you can add a small unit test which replicates the bug.

Before submitting a change, please run tox to check that you have not introduced any regressions or violated any code style guidelines.

Mypy

Statick Tooling uses mypy to check that type hints are being followed properly. Type hints are described in PEP 484 and allow for static typing in Python. To determine if proper types are being used in Statick Tooling the following command will show any errors, and create several types of reports that can be viewed with a text editor or web browser.

python3 -m pip install mypy
mkdir report
mypy --ignore-missing-imports --strict --html-report report/ --txt-report report src

It is hoped that in the future we will generate coverage reports from mypy and use those to check for regressions.

Formatting

Statick code is formatted using black. To fix locally use

python3 -m pip install black
black src tests

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-tooling-0.1.1.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

statick_tooling-0.1.1-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file statick-tooling-0.1.1.tar.gz.

File metadata

  • Download URL: statick-tooling-0.1.1.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for statick-tooling-0.1.1.tar.gz
Algorithm Hash digest
SHA256 02289a8a292f29b379d453abcffbb0ce6bf601aef124a455e6b1690d84e791bd
MD5 62cdf9b5be6cecd71f22f01cf8b4e26c
BLAKE2b-256 5a9f5b4243ffea340614b19681a130c9c5a36ddd72ea5ae9e070f79deec367f5

See more details on using hashes here.

File details

Details for the file statick_tooling-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for statick_tooling-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9b71cab032ee1ed82247077592586b2471a05188afd71284b16cc6ceb320ebb5
MD5 f7395ffaec96a40fa7d6ca4f947ed738
BLAKE2b-256 b8c9d353fbc3e2ea7545e590b5db9995b4e890ba60a7a9513bd7713ed1d00cd0

See more details on using hashes here.

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