diff --git a/poetry.lock b/poetry.lock index 46f5e47..c19787f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -41,43 +41,46 @@ tests-no-zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy [[package]] name = "black" -version = "22.8.0" +version = "23.1.0" description = "The uncompromising code formatter." category = "dev" optional = false -python-versions = ">=3.6.2" +python-versions = ">=3.7" files = [ - {file = "black-22.8.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:ce957f1d6b78a8a231b18e0dd2d94a33d2ba738cd88a7fe64f53f659eea49fdd"}, - {file = "black-22.8.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5107ea36b2b61917956d018bd25129baf9ad1125e39324a9b18248d362156a27"}, - {file = "black-22.8.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e8166b7bfe5dcb56d325385bd1d1e0f635f24aae14b3ae437102dedc0c186747"}, - {file = "black-22.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd82842bb272297503cbec1a2600b6bfb338dae017186f8f215c8958f8acf869"}, - {file = "black-22.8.0-cp310-cp310-win_amd64.whl", hash = "sha256:d839150f61d09e7217f52917259831fe2b689f5c8e5e32611736351b89bb2a90"}, - {file = "black-22.8.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:a05da0430bd5ced89176db098567973be52ce175a55677436a271102d7eaa3fe"}, - {file = "black-22.8.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4a098a69a02596e1f2a58a2a1c8d5a05d5a74461af552b371e82f9fa4ada8342"}, - {file = "black-22.8.0-cp36-cp36m-win_amd64.whl", hash = "sha256:5594efbdc35426e35a7defa1ea1a1cb97c7dbd34c0e49af7fb593a36bd45edab"}, - {file = "black-22.8.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a983526af1bea1e4cf6768e649990f28ee4f4137266921c2c3cee8116ae42ec3"}, - {file = "black-22.8.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3b2c25f8dea5e8444bdc6788a2f543e1fb01494e144480bc17f806178378005e"}, - {file = "black-22.8.0-cp37-cp37m-win_amd64.whl", hash = "sha256:78dd85caaab7c3153054756b9fe8c611efa63d9e7aecfa33e533060cb14b6d16"}, - {file = "black-22.8.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:cea1b2542d4e2c02c332e83150e41e3ca80dc0fb8de20df3c5e98e242156222c"}, - {file = "black-22.8.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:5b879eb439094751185d1cfdca43023bc6786bd3c60372462b6f051efa6281a5"}, - {file = "black-22.8.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:0a12e4e1353819af41df998b02c6742643cfef58282915f781d0e4dd7a200411"}, - {file = "black-22.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c3a73f66b6d5ba7288cd5d6dad9b4c9b43f4e8a4b789a94bf5abfb878c663eb3"}, - {file = "black-22.8.0-cp38-cp38-win_amd64.whl", hash = "sha256:e981e20ec152dfb3e77418fb616077937378b322d7b26aa1ff87717fb18b4875"}, - {file = "black-22.8.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:8ce13ffed7e66dda0da3e0b2eb1bdfc83f5812f66e09aca2b0978593ed636b6c"}, - {file = "black-22.8.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:32a4b17f644fc288c6ee2bafdf5e3b045f4eff84693ac069d87b1a347d861497"}, - {file = "black-22.8.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:0ad827325a3a634bae88ae7747db1a395d5ee02cf05d9aa7a9bd77dfb10e940c"}, - {file = "black-22.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:53198e28a1fb865e9fe97f88220da2e44df6da82b18833b588b1883b16bb5d41"}, - {file = "black-22.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:bc4d4123830a2d190e9cc42a2e43570f82ace35c3aeb26a512a2102bce5af7ec"}, - {file = "black-22.8.0-py3-none-any.whl", hash = "sha256:d2c21d439b2baf7aa80d6dd4e3659259be64c6f49dfd0f32091063db0e006db4"}, - {file = "black-22.8.0.tar.gz", hash = "sha256:792f7eb540ba9a17e8656538701d3eb1afcb134e3b45b71f20b25c77a8db7e6e"}, + {file = "black-23.1.0-cp310-cp310-macosx_10_16_arm64.whl", hash = "sha256:b6a92a41ee34b883b359998f0c8e6eb8e99803aa8bf3123bf2b2e6fec505a221"}, + {file = "black-23.1.0-cp310-cp310-macosx_10_16_universal2.whl", hash = "sha256:57c18c5165c1dbe291d5306e53fb3988122890e57bd9b3dcb75f967f13411a26"}, + {file = "black-23.1.0-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:9880d7d419bb7e709b37e28deb5e68a49227713b623c72b2b931028ea65f619b"}, + {file = "black-23.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e6663f91b6feca5d06f2ccd49a10f254f9298cc1f7f49c46e498a0771b507104"}, + {file = "black-23.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:9afd3f493666a0cd8f8df9a0200c6359ac53940cbde049dcb1a7eb6ee2dd7074"}, + {file = "black-23.1.0-cp311-cp311-macosx_10_16_arm64.whl", hash = "sha256:bfffba28dc52a58f04492181392ee380e95262af14ee01d4bc7bb1b1c6ca8d27"}, + {file = "black-23.1.0-cp311-cp311-macosx_10_16_universal2.whl", hash = "sha256:c1c476bc7b7d021321e7d93dc2cbd78ce103b84d5a4cf97ed535fbc0d6660648"}, + {file = "black-23.1.0-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:382998821f58e5c8238d3166c492139573325287820963d2f7de4d518bd76958"}, + {file = "black-23.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2bf649fda611c8550ca9d7592b69f0637218c2369b7744694c5e4902873b2f3a"}, + {file = "black-23.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:121ca7f10b4a01fd99951234abdbd97728e1240be89fde18480ffac16503d481"}, + {file = "black-23.1.0-cp37-cp37m-macosx_10_16_x86_64.whl", hash = "sha256:a8471939da5e824b891b25751955be52ee7f8a30a916d570a5ba8e0f2eb2ecad"}, + {file = "black-23.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8178318cb74f98bc571eef19068f6ab5613b3e59d4f47771582f04e175570ed8"}, + {file = "black-23.1.0-cp37-cp37m-win_amd64.whl", hash = "sha256:a436e7881d33acaf2536c46a454bb964a50eff59b21b51c6ccf5a40601fbef24"}, + {file = "black-23.1.0-cp38-cp38-macosx_10_16_arm64.whl", hash = "sha256:a59db0a2094d2259c554676403fa2fac3473ccf1354c1c63eccf7ae65aac8ab6"}, + {file = "black-23.1.0-cp38-cp38-macosx_10_16_universal2.whl", hash = "sha256:0052dba51dec07ed029ed61b18183942043e00008ec65d5028814afaab9a22fd"}, + {file = "black-23.1.0-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:49f7b39e30f326a34b5c9a4213213a6b221d7ae9d58ec70df1c4a307cf2a1580"}, + {file = "black-23.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:162e37d49e93bd6eb6f1afc3e17a3d23a823042530c37c3c42eeeaf026f38468"}, + {file = "black-23.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:8b70eb40a78dfac24842458476135f9b99ab952dd3f2dab738c1881a9b38b753"}, + {file = "black-23.1.0-cp39-cp39-macosx_10_16_arm64.whl", hash = "sha256:a29650759a6a0944e7cca036674655c2f0f63806ddecc45ed40b7b8aa314b651"}, + {file = "black-23.1.0-cp39-cp39-macosx_10_16_universal2.whl", hash = "sha256:bb460c8561c8c1bec7824ecbc3ce085eb50005883a6203dcfb0122e95797ee06"}, + {file = "black-23.1.0-cp39-cp39-macosx_10_16_x86_64.whl", hash = "sha256:c91dfc2c2a4e50df0026f88d2215e166616e0c80e86004d0003ece0488db2739"}, + {file = "black-23.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2a951cc83ab535d248c89f300eccbd625e80ab880fbcfb5ac8afb5f01a258ac9"}, + {file = "black-23.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:0680d4380db3719ebcfb2613f34e86c8e6d15ffeabcf8ec59355c5e7b85bb555"}, + {file = "black-23.1.0-py3-none-any.whl", hash = "sha256:7a0f701d314cfa0896b9001df70a530eb2472babb76086344e688829efd97d32"}, + {file = "black-23.1.0.tar.gz", hash = "sha256:b0bd97bea8903f5a2ba7219257a44e3f1f9d00073d6cc1add68f0beec69692ac"}, ] [package.dependencies] click = ">=8.0.0" mypy-extensions = ">=0.4.3" +packaging = ">=22.0" pathspec = ">=0.9.0" platformdirs = ">=2" -tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""} +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} typed-ast = {version = ">=1.4.2", markers = "python_version < \"3.8\" and implementation_name == \"cpython\""} typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""} @@ -1153,4 +1156,4 @@ testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>= [metadata] lock-version = "2.0" python-versions = "^3.7.2,<4.0" -content-hash = "9ed3209dfba950743748364377ff8687d3e69888022ea4ddb2a787be8cf61fab" +content-hash = "25d034089832bfa03d7d909befdf90ce95720c9c5d75c9293cd52df2d345c3fd" diff --git a/pyproject.toml b/pyproject.toml index e47b5f8..78c24a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ jsbeautifier = "^1.14.4" cssbeautifier = "^1.14.4" [tool.poetry.dev-dependencies] -black = "^22.1.0" +black = "^23.0.0" isort = "^5.9.3" coverage = "^7.0.0" pytest = "^7.1.2" diff --git a/src/djlint/__init__.py b/src/djlint/__init__.py index 3c10356..81e7afe 100644 --- a/src/djlint/__init__.py +++ b/src/djlint/__init__.py @@ -248,9 +248,7 @@ def main( ascii=progress_char, leave=False, ) as pbar: - for future in as_completed(futures): - file_errors.append(future.result()) pbar.update() elapsed = pbar.format_interval(pbar.format_dict["elapsed"]) diff --git a/src/djlint/formatter/attributes.py b/src/djlint/formatter/attributes.py index 00b0e77..6638b65 100644 --- a/src/djlint/formatter/attributes.py +++ b/src/djlint/formatter/attributes.py @@ -32,7 +32,6 @@ def format_template_tags(config: Config, attributes: str, spacing: int) -> str: indent_adder = spacing or 0 for line_number, line in enumerate(attributes.splitlines()): - # when checking for template tag, use "match" to force start of line check. if re.match( re.compile(config.template_unindent, re.I | re.X), line.strip() diff --git a/src/djlint/formatter/condense.py b/src/djlint/formatter/condense.py index afe9f77..6d1a049 100644 --- a/src/djlint/formatter/condense.py +++ b/src/djlint/formatter/condense.py @@ -136,7 +136,6 @@ def condense_html(html: str, config: Config) -> str: # should we add blank lines before load tags? if config.blank_line_before_tag: for tag in [x.strip() for x in config.blank_line_before_tag.split(",")]: - html = re.sub( re.compile( rf"(? str: # add indent back ignore_indent = False for line in beautified_lines: - if re.search( re.compile( r"\/\*[ ]*?beautify[ ]+?ignore:end[ ]*?\*\/", @@ -38,7 +37,6 @@ def format_css(html: str, config: Config) -> str: ignore_indent = False if ignore_indent is False and line: - beautified += "\n" + inner_indent + line else: beautified += "\n" + line diff --git a/src/djlint/formatter/indent.py b/src/djlint/formatter/indent.py index db2ae88..a980ed6 100644 --- a/src/djlint/formatter/indent.py +++ b/src/djlint/formatter/indent.py @@ -37,7 +37,6 @@ def indent_html(rawcode: str, config: Config) -> str: ignored_level = 0 for item in rawcode_flat_list: - # if a raw tag first line if not is_block_raw and is_ignored_block_opening(config, item): is_raw_first_line = True @@ -225,7 +224,6 @@ def indent_html(rawcode: str, config: Config) -> str: def fix_non_handlebars_template_tags( html: str, out_format: str, match: re.Match ) -> str: - if inside_ignored_block(config, html, match): return match.group() @@ -255,7 +253,6 @@ def indent_html(rawcode: str, config: Config) -> str: def fix_handlebars_template_tags( html: str, out_format: str, match: re.Match ) -> str: - if inside_ignored_block(config, html, match): return match.group() diff --git a/src/djlint/formatter/js.py b/src/djlint/formatter/js.py index b846686..d33e1c5 100644 --- a/src/djlint/formatter/js.py +++ b/src/djlint/formatter/js.py @@ -27,7 +27,6 @@ def format_js(html: str, config: Config) -> str: # add indent back ignore_indent = False for line in beautified_lines: - if re.search( re.compile( r"\/\*[ ]*?beautify[ ]+?(?:preserve|ignore):end[ ]*?\*\/", diff --git a/src/djlint/lint.py b/src/djlint/lint.py index e8f8bcf..cbf655e 100644 --- a/src/djlint/lint.py +++ b/src/djlint/lint.py @@ -71,7 +71,6 @@ def lint_file(config: Config, this_file: Path) -> Dict: # rule H025 is a special case where the output must be an even number. if rule["name"] == "H025": - open_tags: List[re.Match] = [] # for match in re.finditer( diff --git a/src/djlint/output.py b/src/djlint/output.py index 0edebc6..8a8bd44 100644 --- a/src/djlint/output.py +++ b/src/djlint/output.py @@ -114,7 +114,6 @@ def build_output(error: dict, config: Config) -> int: ) for message_dict in errors: - line = Fore.BLUE + message_dict["line"] + Style.RESET_ALL code = ( (Fore.RED if message_dict["code"][:1] == "E" else Fore.YELLOW) @@ -205,14 +204,12 @@ def build_stats_output(errors: List[Optional[Any]], config: Config) -> int: ) if messages and codes: - longest_code = len(max(messages.keys(), key=len)) longest_count = len( str(max(Counter(codes).values(), key=lambda x: len(str(x)))) ) for code in sorted(Counter(codes).items()): - code_space = (longest_code - len(str(code[0]))) * " " count_space = (longest_count - len(str(code[1]))) * " " diff --git a/src/djlint/settings.py b/src/djlint/settings.py index 49ff0dd..a8d2656 100644 --- a/src/djlint/settings.py +++ b/src/djlint/settings.py @@ -29,7 +29,6 @@ logger = logging.getLogger(__name__) def find_project_root(src: Path) -> Path: """Attempt to get the project root.""" for directory in [src, *src.resolve().parents]: - if (directory / ".git").exists(): return directory @@ -214,7 +213,6 @@ class Config: configuration: Optional[str] = None, statistics: bool = False, ): - self.reformat = reformat self.check = check self.lint = lint diff --git a/tests/test_config/test_format_attribute_template_tags/test_config.py b/tests/test_config/test_format_attribute_template_tags/test_config.py index a0417bc..07f1a95 100644 --- a/tests/test_config/test_format_attribute_template_tags/test_config.py +++ b/tests/test_config/test_format_attribute_template_tags/test_config.py @@ -31,7 +31,6 @@ def test_with_config(runner: CliRunner) -> None: def test_without_config(runner: CliRunner, tmp_file: TextIO) -> None: - output = reformat( tmp_file, runner, diff --git a/tests/test_config/test_preserve_blank_lines/test_config.py b/tests/test_config/test_preserve_blank_lines/test_config.py index 4906ade..6617ef6 100644 --- a/tests/test_config/test_preserve_blank_lines/test_config.py +++ b/tests/test_config/test_preserve_blank_lines/test_config.py @@ -15,7 +15,6 @@ from src.djlint import main as djlint def test_config(runner: CliRunner) -> None: - result = runner.invoke( djlint, [ diff --git a/tests/test_config/test_preserve_leading_space/test_config.py b/tests/test_config/test_preserve_leading_space/test_config.py index 830c042..4ef321a 100644 --- a/tests/test_config/test_preserve_leading_space/test_config.py +++ b/tests/test_config/test_preserve_leading_space/test_config.py @@ -15,7 +15,6 @@ from src.djlint import main as djlint def test_config(runner: CliRunner) -> None: - result = runner.invoke( djlint, [ diff --git a/tests/test_html/test_aurelia.py b/tests/test_html/test_aurelia.py index 404362f..87511c3 100644 --- a/tests/test_html/test_aurelia.py +++ b/tests/test_html/test_aurelia.py @@ -27,7 +27,6 @@ from tests.conftest import reformat def test_aurelia(runner: CliRunner, tmp_file: TextIO) -> None: - output = reformat( tmp_file, runner, diff --git a/tests/test_html/test_basics.py b/tests/test_html/test_basics.py index 33db33b..328dc20 100644 --- a/tests/test_html/test_basics.py +++ b/tests/test_html/test_basics.py @@ -104,7 +104,6 @@ def test_comment(runner: CliRunner, tmp_file: TextIO) -> None: def test_empty(runner: CliRunner, tmp_file: TextIO) -> None: - output = reformat( tmp_file, runner, @@ -314,7 +313,6 @@ def test_empty(runner: CliRunner, tmp_file: TextIO) -> None: def test_hello_world(runner: CliRunner, tmp_file: TextIO) -> None: - output = reformat( tmp_file, runner, @@ -338,7 +336,6 @@ def test_hello_world(runner: CliRunner, tmp_file: TextIO) -> None: def test_html_comments(runner: CliRunner, tmp_file: TextIO) -> None: - output = reformat( tmp_file, runner, @@ -483,7 +480,6 @@ def test_html_comments(runner: CliRunner, tmp_file: TextIO) -> None: def test_issue_9368_3(runner: CliRunner, tmp_file: TextIO) -> None: - output = reformat( tmp_file, runner, @@ -495,7 +491,6 @@ def test_issue_9368_3(runner: CliRunner, tmp_file: TextIO) -> None: def test_issue_9368(runner: CliRunner, tmp_file: TextIO) -> None: - output = reformat( tmp_file, runner, @@ -533,7 +528,6 @@ def test_issue_9368(runner: CliRunner, tmp_file: TextIO) -> None: def test_void_elements(runner: CliRunner, tmp_file: TextIO) -> None: - output = reformat( tmp_file, runner, diff --git a/tests/test_html/test_comments.py b/tests/test_html/test_comments.py index 8a48f56..1dc1976 100644 --- a/tests/test_html/test_comments.py +++ b/tests/test_html/test_comments.py @@ -49,7 +49,6 @@ comment--> def test_before_text(runner: CliRunner, tmp_file: TextIO) -> None: - html_in = ( b""" @@ -67,7 +66,6 @@ def test_before_text(runner: CliRunner, tmp_file: TextIO) -> None: def test_bogus(runner: CliRunner, tmp_file: TextIO) -> None: - html_in = ( b""" @@ -268,7 +266,6 @@ def test_bogus(runner: CliRunner, tmp_file: TextIO) -> None: def test_hidden(runner: CliRunner, tmp_file: TextIO) -> None: - html_in = ( b""" diff --git a/tests/test_html/test_symbol_entities.py b/tests/test_html/test_symbol_entities.py index 9593a1b..7b343f6 100644 --- a/tests/test_html/test_symbol_entities.py +++ b/tests/test_html/test_symbol_entities.py @@ -27,7 +27,6 @@ from tests.conftest import reformat def test_symbol_entities(runner: CliRunner, tmp_file: TextIO) -> None: - output = reformat( tmp_file, runner, diff --git a/tests/test_html/test_yaml.py b/tests/test_html/test_yaml.py index 005e748..2d4037f 100644 --- a/tests/test_html/test_yaml.py +++ b/tests/test_html/test_yaml.py @@ -89,7 +89,6 @@ layout:
def test_custom_parser(runner: CliRunner, tmp_file: TextIO) -> None: - html_in = ( b""" ---mycustomparser @@ -114,7 +113,6 @@ slug: home def test_empty(runner: CliRunner, tmp_file: TextIO) -> None: - html_in = ( b""" --- @@ -134,7 +132,6 @@ def test_empty(runner: CliRunner, tmp_file: TextIO) -> None: def test_empty_2(runner: CliRunner, tmp_file: TextIO) -> None: - html_in = ( b""" --- @@ -155,7 +152,6 @@ def test_empty_2(runner: CliRunner, tmp_file: TextIO) -> None: def test_issue_9042_no_empty_line(runner: CliRunner, tmp_file: TextIO) -> None: - html_in = ( b""" --- @@ -177,7 +173,6 @@ Test abc. def test_issue_9042(runner: CliRunner, tmp_file: TextIO) -> None: - html_in = ( b""" ---