From 2a85e0dbb1065ae84f19d178c1d485566dd36490 Mon Sep 17 00:00:00 2001 From: Christopher Pickering Date: Tue, 5 Oct 2021 08:34:35 +0200 Subject: [PATCH] fixed #52,50,48 --- docs/djlint/usage.rst | 16 ++++++++-------- src/djlint/__init__.py | 9 +++++---- tests/test_linter.py | 8 ++++++++ 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/docs/djlint/usage.rst b/docs/djlint/usage.rst index 291b7b6..1668f88 100644 --- a/docs/djlint/usage.rst +++ b/docs/djlint/usage.rst @@ -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 diff --git a/src/djlint/__init__.py b/src/djlint/__init__.py index fd595e4..57de9c2 100644 --- a/src/djlint/__init__.py +++ b/src/djlint/__init__.py @@ -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], diff --git a/tests/test_linter.py b/tests/test_linter.py index 3aa2633..4922493 100644 --- a/tests/test_linter.py +++ b/tests/test_linter.py @@ -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'\n
\n', + ) + 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