Configuring flake8

It is possible to incorporate flake8 results in the TICS output for files. flake8 is a collection of Python linters.

Prerequisites

For a successful flake8 integration, the following prerequisites must be met:

Basic configuration

As of TICS 2019.3, both Python 2 and 3 are supported. Specifically the following packages are shipped with TICS: Python 2.7 flake8 3.7.8 and Python 3.6 flake8 3.7.8.

By default, TICS attempts to find flake8 on the PATH. Alternatively, a specific Python interpreter and/or a specific flake8 instance can be used.

The configuration for flake8 can be added to either the SERVER.yaml to apply them for all projects, or in PROJECTS.yaml to enable project-specific settings. If the properties are declared in the SERVER file and also in the PROJECT file, the project-specific properties will override the global properties.

Syntax

The following properties can (optionally) be declared, either on SERVER or PROJECT level:

TOOLS:
  flake8:
    INTERPRETER: '/path/to/python'
    INSTALLDIR: '/path/to/directory'

Specifying a Python interpreter

The INTERPRETER property can be used to specify the path to a Python interpreter, such as /usr/bin/python. If this property is not set, the default Python interpreter will be used.

Note that the Python interpreter has an effect on the violations that are produced by flake8. It is recommended to use the interpreter in which the project is supposed to run.

Specifying an installation dir

As an alternative to specifying a Python interpreter, an installation directory can be set through the INSTALLDIR property. This installation directory can either be a full Python installation containing flake8, or a virtual environment with access to flake8.

The installation directory can be specified either as an absolute path (e.g., /usr/local/python), or as a relative path from the chk directory (e.g., flake8).