Loading hooks/__init__.py +1 −0 Original line number Diff line number Diff line """pre-commit hooks package.""" hooks/packer_fix.py +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ import sys import hooks.utils def packer_fix(file): def packer_fix(file): # noqa: D213 """Runs packer fix. If the invocation succeeds, overwrite the file with the fixed output from Loading hooks/packer_validate.py +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ import sys import hooks.utils def packer_validate(file): def packer_validate(file): # noqa: D213 """Validate a Packer template. Run init when needed. Loading hooks/utils.py +14 −7 Original line number Diff line number Diff line # noqa: D213 """Utilities for Python hooks. Mainly, executing external processes. Loading @@ -11,14 +12,17 @@ import subprocess # nosec import sys def unique_directories(files): """Returns a list of directories (pathlib.Path objects) for the files passed without repetitions.""" def unique_directories(files): # noqa: D213 """Returns the directories of the given files. Returns a unique (not repeating) list of the base directories (pathlib.Path objects) for the list of files given. """ return list({pathlib.Path(x).parent for x in files}) @contextlib.contextmanager def chdir(path): def chdir(path): # noqa: D213 """Context manager for changing the working directory. >>> import os Loading Loading @@ -64,8 +68,11 @@ def check_file(args, file=None): return proc.returncode def check_directory(args, directory): "A simple check for a directory, may be used to build more complex checks." def check_directory(args, directory): # noqa: D213 """A simple check for a directory. May be used to build more complex checks. """ with chdir(directory): proc = run(args) if proc.returncode > 0: Loading @@ -74,7 +81,7 @@ def check_directory(args, directory): return proc.returncode def bulk_check(checker, items): def bulk_check(checker, items): # noqa: D213 """Bulk check files. Some programs can only accept a single file or directory to process at a Loading Loading
hooks/__init__.py +1 −0 Original line number Diff line number Diff line """pre-commit hooks package."""
hooks/packer_fix.py +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ import sys import hooks.utils def packer_fix(file): def packer_fix(file): # noqa: D213 """Runs packer fix. If the invocation succeeds, overwrite the file with the fixed output from Loading
hooks/packer_validate.py +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ import sys import hooks.utils def packer_validate(file): def packer_validate(file): # noqa: D213 """Validate a Packer template. Run init when needed. Loading
hooks/utils.py +14 −7 Original line number Diff line number Diff line # noqa: D213 """Utilities for Python hooks. Mainly, executing external processes. Loading @@ -11,14 +12,17 @@ import subprocess # nosec import sys def unique_directories(files): """Returns a list of directories (pathlib.Path objects) for the files passed without repetitions.""" def unique_directories(files): # noqa: D213 """Returns the directories of the given files. Returns a unique (not repeating) list of the base directories (pathlib.Path objects) for the list of files given. """ return list({pathlib.Path(x).parent for x in files}) @contextlib.contextmanager def chdir(path): def chdir(path): # noqa: D213 """Context manager for changing the working directory. >>> import os Loading Loading @@ -64,8 +68,11 @@ def check_file(args, file=None): return proc.returncode def check_directory(args, directory): "A simple check for a directory, may be used to build more complex checks." def check_directory(args, directory): # noqa: D213 """A simple check for a directory. May be used to build more complex checks. """ with chdir(directory): proc = run(args) if proc.returncode > 0: Loading @@ -74,7 +81,7 @@ def check_directory(args, directory): return proc.returncode def bulk_check(checker, items): def bulk_check(checker, items): # noqa: D213 """Bulk check files. Some programs can only accept a single file or directory to process at a Loading