diff --git a/docs/djlint/changelog.rst b/docs/djlint/changelog.rst index f452abb..22952f3 100644 --- a/docs/djlint/changelog.rst +++ b/docs/djlint/changelog.rst @@ -1,6 +1,14 @@ Changelog ========= +0.5.9 +----- +- Added option ``--use-gitignore`` to extend the excludes +- Changed default exclude matching +- Fixed windows exclude paths +- Fixed formatting of ``{%...%}`` tags in attributes +- Fixed formatting for for loops and nested conditions in attributes + 0.5.8 ----- - Added require_pragma option diff --git a/docs/djlint/configuration.rst b/docs/djlint/configuration.rst index d0e0e35..3260725 100644 --- a/docs/djlint/configuration.rst +++ b/docs/djlint/configuration.rst @@ -149,3 +149,14 @@ Usage: .. code:: ini max_attribute_length=10 + +use_gitignore +------------- + +Add .gitignore excludes to the default exclude. + +Usage: + +.. code:: ini + + use_gitignore = True diff --git a/docs/djlint/usage.rst b/docs/djlint/usage.rst index 9fd0fa8..ed660be 100644 --- a/docs/djlint/usage.rst +++ b/docs/djlint/usage.rst @@ -117,4 +117,5 @@ CLI Args --require-pragma Only format or lint files that starts with a comment with the text 'djlint:on' --lint Lint for common issues. [default option] + --use-gitignore Use .gitignore file to extend excludes. -h, --help Show this message and exit. diff --git a/src/djlint/__init__.py b/src/djlint/__init__.py index 61c97f9..1c53a8f 100644 --- a/src/djlint/__init__.py +++ b/src/djlint/__init__.py @@ -87,7 +87,7 @@ from .src import get_src @click.option( "--use-gitignore", is_flag=True, - help="Use .gitignore file as exclude. [default option]", + help="Use .gitignore file to extend excludes.", ) def main( src: List[str], diff --git a/tests/test_config_gitignore.py b/tests/test_config_gitignore.py index b567b44..df6d4db 100644 --- a/tests/test_config_gitignore.py +++ b/tests/test_config_gitignore.py @@ -13,6 +13,7 @@ for a single test, run:: """ # pylint: disable=C0116 import os +from pathlib import Path from click.testing import CliRunner @@ -23,6 +24,8 @@ def test_cli(runner: CliRunner) -> None: result = runner.invoke(djlint, ["tests/config_gitignore/html_two.html", "--check"]) assert result.exit_code == 1 + # create .git folder to make root + Path("tests/config_gitignore/.git").mkdir(parents=True, exist_ok=True) # add a gitignore file with open("tests/config_gitignore/.gitignore", "w") as git: git.write("html_two.html") @@ -43,6 +46,8 @@ def test_pyproject(runner: CliRunner) -> None: result = runner.invoke(djlint, ["tests/config_gitignore/html_two.html", "--check"]) assert result.exit_code == 1 + # make a root + Path("tests/config_gitignore/.git").mkdir(parents=True, exist_ok=True) # add a gitignore file with open("tests/config_gitignore/.gitignore", "w") as git: git.write("html_two.html")