6.2.11.1. ImportCheckstyleReport

Run a tool and import its Checkstyle XML report

Runs an external tool as a sub-process and parses violations from its Checkstyle-format XML report.

The report is read from the tool's standard output, or from report_location if the tool writes it to a file. Each entry becomes a violation with the provider option's value, checkstyle by default.

You can copy this rule if you need to run multiple Checkstyle-emitting tools.

Possible Messages

This rule has no predefined messages.

Options

additional_args

additional_args : list[str] = []

Additional arguments for the tool. They are passed on unquoted and unfiltered.
 

check_returncode

check_returncode : bool = True

Whether a non-zero exit status of the tool fails the rule. Turn it off for tools that report findings through their exit status, as many linters do.

Independent of this option, a run that imports no violations while the tool exits non-zero fails: its results are indistinguishable from a run in which the tool found nothing.

 

config_file

config_file : bauhaus.analysis.config.PlainPath | None = None

Configuration file for the tool, relative to cwd. The rule passes it to the tool and disables the tool's own configuration lookup, so the results do not depend on configuration files present in the analyzed sources.

Required by rules whose tool reads a configuration.

 

cwd

cwd : bauhaus.analysis.config.LayerRelativePath | None = None

Optional execution directory for the command.
 

encoding

encoding : str = 'utf-8'

The encoding of the output of the executed command. See also encoding_error_handler.
 

encoding_error_handler

encoding_error_handler

Type: EncodingErrorHandler

Default: 'IGNORE'

The strategy to handle encoding errors during processing of the output of the executed command.

  • STRICT: abort with on error on encoding errors,
  • IGNORE: ignore encoding errors (accepting data loss),
  • REPLACE: replace problematic code points with a question mark (?).
 

environment

environment : dict[str, str] = {}

Additional environment variables for the command. These entries are added to the inherited environment; existing entries are overwritten.
 

executable

executable : bauhaus.analysis.config.PlainPath | None = None

Path to the tool's executable. Unset, the tool is looked up on PATH.
 

report_location

report_location : bauhaus.analysis.config.LayerRelativePath | None = None

Checkstyle XML report the tool writes, relative to cwd. Unset, the report is read from the tool's standard output.
 

Option Types

These types are used by options listed above:

EncodingErrorHandler

  • STRICT

  • IGNORE

  • REPLACE