Skip to content

Commit

Permalink
Track actually modified files, fixes amyreese#26
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmoud Hashemi committed Oct 8, 2020
1 parent 53b3f38 commit 7083093
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fissix/refactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def __init__(self, fixer_names, options=None, explicit=None):
self.pre_order, self.post_order = self.get_fixers()

self.files = [] # List of files that were or should be modified
self.modified_files = []

self.BM = bm.BottomMatcher()
self.bmi_pre_order = [] # Bottom Matcher incompatible fixers
Expand Down Expand Up @@ -507,6 +508,8 @@ def processed_file(
if old_text is None:
return
equal = old_text == new_text
if not equal:
self.modified_files.append(filename)
self.print_output(old_text, new_text, filename, equal)
if equal:
self.log_debug("No changes to %s", filename)
Expand Down Expand Up @@ -625,11 +628,11 @@ def summarize(self):
were = "were"
else:
were = "need to be"
if not self.files:
if not self.modified_files:
self.log_message("No files %s modified.", were)
else:
self.log_message("Files that %s modified:", were)
for file in self.files:
for file in self.modified_files:
self.log_message(file)
if self.fixer_log:
self.log_message("Warnings/messages while refactoring:")
Expand Down

0 comments on commit 7083093

Please sign in to comment.