mirror of
https://github.com/thegeeklab/ansible-later.git
synced 2024-11-25 06:10:42 +00:00
feat: add config option to exclude tasks from named task check (#232)
This commit is contained in:
parent
123f8fbcb5
commit
dde7eae3b8
@ -11,10 +11,7 @@ class CheckNamedTask(StandardBase):
|
||||
|
||||
def check(self, candidate, settings):
|
||||
tasks, errors = self.get_normalized_tasks(candidate, settings)
|
||||
nameless_tasks = [
|
||||
"meta", "debug", "include_role", "import_role", "include_tasks", "import_tasks",
|
||||
"include_vars", "block"
|
||||
]
|
||||
nameless_tasks = settings["ansible"]["named-task"]["exclude"]
|
||||
|
||||
if not errors:
|
||||
for task in tasks:
|
||||
|
@ -136,6 +136,18 @@ class Settings(object):
|
||||
"max-spaces-inside": 1,
|
||||
},
|
||||
"literal-bools": ["True", "False", "yes", "no"],
|
||||
"named-task": {
|
||||
"exclude": [
|
||||
"meta",
|
||||
"debug",
|
||||
"block",
|
||||
"include_role",
|
||||
"import_role",
|
||||
"include_tasks",
|
||||
"import_tasks",
|
||||
"include_vars",
|
||||
],
|
||||
},
|
||||
},
|
||||
"yamllint": {
|
||||
"empty-lines": {
|
||||
|
@ -28,6 +28,19 @@ ansible:
|
||||
- "yes"
|
||||
- "no"
|
||||
|
||||
# List of tasks that don't need to be named (ANSIBLE0006).
|
||||
# You have to specify every single task type, globs or wildcard will not work!
|
||||
named-task
|
||||
exclude:
|
||||
- "meta"
|
||||
- "debug"
|
||||
- "block"
|
||||
- "include_role"
|
||||
- "include_tasks"
|
||||
- "include_vars"
|
||||
- "import_role"
|
||||
- "import_tasks"
|
||||
|
||||
# Global logging configuration
|
||||
# If you would like to force colored output (e.g. non-tty)
|
||||
# set environment variable `PY_COLORS=1`
|
||||
|
@ -2,10 +2,10 @@
|
||||
title: Included rules
|
||||
---
|
||||
|
||||
Reviews are nothing without some rules or standards against which to review. ansible-later comes with a couple of built-in checks explained in the following table.
|
||||
Reviews are useless without some rules or standards to check against. ansible-later comes with a set of built-in checks, which are explained in the following table.
|
||||
|
||||
| Rule | ID | Description | Parameter |
|
||||
| ----------------------------- | ----------- | ----------------------------------------------------------------- | -------------------------------------------------------------------- |
|
||||
| ----------------------------- | ----------- | ----------------------------------------------------------------- | ---------------------------------------------------------------------- |
|
||||
| CheckYamlEmptyLines | LINT0001 | YAML should not contain unnecessarily empty lines. | {max: 1, max-start: 0, max-end: 1} |
|
||||
| CheckYamlIndent | LINT0002 | YAML should be correctly indented. | {spaces: 2, check-multi-line-strings: false, indent-sequences: true} |
|
||||
| CheckYamlHyphens | LINT0003 | YAML should use consistent number of spaces after hyphens (-). | {max-spaces-after: 1} |
|
||||
@ -20,7 +20,7 @@ Reviews are nothing without some rules or standards against which to review. ans
|
||||
| CheckUniqueNamedTask | ANSIBLE0003 | Tasks and handlers must be uniquely named within a file. | |
|
||||
| CheckBraces | ANSIBLE0004 | YAML should use consistent number of spaces around variables. | {double-braces: max-spaces-inside: 1, min-spaces-inside: 1} |
|
||||
| CheckScmInSrc | ANSIBLE0005 | Use SCM key rather than `src: scm+url` in requirements file. | |
|
||||
| CheckNamedTask | ANSIBLE0006 | Tasks and handlers must be named. | excludes: meta, debug, include\_\*, import\_\*, block |
|
||||
| CheckNamedTask | ANSIBLE0006 | Tasks and handlers must be named. | {named-task: {exclude: [meta, debug, block, include\_\*, import\_\*]}} |
|
||||
| CheckNameFormat | ANSIBLE0007 | Name of tasks and handlers must be formatted. | formats: first letter capital |
|
||||
| CheckCommandInsteadofModule | ANSIBLE0008 | Commands should not be used in place of modules. | |
|
||||
| CheckInstallUseLatest | ANSIBLE0009 | Package managers should not install with state=latest. | |
|
||||
|
Loading…
Reference in New Issue
Block a user