markdownlint-cli icon indicating copy to clipboard operation
markdownlint-cli copied to clipboard

Add --statistics --count?

Open hugovk opened this issue 6 years ago • 4 comments

The Python linting tool Flake8 has useful options: --statistics and --count.

Basic use

$ flake8 .
./interactive_console.py:5:1: E402 module level import not at top of file
<snip>
./pytumblr/helpers.py:31:1: E302 expected 2 blank lines, found 1

With --statistics

$ flake8 . --statistics
./interactive_console.py:5:1: E402 module level import not at top of file
<snip>
./pytumblr/helpers.py:31:1: E302 expected 2 blank lines, found 1
1     E201 whitespace after '{'
1     E222 multiple spaces after operator
3     E265 block comment should start with '# '
2     E302 expected 2 blank lines, found 1
1     E305 expected 2 blank lines after class or function definition, found 1
18    E402 module level import not at top of file
90    E501 line too long (92 > 79 characters)
1     W293 blank line contains whitespace

With --count

$ flake8 . --count
./interactive_console.py:5:1: E402 module level import not at top of file
<snip>
./pytumblr/helpers.py:31:1: E302 expected 2 blank lines, found 1
117

With both

$ flake8 . --count --statistics
./interactive_console.py:5:1: E402 module level import not at top of file
<snip>
./pytumblr/helpers.py:31:1: E302 expected 2 blank lines, found 1
1     E201 whitespace after '{'
1     E222 multiple spaces after operator
3     E265 block comment should start with '# '
2     E302 expected 2 blank lines, found 1
1     E305 expected 2 blank lines after class or function definition, found 1
18    E402 module level import not at top of file
90    E501 line too long (92 > 79 characters)
1     W293 blank line contains whitespace
117

Any chance to include something like that here?

Thanks!

hugovk avatar Jan 10 '19 22:01 hugovk

“statistics” seems more useful to me than “count“, but both should be doable here as a post-processing step on the results from linting.

DavidAnson avatar Jan 11 '19 00:01 DavidAnson

Thanks! I'm applying markdownlint to a project, and there's over 600 errors...

Summarising the results helps decide which group to tackle next.

(Yes, --statistics is more useful than --count, although it's still useful to get the total sometimes.)

hugovk avatar Jan 11 '19 06:01 hugovk

Any chance to see that enhancement in future versions?

Guts avatar Sep 11 '20 10:09 Guts

Just FYI, I have added something like this to markdownlint-cli2: https://www.npmjs.com/package/markdownlint-cli2-formatter-summarize

DavidAnson avatar Sep 23 '20 03:09 DavidAnson