fixed #52,50,48

This commit is contained in:
Christopher Pickering 2021-10-05 08:34:35 +02:00
parent bbb0ed6f92
commit 2a85e0dbb1
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
3 changed files with 21 additions and 12 deletions

View file

@ -62,18 +62,18 @@ CLI Args
.. code:: sh
Usage: djlint [OPTIONS] SRC ...
Usage: python -m djlint [OPTIONS] SRC ...
Djlint django template files.
djLint · lint and reformat HTML templates.
Options:
-e, --extension TEXT File extension to lint [default: html]
-i, --ignore "Codes" Rules to be ignored. ex: "H014,H017"
--indent Indent spacing. ex: 3
--version Show the version and exit.
-e, --extension TEXT File extension to check [default: html]
-i, --ignore TEXT Codes to ignore. ex: "H014,H017"
--reformat Reformat the file(s).
--check Check formatting on the file(s).
--indent INTEGER Indent spacing. [default: 4]
--quiet Do not print diff when reformatting.
--profile Enable defaults by template language.
ops: django, jinja, nunjucks, handlebars
--profile TEXT Enable defaults by template language. ops: django,
jinja, nunjucks, handlebars, golang
-h, --help Show this message and exit.
--version Get djLint version

View file

@ -163,8 +163,8 @@ def build_quantity_tense(size: int) -> str:
"--extension",
type=str,
default="",
help="File extension to lint",
show_default=True,
help="File extension to check [default: html]",
show_default=False,
)
@click.option(
"-i",
@ -187,7 +187,8 @@ def build_quantity_tense(size: int) -> str:
@click.option(
"--indent",
type=int,
help="Indent spacing. ex: 3",
help="Indent spacing. [default: 4]",
show_default=False,
)
@click.option(
"--quiet",
@ -197,7 +198,7 @@ def build_quantity_tense(size: int) -> str:
@click.option(
"--profile",
type=str,
help="Enable defaults by template language. ops: django, jinja, nunjucks, handlebars",
help="Enable defaults by template language. ops: django, jinja, nunjucks, handlebars, golang",
)
def main(
src: List[str],

View file

@ -245,6 +245,14 @@ def test_DJ018(runner: CliRunner, tmp_file: TextIO) -> None:
assert "D018 2:" not in result.output
assert "J018 2:" not in result.output
# test hash urls
write_to_file(
tmp_file.name,
b'<a href="#">\n<form action="#"><a href="#tab">\n<form action="#go">',
)
result = runner.invoke(djlint, [tmp_file.name])
assert result.exit_code == 0
def test_rules_not_matched_in_ignored_block(
runner: CliRunner, tmp_file: TextIO