You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Package and export configuration files from plugins (#2044)
This change allows plugins to package and declare exported configuration
files using the syntax below:
```toml
[plugins.definitions.some-plugin]
# Paths are relative to this TOML file location (plugin.toml, source.toml, etc)
exported_config_paths = ["relative/path/to/config.yml", "other/config.alternate.yml"]
# ...
```
Declaring an exported configuration allows a configuration file to be
automatically included at runtime as a fallback default if no other
configuration files are present or detected by the workspace (including
`.qlty/configs` directory). The configuration file will be symlinked
just like any other configuration.
### Disabling Export Behavior from a Downstream Consumer
Users who want to opt out of automatic importing of configuration files
can either:
1. Define a default configuration file in their workspace source tree
(or `.qlty/configs`), or,
2. Override the `plugins.definitions.<plugin>.exported_config_paths` as:
```toml
[plugins.definitions.some-plugin]
exported_config_paths = []
```
### Using with Sources
This behavior is can used with custom sources to automatically include
custom configuration from a given layered source:
#### \> .qlty/qlty.toml
```toml
[[source]]
name = "default"
default = true
[[source]]
name = "configs"
directory = "./configuration" # this can also be a repository
```
#### \> configuration/source.toml
```toml
[plugins.definitions.rubocop]
exported_config_paths = ["rubocop/.rubocop.yml"]
```
#### \> configuration/rubocop/.rubocop.yml
```yaml
AllCops:
Enable: true
# ...
```
Any project including the above source will automatically receive custom
rubocop configuration that will automatically be applied when running
`qlty check`.
0 commit comments