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

Doc: j2lint CLI fails when passing FILE(s) after -i flag #40

Closed
gmuloc opened this issue Jun 13, 2022 · 3 comments
Closed

Doc: j2lint CLI fails when passing FILE(s) after -i flag #40

gmuloc opened this issue Jun 13, 2022 · 3 comments

Comments

@gmuloc
Copy link
Collaborator

gmuloc commented Jun 13, 2022

user% j2lint -i 'single-space-decorator'  blah.j2
usage: j2lint [-h] [-i [{jinja-syntax-error,single-space-decorator,operator-enclosed-by-spaces,jinja-statements-single-space,jinja-statements-indentation,jinja-statements-no-tabs,single-statement-per-line,jinja-statements-delimiter,jinja-variable-lower-case,jinja-variable-format,S0,S1,S2,S3,S4,S5,S6,S7,V1,V2} ...]]
              [-w [{jinja-syntax-error,single-space-decorator,operator-enclosed-by-spaces,jinja-statements-single-space,jinja-statements-indentation,jinja-statements-no-tabs,single-statement-per-line,jinja-statements-delimiter,jinja-variable-lower-case,jinja-variable-format,S0,S1,S2,S3,S4,S5,S6,S7,V1,V2} ...]] [-l] [-r RULES_DIR] [-v] [-d] [-j] [-s] [--log]
              [-ver] [-stdout]
              [FILE ...]
j2lint: error: argument -i/--ignore: invalid choice: 'blah.j2' (choose from 'jinja-syntax-error', 'single-space-decorator', 'operator-enclosed-by-spaces', 'jinja-statements-single-space', 'jinja-statements-indentation', 'jinja-statements-no-tabs', 'single-statement-per-line', 'jinja-statements-delimiter', 'jinja-variable-lower-case', 'jinja-variable-format', 'S0', 'S1', 'S2', 'S3', 'S4', 'S5', 'S6', 'S7', 'V1', 'V2')

vs

user% j2lint blah.j2 -i 'single-space-decorator'

JINJA2 LINT ERRORS
************ File blah.j2
blah.j2:1 Jinja statement should have a single space before and after: '{% statement %}' (jinja-statements-single-space)
Jinja2 linting finished with 1 issue(s) and 0 warning(s)

This is because -i is an nargs

Note that this would work:

 j2lint -i 'single-space-decorator'  -- blah.j2  

probably worth at minimu mentioning it in the README.md

@gmuloc
Copy link
Collaborator Author

gmuloc commented Jan 11, 2023

also -w

@gmuloc
Copy link
Collaborator Author

gmuloc commented Jan 26, 2023

So this is actually expected because of the way we use nargs=* in argparse. this should be documented and maybe one day the behavior changed.

@gmuloc gmuloc changed the title Bug: j2lint CLI fails when passing FILE(s) after -i flag Doc: j2lint CLI fails when passing FILE(s) after -i flag Jan 26, 2023
@gmuloc
Copy link
Collaborator Author

gmuloc commented Sep 5, 2023

Closing as it has been documented in readme

@gmuloc gmuloc closed this as completed Sep 5, 2023
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