Tool Configuration

Built-in Configuration

Inspecode provides some built-in configurations that work well in most cases. These configurations can be applied by simply specifying their names to tools.

Configuration: default
inspecode:
  <tool>: default

is equivalent to:

inspecode:
  <tool>: {}

and means that the tool runs with its default configuration.

Note: By default, no tools attempt to fix issues automatically.

Configuration: auto-fix
inspecode:
  <tool>: auto-fix

is equivalent to:

inspecode:
  <tool>:
    auto-fix: true

and means that the tool not only runs with its default configuration but also fixes issues automatically if possible.

Custom Configuration

If the built-in configurations do not suit your project, you can customize the configuration for each tool by using mapping notation as follows:

(Single configuration)
inspecode:
  <tool>:
    auto-fix: <boolean>
    config-file: <string>
    input: <string|list>
    ignore: <string|list>
    machine:
      cpu: <string>
    options: <mapping|list>
    thresholds:
      num-issues: <number|mapping>
    experimental:
      incremental: <boolean>
(Multiple configurations)
inspecode:
  <tool>:
    - auto-fix: <boolean>
      config-file: <string>
      input: <string|list>
      ignore: <string|list>
      machine:
        cpu: <string>
      options: <mapping|list>
      thresholds:
        num-issues: <number|mapping>
      experimental:
        incremental: <boolean>
    - auto-fix: <boolean>
      config-file: <string>
      input: <string|list>
      ignore: <string|list>
      machine:
        cpu: <string>
      options: <mapping|list>
      thresholds:
        num-issues: <number|mapping>
      experimental:
        incremental: <boolean>
    - ...

When multiple configurations are given, the tool runs concurrently for each configuration.

Note: Multiple configurations have to be specified carefully to avoid running the tool redundantly on the same files. Otherwise, you might see duplicate issues reported.

Note: All fields are optional.

Field: auto-fix

Set auto-fix to true in order to let the tool fix issues automatically, or false otherwise. See help page of each tool to know whether the auto-fix feature is supported. If a tool supports auto-fix feature and you have enabled it, then the tool automatically fixes issues if possible.

Whenever some fixes are made by tools, Inspecode adds all the fixes to a special branch named <your branch>@inspecode and pushes that branch to your remote repository. You can then easily merge that branch into your branch.

Note: Inspecode never adds any changes to your original branch.

Note: Inspecode does not support auto-fix feature for pull requests. However, you can use auto-fix feature on the branch from which you will create pull request.

Note: Inspecode reverts any changes made in files which are excluded by the input and ignore patterns. Sometimes, this might lead to unexpected build breaks. Therefore, you may need to carefully configure the patterns and options for the tools.

Field: config-file

Specify a path of your configuration file to the tool.

For most tools, config-file is just an alias of options specifying configuration files, such as -c or --config.

If config-file is omitted, Inspecode may search your repository for configuration files and automatically specify them to the tool if found. See help page of each tool to know about what configuration files Inspecode searches for in your repository. If you do not want Inspecode to search/specify any configuration files, explicitly specify an empty string like config-file: "".

Note: Inspecode ignores the following configuration files while searching:

  • Files excluded by the input and ignore patterns
  • Documentation files

    • **/doc/**, **/docs/**, **/Docs/**, **/Doc/**
    • **/documentation/**, **/Documentation/**
    • **/javadoc/**, **/Javadoc/**
    • **/man/**, **/Man/**
    • **/examples/**, **/Examples/**
    • **/demo/**, **/demos/**, **/Demo/**, **/Demos/**
    • **/sample/**, **/samples/**, **/Sample/**, **/Samples/**
  • Dependencies

    • **/vendor/**
    • **/node_modules/**
  • Testing stuff

    • **/test/**, **/tests/**, **/testdata/**
    • **/spec/**
    • **/fixtures/**
  • Temporary files

    • **/tmp/**, **/temp/**
  • Files used by version control systems

    • **/.git/**, **/.svn/**, **/.hg/**, **/.bzr/**,
Field: input

Specify one or more patterns to select input files and directories that match the patterns. The notation is the same as .dockerignore file, so each pattern can be written in the form similar to the file globs of Unix shells with additional support of a special wildcard string ** and exceptions starting with !.

If no input patterns are specified, all files and directories in your repository are treated as input by default.

input supports string notation and list notation.

(String notation)

String notation is useful when specifying only one pattern.

inspecode:
  <tool>:
    input: <pattern>
(List notation)

List notation allows you to specify multiple patterns.

inspecode:
  <tool>:
    input:
      - <pattern1>
      - <pattern2>
      ...
Field: ignore

Specify one or more patterns to ignore files and directories that match the patterns. The notation is the same as .dockerignore file, so each pattern can be written in the form similar to the file globs of Unix shells with additional supports of a special wildcard string ** and exceptions starting with !.

Note: Ignore patterns are applied to files and directories selected by input patterns, so any exceptional ignore patterns starting with ! never select files and directories excluded by the input patterns.

ignore supports string notation and list notation.

(String notation)

String notation is useful when specifying only one pattern.

inspecode:
  <tool>:
    ignore: <pattern>
(List notation)

You can use List notation to specify multiple patterns.

inspecode:
  <tool>:
    ignore:
      - <pattern1>
      - <pattern2>
      ...
Field: machine

machine specifies the computational resource allocated to run the tool. See the format of resource quantity. As of now, you can specify cpu from 0.25 (250m) to 4 (4000m).

inspecode:
  <tool>:
    machine:
      cpu: <quantity>

With regard to the memory (RAM) size, 3.75 GiB are assigned for 1 CPU and the actual size is calculated from that ratio and the value specified to cpu. For example, 1.875 GiB are assigned for 0.5 (500m) CPU, and 5.625 GiB are assigned for 1.5 CPU.

If machine is not specified, the tool-specific default machine will be used. Please refer to help page of each tool for the specification of the default machine.

Note: The default machine for each tool is subject to change.

Field: options

options are essentially the same as command-line flags available for a tool. You can customize tools by specifying options in the same way you customize them by specifying flags on command-line. Due to security or other reasons, some command-line flags are not supported. Please refer to help page of each tool to see the list of available options.

options supports mapping notation and list notation.

(Mapping notation)

If you do not mind what order Inspecode specifies options to the tool, options can be declared in mappings of option names and values.

inspecode:
  <tool>:
    options:
      <name>: <null|string|list>
      ...

For example:

inspecode:
  <tool>:
    options:
      # Options that do not take any values, such as boolean switches.
      --no-values1:
      --no-values2: null
      --no-values3: []
      # Options that take a single value.
      --single-value: value
      # Options that take multiple values.
      --multiple-values1: [value1, value2, value3]
      --multiple-values2:
        - value1
        - value2
        - value3

Note: The way of specifying options to tools, such as --option value or --option=value, differs from tool to tool, and even from option to option. However, Inspecode resolves such differences appropriately for each tool, so you do not have to worry about that.

(List notation)

If you want Inspecode to specify options to tools in the strict order, list notation can be used for that purpose.

inspecode:
  <tool>:
    options:
      - <string|mapping>
      ...

For example:

inspecode:
  <tool>:
    options:
      # (String notation)
      # Unlike mapping notation, options with no values can be declared
      # by putting their names as strings.
      - --no-values
      # (Mapping notation)
      # Each list item can be a mapping of option name and values.
      - --single-value: value
      - --multiple-values: [value1, value2, value3]

With the configuration above, Inspecode respects the order of options and specify them to the tool like:

<tool> --no-value --single-value value --multiple-values value1,value2,value3

Furthermore, each list item can also be mappings of option names and values, for example:

inspecode:
  <tool>:
    options:
      - --option1-1: value1-1
        --option1-2: value1-2
      - --option2
      - --option3-1: value3-1
        --option3-2: value3-2

With the configuration above, Inspecode specifies:

  • --option1-* options prior to --option2
  • --option1-* options in random order among them
  • --option3-* options behind --option2
  • --option3-* options in random order among them
Field: thresholds

As with the thresholds in global configuration, if the thresholds are declared in tool configuration, Inspecode checks whether the number of issues detected by the tool exceeds the thresholds. The maximum value for the thresholds is 1000.

Note: If the check fails (i.e. the number of issues exceeds a threshold), the tool is marked as Failed. Furthermore, if the number of detected issues exceeds even the maximum threshold 1000, the entire job immediately stops running and is marked as Failed.

thresholds supports number notation and mapping notation.

(Number notation)

In number notation, only the threshold on the number of total issues detected by a tool is declared.

inspecode:
  <tool>:
    thresholds:
      num-issues: <number>
(Mapping notation)

In mapping notation, the thresholds on the number of issues for each severity level can be declared in addition to the threshold on the total number of issues.

inspecode:
  <tool>:
    thresholds:
      num-issues:
        total: <number>
        <level>: <number>
        ...

where each <level> can be one of critical | error | warning | info (case-insensitive) or one of tool-specific severity levels. See help page of each tool to know about what severity levels are supported.

Note: Similar to the global configuration, each severity level includes not only itself but also others higher than itself. This means, for example, that a threshold specified to warning level is applied to the sum of warning, error and critical issues.

Field: experimental

Note: The experimental configuration is subject to change in future.

  • incremental

    Set incremental to true for enabling the incremental analysis for the tool, or false otherwise. If this option is explicitly set, Inspecode ignores the global configuration and only respects this option when running the tool.

    inspecode:
      <tool>:
        experimental:
          incremental: <boolean>

results matching ""

    No results matching ""