Do not print the source when provided with -q

When users specify any number of -q's on the command-line, we should not
show the source even if they have otherwwise configured Flake8 to do so.

Closes #245
This commit is contained in:
Ian Cordasco 2016-11-11 19:06:13 -06:00
parent ca4f631fb2
commit 5dfb93c0d0
No known key found for this signature in database
GPG key ID: 656D3395E4A9791A
3 changed files with 74 additions and 0 deletions

View file

@ -65,6 +65,10 @@ class FilenameOnly(SimpleFormatter):
"""Initialize our set of filenames."""
self.filenames_already_printed = set()
def show_source(self, error):
"""Do not include the source code."""
pass
def format(self, error):
"""Ensure we only print each error once."""
if error.filename not in self.filenames_already_printed:
@ -78,3 +82,7 @@ class Nothing(base.BaseFormatter):
def format(self, error):
"""Do nothing."""
pass
def show_source(self, error):
"""Do not print the source."""
pass