X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/f2ea461e9e9fa5c47bb61fd72d512c748928badc..10677baa40f818ca06c6a9d5efa0dca052865bfb:/src/black/report.py diff --git a/src/black/report.py b/src/black/report.py index 8fc5da2..43b942c 100644 --- a/src/black/report.py +++ b/src/black/report.py @@ -16,6 +16,10 @@ class Changed(Enum): YES = 2 +class NothingChanged(UserWarning): + """Raised when reformatted code is the same as source.""" + + @dataclass class Report: """Provides a reformatting counter. Can be rendered with `str(report)`.""" @@ -89,11 +93,13 @@ class Report: if self.change_count: s = "s" if self.change_count > 1 else "" report.append( - style(f"{self.change_count} file{s} {reformatted}", bold=True) + style(f"{self.change_count} file{s} ", bold=True, fg="blue") + + style(f"{reformatted}", bold=True) ) + if self.same_count: s = "s" if self.same_count > 1 else "" - report.append(f"{self.same_count} file{s} {unchanged}") + report.append(style(f"{self.same_count} file{s} ", fg="blue") + unchanged) if self.failure_count: s = "s" if self.failure_count > 1 else "" report.append(style(f"{self.failure_count} file{s} {failed}", fg="red"))