updated regex for H011, closes #37

This commit is contained in:
Christopher Pickering 2021-10-04 10:51:54 +02:00
parent 849648a8d6
commit c95574b568
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
2 changed files with 3 additions and 3 deletions

View file

@ -76,7 +76,7 @@ def lint_file(config: Config, this_file: Path) -> Dict:
{
"code": rule["name"],
"line": get_line(match.start(), line_ends),
"match": match.group()[:20].strip(),
"match": match.group().strip()[:20],
"message": rule["message"],
}
)

View file

@ -85,9 +85,9 @@
- rule:
name: H011
message: Attribute values should be quoted.
flags: re.DOTALL|re.I
flags: re.DOTALL|re.I|re.M
patterns:
- "[^(?:\"|')]\\s+?(?:class|id|src|width|height|alt|style|lang|title|href|action|method)=[a-zA-Z]+"
- ^^[^(?:"|')]*?\s+?(?:class|id|src|width|height|alt|style|lang|title|href|action|method)=[a-zA-Z_-]+
- rule:
name: H012
message: There should be no spaces around attribute =.