forked from ansible/ansible-lint
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update var_naming for set_fact module (ansible#2496)
* Update var_naming for set_fact module Signed-off-by: nishipy <[email protected]> * Add test for var_naming with pattern Signed-off-by: nishipy <[email protected]> * More fixes Signed-off-by: nishipy <[email protected]> Co-authored-by: Sorin Sbarnea <[email protected]>
- Loading branch information
Showing
5 changed files
with
87 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
- name: Fixture | ||
hosts: localhost | ||
vars: | ||
CamelCaseIsBad: false # invalid | ||
this_is_valid: # valid because content is a dict, not a variable | ||
CamelCase: ... | ||
ALL_CAPS: ... | ||
ALL_CAPS_ARE_BAD_TOO: ... # invalid | ||
CamelCaseButErrorIgnored: true # noqa: var-naming | ||
|
||
tasks: | ||
- name: Foo | ||
ansible.builtin.set_fact: | ||
"{{ 'test_' }}var": "value" # valid | ||
- name: Bar | ||
ansible.builtin.set_fact: | ||
CamelCaseButErrorIgnored: true # noqa: var-naming | ||
- name: Test in a block | ||
vars: | ||
BAD: false # invalid | ||
MoreBad: ... # invalid | ||
block: | ||
- name: Foo | ||
vars: | ||
ALL_CAPS_ARE_BAD_TOO: "{{ MoreBad }}" # invalid | ||
ansible.builtin.set_fact: | ||
CamelCaseIsBad: "{{ BAD }}" # invalid |
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,2 @@ | ||
--- | ||
var_naming_pattern: "^[a-z][a-z0-9_]*[a-z0-9]__[a-z][a-z0-9_]*[a-z0-9]$" |
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,4 @@ | ||
--- | ||
- name: Foobar | ||
ansible.builtin.set_fact: | ||
k8s_grafana_users__namespace: "foo" |
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