Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assure variable naming rule always use a pattern #1667

Merged
merged 1 commit into from Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion src/ansiblelint/cli.py
Expand Up @@ -327,7 +327,6 @@ def merge_config(file_config: Dict[Any, Any], cli_config: Namespace) -> Namespac
scalar_map = {
"loop_var_prefix": None,
"project_dir": ".",
"var_naming_pattern": "^[a-z_][a-z0-9_]*$",
}

if not file_config:
Expand Down
2 changes: 1 addition & 1 deletion src/ansiblelint/rules/VariableNamingRule.py
Expand Up @@ -44,7 +44,7 @@ class VariableNamingRule(AnsibleLintRule):

@lru_cache()
def re_pattern(self) -> Pattern[str]:
return re.compile(options.var_naming_pattern)
return re.compile(options.var_naming_pattern or "^[a-z_][a-z0-9_]*$")

def is_invalid_variable_name(self, ident: str) -> bool:
"""Check if variable name is using right pattern."""
Expand Down