Skip to content

Commit

Permalink
added whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
dmalan committed Oct 4, 2017
1 parent 1855102 commit 514559e
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions style50/style50.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,8 @@ def run_diff(self):
header, footer = (termcolor.colored("{0}\n{{}}\n{0}\n".format(
":" * 14), "cyan"), "\n") if len(files) > 1 else ("", "")

first = True
for file in files:
# Only print footer after first file has been printed
if first:
first = False
else:
print(footer, end="")

print(header.format(file), end="")

try:
results = self._check(file)
except Error as e:
Expand All @@ -110,20 +102,26 @@ def run_diff(self):

# Display results
if results.diffs:
print()
print(*self.diff(results.original, results.styled), sep="\n")
print()
conjunction = "And"
else:
termcolor.cprint("Looks good!", "green")
conjunction = "But"

if results.diffs:
for type, c in sorted(self._warn_chars):
color, verb = ("on_green", "insert") if type == "+" else ("on_red", "delete")
termcolor.cprint(c, None, color, end="")
termcolor.cprint(" means that you should {} a {}.".format(
verb, "newline" if c == "\\n" else "tab"), "yellow")

if results.comment_ratio < results.COMMENT_MIN:
termcolor.cprint("{} consider adding more comments!".format(conjunction), "yellow")

for type, c in sorted(self._warn_chars):
color, verb = ("on_green", "inserted") if type == "+" else ("on_red", "removed")
termcolor.cprint("* ", "cyan", end="")
termcolor.cprint(c, None, color, end="")
termcolor.cprint(" means that a {} character should be {}".format(
"newline" if c == "\\n" else "tab", verb), "cyan")
if (results.comment_ratio < results.COMMENT_MIN or self._warn_chars) and results.diffs:
print()

def run_json(self):
"""
Expand Down

0 comments on commit 514559e

Please sign in to comment.