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

auto-correct option #10

Open
ryanmerolle opened this issue Jan 4, 2022 · 1 comment
Open

auto-correct option #10

ryanmerolle opened this issue Jan 4, 2022 · 1 comment

Comments

@ryanmerolle
Copy link

Several linters offer auto-correct options. It would make sense to offer this function given a lot of the style lint is related to easily fixable, but tedious fixes.

@ryanmerolle
Copy link
Author

Auto-correction could be applied as such:

Rule Code Rule Auto-Correction
S0 Jinja syntax should be correct N/A - Hard to do given you may not know where to end a conditional or for loop
S1 A single space shall be added between Jinja2 curly brackets and a variable’s name: {{ ethernet_interface }} replace with single space
S2 When variables are used in combination with an operator, the operator shall be enclosed by space replace with single space
S3 All J2 statements must be indented by 4 more spaces within jinja delimiter. To close a control, end tag must have same indentation level. correct indentiation
S4 Jinja statement should have a single space before and after: {% statement %} replace with single space
S5 Indentation are 4 spaces and NOT tabulation correct indentiation
S6 Jinja statements should not have {%- or {%+ or -%} as delimeters remove + and -
S7 Jinja statements should be on separate lines N/A - hard to do without breaking template output
V1 All variables shall use lower case: {{ variable }} N/A - hard to do since associated yaml, json, python, etc may may declare the variable outside of the jinja.
V2 If variable is multi-words, underscore _ shall be used as a separator: {{ my_variable_name }} N/A - hard to do since associated yaml, json, python, etc may may declare the variable outside of the jinja.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant