sk- / git-lint

improving source code one step at a time
Apache License 2.0
236 stars 78 forks source link

Sort the linter output by line numbers #38

Closed sk- closed 9 years ago

sk- commented 10 years ago

Currently the output of the linters is not sorted by line number, which is annoying as you have to go back and forth between different context in the target file. This is because the order of the linters is typically not sorted either. As an example below is the output of linting gitlint/linters.py:

git lint gitlint/linters.py --force
Linting file: gitlint/linters.py
line 54, col 0: Warning: [fixme]: TODO(skreft): add test case for result already in cache.
line 125, col 0: Warning: [fixme]: TODO(skreft): validate data['filter'], ie check that only has valid fields.
line 25, col 0: Warning: [no-init]: Partial: Class has no __init__ method
line 28, col 54: Error: [no-member]: Partial.__eq__: Instance of 'Partial' has no 'args' member
line 29, col 20: Error: [no-member]: Partial.__eq__: Instance of 'Partial' has no 'keywords' member
line 34, col 13: Error: [no-member]: Partial.__repr__: Instance of 'Partial' has no 'func' member
line 34, col 33: Error: [no-member]: Partial.__repr__: Instance of 'Partial' has no 'args' member
line 34, col 44: Error: [no-member]: Partial.__repr__: Instance of 'Partial' has no 'keywords' member
line 25, col 0: Refactor: [too-few-public-methods]: Partial: Too few public methods (0/1)
line 55, col 0: Refactor: [too-many-locals]: lint_command: Too many local variables (16/15)
line 34, col 13: [E128]: continuation line under-indented for visual indent
sk- commented 10 years ago

The output now is:

git lint gitlint/linters.py --force
Linting file: gitlint/linters.py
line 26, col 0: Warning: [no-init]: Partial: Class has no __init__ method
line 26, col 0: Refactor: [too-few-public-methods]: Partial: Too few public methods (0/1)
line 29, col 54: Error: [no-member]: Partial.__eq__: Instance of 'Partial' has no 'args' member
line 30, col 20: Error: [no-member]: Partial.__eq__: Instance of 'Partial' has no 'keywords' member
line 35, col 13: Error: [no-member]: Partial.__repr__: Instance of 'Partial' has no 'func' member
line 35, col 13: [E128]: continuation line under-indented for visual indent
line 35, col 33: Error: [no-member]: Partial.__repr__: Instance of 'Partial' has no 'args' member
line 35, col 44: Error: [no-member]: Partial.__repr__: Instance of 'Partial' has no 'keywords' member
line 55, col 0: Warning: [fixme]: TODO(skreft): add test case for result already in cache.
line 56, col 0: Refactor: [too-many-locals]: lint_command: Too many local variables (16/15)
line 132, col 0: Warning: [fixme]: TODO(skreft): validate data['filter'], ie check that only has valid fields.