Project Config (qlty.toml)
Project configuration stored in a qlty.toml
file is used by both Qlty CLI and Qlty Cloud. We strongly recommend that this file is commited into Git version control.
This file uses the TOML format and is located at .qlty/qlty.toml
in your repository:
If you do not have a .qlty/qlty.toml
file checked in to your repository, Qlty Cloud will
generate a new, temporary configuration file before running the analysis using qlty init
.
qlty.toml
Specification
Each field in the qlty.toml
file corresponds to a specific configuration setting. Detailed descriptions of these settings are provided below.
config_version
The version of the qlty.toml
configuration file format. Currently, all config_version
s are 0
. We may use this field in the future to introduce breaking changes to the configuration file format.
sources
sources
are defined at the top-level and specify repositories which contain plugin definitions. By convention, sources are placed at the top of the qlty.toml
file.
The default auto-generated configuration file will include a default source conveniently named default
. You can add additional sources from other Git repositories and name them as you like.
Below are the accepted properties to define a source:
Follow the example below to add a new source:
For each source, you can specify either a tag
or a branch
, but not both. If you specify
both, the tag
will be used.
exclude_patterns
Qlty is Git-aware and honors .gitignore
files. The exclude_patterns
setting allows you to specify additional directories and/or files that should be completely excluded from all Qlty activities, both from Qlty Cloud and Qlty CLI. This setting uses glob syntax to match file and directory names.
This setting is useful for excluding files that are not relevant for Qlty, such as generated code, build artifacts, temporary files, or third-party libraries. Below is an example of how to customize the exclude_patterns
setting to fit your project:
test_patterns
The test_patterns
setting allows you to specify directories and/or files that should considered automated tests run at build time rather than runtime application code. Qlty Cloud uses this information in order to provide higher qualtiy analysis results.
This setting uses glob syntax to match file and directory names. Below is an example of how to customize the test_patterns
setting to fit your project:
smells
The smells
setting defined at the top-level is used to configure the functioning of the qlty smell
CLI command, which is employed by Qlty Cloud to identify code smells in your project. This allows you to customize the detection and management of various code quality smells.
These settings apply for all supported programming languages, and can be customized further for each language using the languages
setting.
smells.mode
The mode
setting determines how Qlty Cloud handles detected code smells. Four modes are available:
smells.[name].enabled
The enabled
setting allows you to enable or disable the detection of specific code smells. By default, all smells are enabled, but you can selectively disable those that are not relevant to your project.
Below is an example of how to enable or disable specific smells:
smells.[name].threshold
The smells.[name].threshold
setting allows you to fine-tune the parameters for identifying specific types of code smells. Below is a comprehensive list of all available smell settings and their default thresholds:
smells.duplication
The smells.duplication
setting is used to configure the detection of duplicated code (copypasta code).
Below is an explanation of the available parameters:
Below is an example of how to configure the smells.duplication
setting:
This settings will applly to all programming languages. You can customize the duplication
detection settings for specific languages using the language
setting.
language.[name]
The language.[name]
setting allows you to customize various settings on a per-language basis, applicable to both Qlty Cloud and Qlty CLI.
language.[name].smells
This setting enables you to configure the detection and management of various code quality smells for a specific programming language. Below is an example of how to customize the detection of code smells for a particular language:
Alternatively, you can use this equally valid TOML syntax:
[[plugin]]
Each [[plugin]]
entry must be defined at the top-level of the qlty.toml
file, specifying the configuration for a specific plugin. You will need one [[plugin]]
entry for each plugin you want to enable in your project.
Below are the accepted properties for defining a [[plugin]]
entry:
Follow the example below to customize the execution of a plugin:
qlty plugins enable <plugin-name>
to automatically add the plugin to your qlty.toml file
.[[ignore]]
The [[ignore]]
block allows you to declare rules to ignore certain issues in your project, applicable to both Qlty Cloud and Qlty CLI. Each [[ignore]]
entry can specify conditions based on plugins
, rules
, file patterns
, and issue levels
. If an issue matches all the specified conditions, it will be ignored by Qlty.
Below are the accepted properties for defining an [[ignore]]
entry:
Below are examples of how to use the [[ignore]]
setting:
[[ignore]]
blocks are evaluated sequentially, and the first match will be applied. [[override]]
The [[override]]
block allows you to modify certain properties of issues detected by Qlty. Each [[override]]
entry can specify conditions (matchers) based on plugins
, rules
, and file patterns
to determine which issues the overrides apply to. If an issue matches all the specified conditions, its properties will be overridden by the values specified in the [[override]]
entry.
Below are the properties for defining an [[override]]
entry, divided into matchers and overrides:
Matchers
Overrides
Below are examples of how to use the [[override]]
setting:
[[override]]
blocks are evaluated sequentially, and the first match will be applied Glob Syntax Reference
Following, a table that illustrates the most commonly used glob syntaxes accepted by Qlty:
Full Example
The exact auto generated version of your .qlty/qlty.toml
file will vary depending on the languages and frameworks used in your project. Below is a general example of how it may look like for a JavaScript project.
The list of auto-enabled plugins provided by the Qlty CLI is a recommended suggestion. You are encouraged to add or remove plugins as needed.