-
Notifications
You must be signed in to change notification settings - Fork 27
Restyler Info Schema
Every Restyler is described by a file at {name}/info.yaml in this repository. This page
documents that file.
name: foo
version_cmd: |
foo --versionenabled: false
auto_enable:
config_patterns:
- ".foo.yaml"
- ".foo/*.yaml"
group:
name: "Foos"
priority: 10
name: foo
version_cmd: |
foo --version
command:
- foo
arguments: []
include: []
interpreters: []
supports_arg_sep: true
supports_multiple_path: true
run_as_filter: false
documentation: []
metadata:
languages: []
tests:
- name: Description of this test case
support:
path: x.conf
contents: |
Content for x.conf
extension: .foo
contents: |
Content before fixing
restyled: |
Content after fixing| Key | Type | Default value | Details |
|---|---|---|---|
enabled |
bool |
false |
Run in the default configuration? Deprecated, prefer auto_enable
|
auto_enable |
AutoEnable | See below | |
auto_enable.config_patterns |
[Glob] |
||
auto_enable.group |
AutoEnableGroup | ||
auto_enable.group.name |
string |
required | |
auto_enable.group.priority |
number |
required | |
name |
string |
required | Unique name for this Restyler |
version_cmd* |
string |
A command to run to get the Restyler's version | |
version |
string |
An explicit version to use (overrides version_cmd) |
|
command |
[string] |
[$name] |
Auto-formatting command, and any "all the time" argument (e.g. --inplace) |
arguments |
[string] |
[] |
Additional arguments to include by default, but not required to function |
include |
[pattern] |
[] |
Include Patterns to match files this Restyler should operate on |
interpreters |
[interpreter] |
[] |
Interpreters to match extension-less files this Restyler should operate on |
supports_arg_sep |
bool |
true |
Does this Restyler support -- to separate paths from options? |
supports_multiple_path |
bool |
true |
Does this Restyler accept multiple paths at once? |
run_as_filter |
bool |
false |
Capture the tool's stdout and rewrite the file ourselves? |
documentation |
[string] |
[] |
URLs to documentation that is useful during configuration or trouble-shooting |
metadata |
Metadata |
||
metadata.languages |
[string] |
[] |
Free-form names of languages this Restyler supports |
metadata.tests |
[Test] |
[] |
|
metadata.tests[].name |
string |
Test #{n} |
Descriptive name for the test |
metadata.tests[].support** |
Support |
none | Support file (e.g. .rubocop.yaml) needed for the test |
metadata.tests[].support.path |
string |
required | Name of the file |
metadata.tests[].support.contents |
string |
required | Contents of the file |
metadata.tests[].extension |
string |
.temp |
Extension to use for restyled file |
metadata.tests[].contents |
string |
required | Content to be restyled as the test |
metadata.tests[].restyled |
string |
required | Expected content after restyling |
The auto_enable key is used to control when the Restyler is automatically enabled for a project.
Note
When an auto_enable key is present, the enabled key should be removed.
Declaring the key as an object with no properties means to unconditionally enable:
auto_enable: {}This has the same effect as enabled: true.
Providing the config_patterns key means to enable if a path exists matching any of the patterns:
auto_enable:
config_patterns: [...]Providing the group key declares the Restyler as part of a named group:
auto_enable:
group:
name: "..."
priority: Restyled will enable only the highest group.priority for each group.name.
Note
Grouping and priority are only used if:
- No auto-enabling by
config_patternsoccurred - The user has not explicitly enabled any group member(s)
*: One of version_cmd (preferred) or version is required
**: A tests[].support file will be present for all test cases if any test case defines it