lintconfig.star¶
Set rules in markdownlint, yamllint and hadolint configs.
Each helper edits the config file the tool reads by default, keeping comments in YAML files and key order in JSON files.
| Function | What it does |
|---|---|
markdownlint_rule |
Sets a markdownlint rule, such as MD013 (line length). |
yamllint_rule |
Sets a yamllint rule, such as turning off document-start. |
hadolint_ignore |
Adds rules to the ignored list of .hadolint.yaml, creating the file if needed. |
markdownlint_rule¶
Sets a markdownlint rule, such as MD013 (line length).
Edits .markdownlint.json, .markdownlint.jsonc (without comments), .markdownlint.yaml or .markdownlint.yml.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
rule |
The rule ID or alias, such as MD013 or line-length. |
value |
True or False to turn the rule on or off, or a dict of its options. |
Returns: True when the file changed; False when the repo has no config.
Example
Used in: lint-configs
yamllint_rule¶
Sets a yamllint rule, such as turning off document-start.
Edits .yamllint, .yamllint.yaml or .yamllint.yml.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
rule |
The rule, such as line-length. |
value |
disable or enable, or an option of the rule as {"max": 120}, set key by key. |
Returns: True when the file changed; False when the repo has no config.
Example
yamllint_rule(repo, "line-length", {"max": 120})
yamllint_rule(repo, "document-start", "disable")
# returns True
Used in: lint-configs
hadolint_ignore¶
Adds rules to the ignored list of .hadolint.yaml, creating the file if needed.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
rules |
The rule IDs, such as ["DL3008", "DL3013"]. |
Returns: True when the file changed.
Example
Used in: lint-configs