From fbcb836bd8044896ecbeb4389bb61bae8210a2bd Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Thu, 17 Mar 2022 13:30:58 -0700 Subject: [PATCH 1/3] Fix spelling mistakes found by codespell Signed-off-by: Anders Kaseorg --- .github/workflows/cancel.yml | 2 +- docs/src/_includes/index.njk | 2 +- docs/src/docs/linter.md | 4 ++-- docs/src/fr/docs/linter.md | 2 +- docs/src/ru/docs/linter.md | 4 ++-- src/djlint/formatter/attributes.py | 2 +- src/djlint/formatter/condense.py | 2 +- src/djlint/rules.yaml | 6 +++--- src/djlint/settings.py | 2 +- tests/test_linter.py | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml index 44fdb47..584b244 100644 --- a/.github/workflows/cancel.yml +++ b/.github/workflows/cancel.yml @@ -1,5 +1,5 @@ # This action finds in-progress Action jobs for the same branch, and cancels -# them. There's little point in continuing to run superceded jobs. +# them. There's little point in continuing to run superseded jobs. name: cancel diff --git a/docs/src/_includes/index.njk b/docs/src/_includes/index.njk index 4b53dfa..61ad4ef 100644 --- a/docs/src/_includes/index.njk +++ b/docs/src/_includes/index.njk @@ -129,7 +129,7 @@ date: Last Modified
diff --git a/docs/src/docs/linter.md b/docs/src/docs/linter.md index 38d75b0..3c16d2f 100644 --- a/docs/src/docs/linter.md +++ b/docs/src/docs/linter.md @@ -68,13 +68,13 @@ A good rule follows this pattern: | H023 | Do not use entity references. | | H024 | Omit type on scripts and styles. | | H025 | Tag seems to be an orphan. | -| H026 | Emtpy id and class tags can be removed. | +| H026 | Empty id and class tags can be removed. | | T027 | Unclosed string found in template syntax. | | T028 | Consider using spaceless tags inside attribute values. {% raw %}`{%- if/for -%}`{% endraw %} | | H029 | Consider using lowercase form method values. | | H030 | Consider adding a meta description. | | H031 | Consider adding meta keywords. | -| T032 | Extra whitepsace found in template tags. | +| T032 | Extra whitespace found in template tags. | | H033 | Extra whitespace found in form action. | ### Adding Rules diff --git a/docs/src/fr/docs/linter.md b/docs/src/fr/docs/linter.md index f89f53f..636ab6c 100644 --- a/docs/src/fr/docs/linter.md +++ b/docs/src/fr/docs/linter.md @@ -70,7 +70,7 @@ Une bonne règle suit ce modèle : | H023 | N'utilisez pas de références d'entités. | | H024 | Omettre le type sur les scripts et les styles. | | H025 | La balise semble être orpheline. | -| H026 | Les balises Emtpy id et class peuvent être supprimées. | +| H026 | Les balises Empty id et class peuvent être supprimées. | | T027 | Chaîne non fermée trouvée dans la syntaxe du modèle. | | T028 | Envisagez d'utiliser des balises sans espace à l'intérieur des valeurs d'attributs. {% raw %}`{%- if/for -%}`{% endraw %} | | H029 | Pensez à utiliser des valeurs de méthode de formulaire en minuscules. | diff --git a/docs/src/ru/docs/linter.md b/docs/src/ru/docs/linter.md index 3bc6297..a949094 100644 --- a/docs/src/ru/docs/linter.md +++ b/docs/src/ru/docs/linter.md @@ -68,13 +68,13 @@ djlint /path/to/this.html.j2 --profile=jinja | H023 | Не используйте ссылки на сущности. | | H024 | Опускайте тип в скриптах и стилях. | | H025 | Тег кажется бесхозным. | -| H026 | Теги Emtpy id и class могут быть удалены. | +| H026 | Теги Empty id и class могут быть удалены. | | T027 | В синтаксисе шаблона найдена незакрытая строка. | | T028 | Рассмотрите возможность использования тегов без пробелов внутри значений атрибутов. {% raw %}`{%- if/for -%}`{% endraw %} | | H029 | Рассмотрите возможность использования строчных значений метода формы. | | H030 | Рассмотрите возможность добавления мета-описания. | | H031 | Рассмотрите возможность добавления мета-ключевых слов. | -| T032 | В тегах шаблона найдены лишние whitepsace. | +| T032 | В тегах шаблона найдены лишние whitespace. | | H033 | В действии формы обнаружен лишний пробел. | diff --git a/src/djlint/formatter/attributes.py b/src/djlint/formatter/attributes.py index 082d79b..eb962b2 100644 --- a/src/djlint/formatter/attributes.py +++ b/src/djlint/formatter/attributes.py @@ -244,7 +244,7 @@ def format_style(match: re.match) -> str: def format_attributes(config: Config, html: str, match: re.match) -> str: """Spread long attributes over multiple lines.""" - # check that we are not inside an ingnored block + # check that we are not inside an ignored block if ( inside_ignored_block(config, html, match) or len(match.group(3).strip()) < config.max_attribute_length diff --git a/src/djlint/formatter/condense.py b/src/djlint/formatter/condense.py index 27284f3..96be9ff 100644 --- a/src/djlint/formatter/condense.py +++ b/src/djlint/formatter/condense.py @@ -17,7 +17,7 @@ def condense_html(html: str, config: Config) -> str: # put empty tags on one line def strip_space(config: Config, html: str, match: re.Match) -> str: - """Trim leading whitepsace.""" + """Trim leading whitespace.""" if inside_ignored_block(config, html, match): return match.group() diff --git a/src/djlint/rules.yaml b/src/djlint/rules.yaml index d10dc88..cbd6f56 100644 --- a/src/djlint/rules.yaml +++ b/src/djlint/rules.yaml @@ -187,7 +187,7 @@ - <((/?(\w+))\b(\"[^\"]*\"|'[^']*'|{{[^}]*}}|{%[^%]*%}|[^'\">{}])*)(? - rule: name: H026 - message: Emtpy id and class tags can be removed. + message: Empty id and class tags can be removed. flags: re.I patterns: - <\w+\b[^(?:{(?:%|{|#))>]*?\b(class|id)\b=(\"\"|'') @@ -230,13 +230,13 @@ - ]*?>(?:(?!]*?name=([\"|'])keywords\b).)* - rule: name: T032 - message: Extra whitepsace found in template tags. + message: Extra whitespace found in template tags. patterns: - "{%(([\"|'](?:(?!'|\"|%}).)*?[\"|'])|[^(?:%}|'|\")])*?\\s{2,}" - "{{(([\"|'](?:(?!'|\"|}}).)*?[\"|'])|[^(?:}}|'|\")])*?\\s{2,}" - rule: name: H033 - message: Extra whitepsace found in form action. + message: Extra whitespace found in form action. patterns: - ]+?action=['|"]\s - ]+?action=(['|"])({{(?:(?!}}).)*}}|{%(?:(?!%}).)*%}|([^"'{]))*\s+?\1 diff --git a/src/djlint/settings.py b/src/djlint/settings.py index f1586a7..de0e747 100644 --- a/src/djlint/settings.py +++ b/src/djlint/settings.py @@ -349,7 +349,7 @@ class Config: """ # ignored block closing tags that - # we can savely indent. + # we can safely indent. self.safe_closing_tag: str = r""" None: assert "H025 1:" in result.output assert "H025 2:" not in result.output - # test tags inside attibutes + # test tags inside attributes write_to_file(tmp_file.name, b'Foo') result = runner.invoke(djlint, [tmp_file.name]) assert "H025" not in result.output From be07d18ebebe1cffb9b9db517f777a61321bec18 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Thu, 17 Mar 2022 13:30:58 -0700 Subject: [PATCH 2/3] Fix spelling mistakes found by codespell Signed-off-by: Anders Kaseorg --- .github/workflows/cancel.yml | 2 +- docs/src/_includes/index.njk | 2 +- docs/src/docs/linter.md | 2 +- docs/src/fr/docs/linter.md | 2 +- docs/src/ru/docs/linter.md | 2 +- src/djlint/formatter/attributes.py | 2 +- src/djlint/rules.yaml | 2 +- src/djlint/settings.py | 2 +- tests/test_linter.py | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml index 44fdb47..584b244 100644 --- a/.github/workflows/cancel.yml +++ b/.github/workflows/cancel.yml @@ -1,5 +1,5 @@ # This action finds in-progress Action jobs for the same branch, and cancels -# them. There's little point in continuing to run superceded jobs. +# them. There's little point in continuing to run superseded jobs. name: cancel diff --git a/docs/src/_includes/index.njk b/docs/src/_includes/index.njk index 4b53dfa..61ad4ef 100644 --- a/docs/src/_includes/index.njk +++ b/docs/src/_includes/index.njk @@ -129,7 +129,7 @@ date: Last Modified
diff --git a/docs/src/docs/linter.md b/docs/src/docs/linter.md index ae66f64..3c16d2f 100644 --- a/docs/src/docs/linter.md +++ b/docs/src/docs/linter.md @@ -68,7 +68,7 @@ A good rule follows this pattern: | H023 | Do not use entity references. | | H024 | Omit type on scripts and styles. | | H025 | Tag seems to be an orphan. | -| H026 | Emtpy id and class tags can be removed. | +| H026 | Empty id and class tags can be removed. | | T027 | Unclosed string found in template syntax. | | T028 | Consider using spaceless tags inside attribute values. {% raw %}`{%- if/for -%}`{% endraw %} | | H029 | Consider using lowercase form method values. | diff --git a/docs/src/fr/docs/linter.md b/docs/src/fr/docs/linter.md index f89f53f..636ab6c 100644 --- a/docs/src/fr/docs/linter.md +++ b/docs/src/fr/docs/linter.md @@ -70,7 +70,7 @@ Une bonne règle suit ce modèle : | H023 | N'utilisez pas de références d'entités. | | H024 | Omettre le type sur les scripts et les styles. | | H025 | La balise semble être orpheline. | -| H026 | Les balises Emtpy id et class peuvent être supprimées. | +| H026 | Les balises Empty id et class peuvent être supprimées. | | T027 | Chaîne non fermée trouvée dans la syntaxe du modèle. | | T028 | Envisagez d'utiliser des balises sans espace à l'intérieur des valeurs d'attributs. {% raw %}`{%- if/for -%}`{% endraw %} | | H029 | Pensez à utiliser des valeurs de méthode de formulaire en minuscules. | diff --git a/docs/src/ru/docs/linter.md b/docs/src/ru/docs/linter.md index 0447e23..b452de7 100644 --- a/docs/src/ru/docs/linter.md +++ b/docs/src/ru/docs/linter.md @@ -68,7 +68,7 @@ djlint /path/to/this.html.j2 --profile=jinja | H023 | Не используйте ссылки на сущности. | | H024 | Опускайте тип в скриптах и стилях. | | H025 | Тег кажется бесхозным. | -| H026 | Теги Emtpy id и class могут быть удалены. | +| H026 | Теги Empty id и class могут быть удалены. | | T027 | В синтаксисе шаблона найдена незакрытая строка. | | T028 | Рассмотрите возможность использования тегов без пробелов внутри значений атрибутов. {% raw %}`{%- if/for -%}`{% endraw %} | | H029 | Рассмотрите возможность использования строчных значений метода формы. | diff --git a/src/djlint/formatter/attributes.py b/src/djlint/formatter/attributes.py index 082d79b..eb962b2 100644 --- a/src/djlint/formatter/attributes.py +++ b/src/djlint/formatter/attributes.py @@ -244,7 +244,7 @@ def format_style(match: re.match) -> str: def format_attributes(config: Config, html: str, match: re.match) -> str: """Spread long attributes over multiple lines.""" - # check that we are not inside an ingnored block + # check that we are not inside an ignored block if ( inside_ignored_block(config, html, match) or len(match.group(3).strip()) < config.max_attribute_length diff --git a/src/djlint/rules.yaml b/src/djlint/rules.yaml index 4a7430b..cbd6f56 100644 --- a/src/djlint/rules.yaml +++ b/src/djlint/rules.yaml @@ -187,7 +187,7 @@ - <((/?(\w+))\b(\"[^\"]*\"|'[^']*'|{{[^}]*}}|{%[^%]*%}|[^'\">{}])*)(? - rule: name: H026 - message: Emtpy id and class tags can be removed. + message: Empty id and class tags can be removed. flags: re.I patterns: - <\w+\b[^(?:{(?:%|{|#))>]*?\b(class|id)\b=(\"\"|'') diff --git a/src/djlint/settings.py b/src/djlint/settings.py index f1586a7..de0e747 100644 --- a/src/djlint/settings.py +++ b/src/djlint/settings.py @@ -349,7 +349,7 @@ class Config: """ # ignored block closing tags that - # we can savely indent. + # we can safely indent. self.safe_closing_tag: str = r""" None: assert "H025 1:" in result.output assert "H025 2:" not in result.output - # test tags inside attibutes + # test tags inside attributes write_to_file(tmp_file.name, b'Foo') result = runner.invoke(djlint, [tmp_file.name]) assert "H025" not in result.output From 694c2c625fda4eb9fe88c3c93228c8e3d1a8b88f Mon Sep 17 00:00:00 2001 From: Christopher Pickering Date: Fri, 18 Mar 2022 08:12:22 -0500 Subject: [PATCH 3/3] fixed translation --- docs/src/fr/docs/linter.md | 2 +- docs/src/ru/docs/linter.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/fr/docs/linter.md b/docs/src/fr/docs/linter.md index 636ab6c..7df65c0 100644 --- a/docs/src/fr/docs/linter.md +++ b/docs/src/fr/docs/linter.md @@ -70,7 +70,7 @@ Une bonne règle suit ce modèle : | H023 | N'utilisez pas de références d'entités. | | H024 | Omettre le type sur les scripts et les styles. | | H025 | La balise semble être orpheline. | -| H026 | Les balises Empty id et class peuvent être supprimées. | +| H026 | Les balises id et class vides peuvent être supprimées. | | T027 | Chaîne non fermée trouvée dans la syntaxe du modèle. | | T028 | Envisagez d'utiliser des balises sans espace à l'intérieur des valeurs d'attributs. {% raw %}`{%- if/for -%}`{% endraw %} | | H029 | Pensez à utiliser des valeurs de méthode de formulaire en minuscules. | diff --git a/docs/src/ru/docs/linter.md b/docs/src/ru/docs/linter.md index b452de7..102d720 100644 --- a/docs/src/ru/docs/linter.md +++ b/docs/src/ru/docs/linter.md @@ -68,7 +68,7 @@ djlint /path/to/this.html.j2 --profile=jinja | H023 | Не используйте ссылки на сущности. | | H024 | Опускайте тип в скриптах и стилях. | | H025 | Тег кажется бесхозным. | -| H026 | Теги Empty id и class могут быть удалены. | +| H026 | Пустые теги id и class могут быть удалены. | | T027 | В синтаксисе шаблона найдена незакрытая строка. | | T028 | Рассмотрите возможность использования тегов без пробелов внутри значений атрибутов. {% raw %}`{%- if/for -%}`{% endraw %} | | H029 | Рассмотрите возможность использования строчных значений метода формы. |