-
Notifications
You must be signed in to change notification settings - Fork 655
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify VariableHasSpacesRule to check for spaces around filters (#2180)
* Modify VariableHasSpacesRule to check for spaces around | * More * Update version_added to reflect new behavior Co-authored-by: Sorin Sbarnea <ssbarnea@redhat.com>
- Loading branch information
1 parent
30613e0
commit dc0c857
Showing
9 changed files
with
3,061 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## var-spacing | ||
|
||
Variables and filters in Jinja2 should have spaces before and after, like | ||
`{{ var_name | filter }}.`. This improves readability and makes it | ||
less likely to introduce typos. | ||
|
||
### Problematic code | ||
|
||
```yaml | ||
--- | ||
foo: "{{some|dict2items}}" | ||
``` | ||
### Correct code | ||
```yaml | ||
--- | ||
foo: "{{ some | dict2items }}" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
CMD: ansible-lint -f pep8 -x fqcn-builtins | ||
|
||
RC: 0 | ||
RC: 2 | ||
|
||
STDERR: | ||
WARNING Listing 3 violation(s) that are fatal | ||
WARNING Listing 7 violation(s) that are fatal | ||
You can skip specific rules or tags by adding them to your configuration file: | ||
# .config/ansible-lint.yml | ||
warn_list: # or 'skip_list' to silence them completely | ||
- experimental # all rules tagged as experimental | ||
- var-spacing # Jinja2 variables and filters should have spaces before and after | ||
|
||
|
||
|
||
STDOUT: | ||
.github/workflows/galaxy.yml:1: schema: Additional properties are not allowed ('jobs', 'true' were unexpected) (schema[galaxy]) | ||
meta/main.yml:1: schema: 7 is not one of ['6.1', '7.1', '7.2', 'all'] (schema[meta]) | ||
requirements.yml:1: schema: None is not of type 'array' (schema[requirements]) | ||
vars/main.yml:18: var-spacing: Jinja2 variables and filters should have spaces before and after | ||
vars/main.yml:33: var-spacing: Jinja2 variables and filters should have spaces before and after | ||
vars/main.yml:44: var-spacing: Jinja2 variables and filters should have spaces before and after | ||
vars/main.yml:70: var-spacing: Jinja2 variables and filters should have spaces before and after |
Oops, something went wrong.