Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed errant sys.argv to args parameter passed in. #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions hooks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, command: str, look_behind: str, args: List[str]):
self.look_behind = look_behind
self.command = command
# Will be [] if not run using pre-commit or if there are no committed files
self.files = self.get_added_files()
self.files = self.get_added_files(args)
self.edit_in_place = False

self.stdout = b""
Expand All @@ -35,9 +35,9 @@ def check_installed(self):
) # noqa: E501
self.raise_error(problem, details)

def get_added_files(self):
def get_added_files(self, args):
"""Find added files using git."""
added_files = sys.argv[1:] # 1: don't include the hook file
added_files = args[1:] # 1: don't include the hook file
# cfg files are used by uncrustify and won't be source files
added_files = [f for f in added_files if os.path.exists(f) and not f.endswith(".cfg")]

Expand Down