##// END OF EJS Templates
cleanup: run pyflakes as a part of scripts/run-all-cleanup...
Mads Kiilerich -
r8109:51af7c12 default
parent child Browse files
Show More
@@ -0,0 +1,37 b''
1 #!/usr/bin/env python3
2 """
3 pyflakes with filter configuration for Kallithea.
4 Inspired by pyflakes/api.py and flake8/plugins/pyflakes.py .
5 """
6
7 import sys
8 import pyflakes.api
9 import pyflakes.messages
10
11 class Reporter:
12
13 warned = False
14
15 def flake(self, warning):
16 # ignore known warnings
17 if isinstance(warning, pyflakes.messages.UnusedVariable):
18 return
19 if warning.filename == 'kallithea/bin/kallithea_cli_ishell.py':
20 if isinstance(warning, pyflakes.messages.ImportStarUsed) and warning.message_args == ('kallithea.model.db',):
21 return
22 if isinstance(warning, pyflakes.messages.UnusedImport) and warning.message_args == ('kallithea.model.db.*',):
23 return
24
25 print('%s:%s %s [%s %s]' % (warning.filename, warning.lineno, warning.message % warning.message_args, type(warning).__name__, warning.message_args))
26 self.warned = True
27
28 def unexpectedError(self, filename, msg):
29 print('Unexpected error for %s: %s' % (filename, msg))
30
31
32 reporter = Reporter()
33
34 for filename in sorted(set(sys.argv[1:])):
35 pyflakes.api.checkPath(filename, reporter=reporter)
36 if reporter.warned:
37 raise SystemExit(1)
@@ -1,8 +1,9 b''
1 pytest >= 4.6.6, < 5.4
1 pytest >= 4.6.6, < 5.4
2 pytest-sugar >= 0.9.2, < 0.10
2 pytest-sugar >= 0.9.2, < 0.10
3 pytest-benchmark >= 3.2.2, < 3.3
3 pytest-benchmark >= 3.2.2, < 3.3
4 pytest-localserver >= 0.5.0, < 0.6
4 pytest-localserver >= 0.5.0, < 0.6
5 mock >= 3.0.0, < 4.1
5 mock >= 3.0.0, < 4.1
6 Sphinx >= 1.8.0, < 2.4
6 Sphinx >= 1.8.0, < 2.4
7 WebTest >= 2.0.6, < 2.1
7 WebTest >= 2.0.6, < 2.1
8 isort == 4.3.21
8 isort == 4.3.21
9 pyflakes == 2.1.1
@@ -1,10 +1,12 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 # Convenience script for running various idempotent source code cleanup scripts
3 # Convenience script for running various idempotent source code cleanup scripts
4
4
5 set -e
5 set -e
6 set -x
6 set -x
7
7
8 scripts/docs-headings.py
8 scripts/docs-headings.py
9 scripts/generate-ini.py
9 scripts/generate-ini.py
10 scripts/whitespacecleanup.sh
10 scripts/whitespacecleanup.sh
11
12 hg loc 'set:!binary()&grep("^#!.*python")' '*.py' | xargs scripts/pyflakes
General Comments 0
You need to be logged in to leave comments. Login now