-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding validate-html hook based on v.Nu through svenkreiss/html5valid…
…ator
- Loading branch information
Showing
8 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/pre_commit_hooks.egg-info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[MESSAGES CONTROL] | ||
disable = bad-continuation, duplicate-code, import-error, missing-docstring | ||
disable = bad-continuation, duplicate-code, import-error, missing-docstring, multiple-imports | ||
|
||
[FORMAT] | ||
max-line-length = 110 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pre-commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from __future__ import print_function | ||
import argparse, sys | ||
from html5validator.validator import Validator | ||
|
||
def main(argv=None): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('filenames', nargs='*', help='filenames to check') | ||
parser.add_argument('--error_only', dest='error_only', | ||
action='store_false', default=True) | ||
parser.add_argument('--ignore', nargs='*', default=None, | ||
type=lambda s: (s.decode('utf-8') | ||
if isinstance(s, bytes) else s), | ||
help='ignore messages containing the given strings') | ||
parser.add_argument('--ignore-re', nargs='*', default=None, | ||
type=lambda s: (s.decode('utf-8') | ||
if isinstance(s, bytes) else s), | ||
dest='ignore_re', | ||
help='regular expression of messages to ignore') | ||
parser.add_argument('-l', action='store_const', const=2048, | ||
dest='stack_size', | ||
help=('run on larger files: sets Java ' | ||
'stack size to 2048k') | ||
) | ||
parser.add_argument('-ll', action='store_const', const=8192, | ||
dest='stack_size', | ||
help=('run on larger files: sets Java ' | ||
'stack size to 8192k') | ||
) | ||
parser.add_argument('-lll', action='store_const', const=32768, | ||
dest='stack_size', | ||
help=('run on larger files: sets Java ' | ||
'stack size to 32768k') | ||
) | ||
args = parser.parse_args(argv) | ||
|
||
validator = Validator(directory=None, match=None, ignore=args.ignore, ignore_re=args.ignore_re) | ||
sys.exit(validator.validate( | ||
args.filenames, | ||
errors_only=args.error_only, | ||
stack_size=args.stack_size, | ||
)) | ||
|
||
if __name__ == '__main__': | ||
sys.exit(main(sys.argv[1:])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters