Skip to content

Commit

Permalink
Work properly when linting a file not in a git repo.
Browse files Browse the repository at this point in the history
It's not wrong to lint something outside a repo.  It just means we
shouldn't bother looking for repo-specific config files.

Auditors: benkraft

Test plan:
ka-lint /etc/passwd
  • Loading branch information
csilvers committed Apr 20, 2020
1 parent acdd14a commit 91a60ac
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions runlint.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@ def _find_base_config(file_to_lint, config_filename):
return None

base_git = _resolve_ancestor('<ancestor>/.git', file_to_lint)
if not base_git:
return None
base_directory = os.path.dirname(base_git)
base_config = os.path.join(base_directory, config_filename)
if os.path.exists(base_config):
Expand Down

0 comments on commit 91a60ac

Please sign in to comment.