Skip to content

Commit

Permalink
fix(linter): fixed false postive on rule H008
Browse files Browse the repository at this point in the history
closes #339
  • Loading branch information
christopherpickering committed Aug 22, 2022
1 parent f9dac86 commit 79618a5
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 22 deletions.
42 changes: 21 additions & 21 deletions requirements.txt
@@ -1,47 +1,47 @@
astroid==2.12.2; python_full_version >= "3.7.2"
atomicwrites==1.4.1; python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.4.0"
astroid==2.11.7; python_full_version >= "3.7.2"
atomicwrites==1.4.0; python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.4.0"
attrs==21.4.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
black==22.6.0; python_full_version >= "3.6.2"
click==8.1.3; python_version >= "3.6"
black==22.1.0; python_full_version >= "3.6.2"
click==8.0.3; python_version >= "3.6"
colorama==0.4.5; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
coverage==6.4.4; python_version >= "3.7"
cssbeautifier==1.14.6
coverage==6.4.2; python_version >= "3.7"
cssbeautifier==1.14.4
dill==0.3.5.1; python_full_version >= "3.7.2"
editorconfig==0.12.3
execnet==1.9.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
flake8==4.0.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
flake8==3.9.2; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
html-tag-names==0.1.2; python_version >= "3.7" and python_version < "4.0"
html-void-elements==0.1.0; python_version >= "3.7" and python_version < "4.0"
importlib-metadata==4.12.0; python_version >= "3.7"
importlib-metadata==4.11.0; python_version >= "3.7"
iniconfig==1.1.1; python_version >= "3.7"
isort==5.10.1; python_full_version >= "3.6.1" and python_version < "4.0"
jsbeautifier==1.14.6
jsbeautifier==1.14.4
lazy-object-proxy==1.7.1; python_version >= "3.6" and python_full_version >= "3.7.2"
mccabe==0.7.0; python_full_version >= "3.7.2"
mccabe==0.6.1; python_full_version >= "3.7.2"
mypy-extensions==0.4.3; python_full_version >= "3.6.2" and python_version >= "3.6"
mypy==0.971; python_version >= "3.6"
packaging==21.3; python_version >= "3.7"
pathspec==0.9.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
pep8-naming==0.13.2
platformdirs==2.5.2; python_version >= "3.7" and python_full_version >= "3.7.2"
pep8-naming==0.13.1
platformdirs==2.5.0; python_version >= "3.7" and python_full_version >= "3.7.2"
pluggy==1.0.0; python_version >= "3.7"
py==1.11.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
pycodestyle==2.9.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
pyflakes==2.5.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
pycodestyle==2.7.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
pyflakes==2.3.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
pylint==2.14.5; python_full_version >= "3.7.2"
pyparsing==3.0.9; python_version >= "3.7"
pyparsing==3.0.7; python_version >= "3.7"
pytest-cov==3.0.0; python_version >= "3.6"
pytest-forked==1.4.0; python_version >= "3.6"
pytest-xdist==2.5.0; python_version >= "3.6"
pytest==7.1.2; python_version >= "3.7"
pyyaml==6.0; python_version >= "3.6"
regex==2022.8.17
regex==2022.1.18
six==1.16.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0"
tomli==2.0.1; python_version >= "3.7" and python_full_version >= "3.7.2" and python_full_version <= "3.11.0a6" and python_version < "3.11" or python_version < "3.11"
tomlkit==0.11.4; python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.7.2"
tqdm==4.64.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
typed-ast==1.5.4; python_version < "3.8" and implementation_name == "cpython" and python_full_version >= "3.7.2" and python_version >= "3.6"
tomlkit==0.11.1; python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.7.2"
tqdm==4.62.3; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
typed-ast==1.4.3; python_version < "3.8" and implementation_name == "cpython" and python_full_version >= "3.7.2" and python_version >= "3.6"
types-pyyaml==6.0.11
typing-extensions==4.3.0; python_version < "3.8" and python_version >= "3.7" and python_full_version >= "3.7.2"
typing-extensions==4.1.0; python_version < "3.8" and python_version >= "3.7" and python_full_version >= "3.7.2"
wrapt==1.14.1; python_full_version >= "3.7.2"
zipp==3.8.1; python_version < "3.8" and python_version >= "3.7"
zipp==3.7.0; python_version < "3.8" and python_version >= "3.7"
2 changes: 1 addition & 1 deletion src/djlint/rules.yaml
Expand Up @@ -70,7 +70,7 @@
message: Attributes should be double quoted.
flags: re.DOTALL|re.I
patterns:
- (?:class|id|src|width|height|alt|style|lang|title|srcset|media)=\'[^\']*'
- <(?:\w+)\b(\"[^\"]*\"|'[^']*'|{[^}]*}|[^'\">{}])*(?:class|id|src|width|height|alt|style|lang|title|srcset|media)=\'[^\']*'
- rule:
name: H009
message: Tag names should be lowercase.
Expand Down
15 changes: 15 additions & 0 deletions tests/test_linter/test_linter.py
Expand Up @@ -105,6 +105,21 @@ def test_H008(runner: CliRunner, tmp_file: TextIO) -> None:
assert result.exit_code == 1
assert "H008 1:" in result.output

write_to_file(
tmp_file.name,
b"""<link rel="stylesheet" href="KiraCSS.css" media="print" onload="this.media='all'" media=''/>""",
)
result = runner.invoke(djlint, [tmp_file.name])
assert result.exit_code == 1
assert "H008 1:" in result.output

write_to_file(
tmp_file.name,
b"""<link rel="stylesheet" href="KiraCSS.css" media="print" onload="this.media='all'"/>""",
)
result = runner.invoke(djlint, [tmp_file.name])
assert "H008 1:" not in result.output


def test_H009(runner: CliRunner, tmp_file: TextIO) -> None:
write_to_file(tmp_file.name, b"<H1>")
Expand Down

0 comments on commit 79618a5

Please sign in to comment.