Skip to content

Commit

Permalink
fix: Only check rules if the file exists
Browse files Browse the repository at this point in the history
  • Loading branch information
andreoliwa committed Jan 5, 2019
1 parent b1333db commit 66e42d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion flake8_nitpick/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def run(self) -> YieldFlake8Error:

for checker_class in get_subclasses(BaseChecker):
checker = checker_class(config)
for error in itertools.chain(checker.check_exists(), checker.check_rules()):
for error in checker.check_exists():
yield error

return []
Expand Down Expand Up @@ -287,6 +287,9 @@ def check_exists(self) -> YieldFlake8Error:
yield self.flake8_error(1, f"Missing file")
elif not should_exist and file_exists:
yield self.flake8_error(2, f"File should be deleted")
elif file_exists:
for error in self.check_rules():
yield error

def check_rules(self) -> YieldFlake8Error:
"""Check rules for this file. It should be overridden by inherited class if they need."""
Expand Down

0 comments on commit 66e42d2

Please sign in to comment.