diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-07-13 01:07:58 +0000 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-07-13 01:07:58 +0000 |
| commit | 4d6929c8ab45ca8116e36ad63d3fb6a55b1177b5 (patch) | |
| tree | 3054210bf1b865666c0068e024e2e42dc1e4d4de /src/flake8/api | |
| parent | 58e67634cd24122e1961ac2e223d38465e2ab4c8 (diff) | |
| parent | 2ffcf96b4b7a1fbc761796df1336a94408a79ed0 (diff) | |
| download | flake8-4d6929c8ab45ca8116e36ad63d3fb6a55b1177b5.tar.gz | |
Merge branch 'add-statistics' into 'master'
Add the statistics module
*Description of changes*
Start adding support for `--statistics` and legacy `get_statistics` API.
*Related to:* (Add bug number here)
See merge request !73
Diffstat (limited to 'src/flake8/api')
| -rw-r--r-- | src/flake8/api/legacy.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/flake8/api/legacy.py b/src/flake8/api/legacy.py index 35c7101..9fc05bb 100644 --- a/src/flake8/api/legacy.py +++ b/src/flake8/api/legacy.py @@ -141,6 +141,8 @@ class Report(object): .. warning:: This should not be instantiated by users. """ self._application = application + self._style_guide = application.guide + self._stats = self._style_guide.stats @property def total_errors(self): @@ -149,4 +151,7 @@ class Report(object): def get_statistics(self, violation): """Get the number of occurences of a violation.""" - raise NotImplementedError('Statistics capturing needs to happen first') + return [ + '{} {} {}'.format(s.count, s.error_code, s.message) + for s in self._stats.statistics_for(violation) + ] |
