diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-07-25 19:32:42 -0500 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-07-25 19:38:19 -0500 |
| commit | 222292c4b2bb595c81d749bfd35ef9adc640bacb (patch) | |
| tree | 4ff1ab3709e2c84861d8427cecee6c019cd901d5 /src/flake8/main | |
| parent | 4dc1d11a627a571eeae4e0ae3da7b94e7de04214 (diff) | |
| download | flake8-222292c4b2bb595c81d749bfd35ef9adc640bacb.tar.gz | |
Handle repeated --quiet options again
Fundamentally on Flake8 2.x using -q altered the format of the errors
(and the behaviour a little) so it makes the most sense to implement
this logic with formatters rather than messy logic spread throughout
the project.
The FilenameOnly formatter will keep track of filenames already reported
and only print the name once while Nothing will print nothing.
Closes #180
Diffstat (limited to 'src/flake8/main')
| -rw-r--r-- | src/flake8/main/application.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/flake8/main/application.py b/src/flake8/main/application.py index 464ff92..8a02fd6 100644 --- a/src/flake8/main/application.py +++ b/src/flake8/main/application.py @@ -181,10 +181,17 @@ class Application(object): # type: () -> NoneType """Initialize a formatter based on the parsed options.""" if self.formatter is None: + format_plugin = self.options.format + if 1 <= self.options.quiet < 2: + format_plugin = 'quiet-filename' + elif 2 <= self.options.quiet: + format_plugin = 'quiet-nothing' + if formatter_class is None: formatter_class = self.formatting_plugins.get( - self.options.format, self.formatting_plugins['default'] + format_plugin, self.formatting_plugins['default'] ).execute + self.formatter = formatter_class(self.options) def make_notifier(self): |
