Skip to content

Commit 24f613c

Browse files
authored
Enable flake8 by default (emscripten-core#8112)
1 parent b1437ea commit 24f613c

26 files changed

Lines changed: 540 additions & 414 deletions

.flake8

Lines changed: 17 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,20 @@
11
[flake8]
22
ignore = E111,E114,E501,E261,E266,E121,E402,E241
33
# TODO(sbc): Switch from the whitelist of a blacklist such as:
4-
# exclude = ./third_party/,emmaken.py,./tools/scons/,./tools/ports/,./tests/
5-
filename =
6-
*/emar.py
7-
*/emcc.py
8-
*/emscons.py
9-
*/emscripten.py
10-
*/embuilder.py
11-
*/tools/shared.py
12-
*/tools/response_file.py
13-
*/tools/python_selector.py
14-
*/tools/wasm-sourcemap.py
15-
*/tools/clean_webconsole.py
16-
*/tools/emconfiguren.py
17-
*/tools/emdebug_cd_merger.py
18-
*/tools/line_endings.py
19-
*/tools/nativize_llvm.py
20-
*/tools/exec_llvm.py
21-
*/tools/emmakenxx.py
22-
*/tools/exec_llvm.py
23-
*/tools/find_bigvars.py
24-
*/tools/merge_pair.py
25-
*/tools/system_libs.py
26-
*/tools/add_license.py
27-
*/tools/file_packager.py
28-
*/tools/emmaken.py
29-
*/tools/ctor_evaller.py
30-
*/tools/duplicate_function_eliminator.py
31-
*/tests/runner.py
32-
*/tests/test_browser.py
33-
*/tests/test_other.py
34-
*/tests/test_core.py
35-
*/tests/parallel_runner.py
36-
*/tests/test_sanity.py
37-
*/tests/test_benchmark.py
38-
*/tests/test_interactive.py
39-
*/tests/test_sockets.py
4+
exclude =
5+
./site/source/conf.py,
6+
./third_party/,
7+
./tools/scons/,
8+
./tools/debug
9+
./tools/ports/,
10+
./tools/emdump.py,
11+
./tools/emterpretify.py,
12+
./tools/js_optimizer.py,
13+
./tools/webidl_binder.py,
14+
./tools/create_dom_pk_codes.py,
15+
./tools/gen_struct_info.py,
16+
./tools/asm_module.py,
17+
./tools/colored_logger.py,
18+
./tools/ffdb.py,
19+
./tools/filelock.py, # third party code
20+
./tests/,

emcmake.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@
44
# University of Illinois/NCSA Open Source License. Both these licenses can be
55
# found in the LICENSE file.
66

7-
import os, subprocess, sys
7+
import subprocess
8+
import sys
89
from tools import shared
910

11+
1012
#
1113
# Main run() function
1214
#
1315
def run():
1416
configure_path = shared.path_from_root('emconfigure')
17+
return subprocess.call([shared.PYTHON, configure_path] + sys.argv[1:])
1518

16-
exit(subprocess.call([shared.PYTHON, configure_path] + sys.argv[1:]))
1719

1820
if __name__ == '__main__':
19-
run()
21+
sys.exit(run())

emconfigure.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
'''
2323

2424
from __future__ import print_function
25-
import os, sys
25+
import sys
2626
from tools import shared
2727
from subprocess import CalledProcessError
2828

29+
2930
#
3031
# Main run() function
3132
#
@@ -42,15 +43,17 @@ def run():
4243
''', file=sys.stderr)
4344
elif 'cmake' in sys.argv[1]:
4445
node_js = shared.NODE_JS
45-
if type(node_js) is list: node_js = node_js[0]
46+
if type(node_js) is list:
47+
node_js = node_js[0]
4648
node_js = shared.Building.which(node_js)
4749
node_js = node_js.replace('"', '\"')
48-
sys.argv = sys.argv[:2] + ['-DCMAKE_CROSSCOMPILING_EMULATOR="' + node_js +'"'] + sys.argv[2:]
50+
sys.argv = sys.argv[:2] + ['-DCMAKE_CROSSCOMPILING_EMULATOR="' + node_js + '"'] + sys.argv[2:]
4951

5052
try:
5153
shared.Building.configure(sys.argv[1:])
5254
except CalledProcessError as e:
5355
sys.exit(e.returncode)
5456

57+
5558
if __name__ == '__main__':
5659
run()

emlink.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
# University of Illinois/NCSA Open Source License. Both these licenses can be
55
# found in the LICENSE file.
66

7-
'''
8-
Fast static linker for emscripten outputs. Specifically this links asm.js modules.
7+
"""Fast static linker for emscripten outputs. Specifically this links asm.js modules.
98
109
See https://github.com/emscripten-core/emscripten/wiki/Linking
11-
'''
10+
"""
1211

1312
from __future__ import print_function
1413
import sys
1514
from tools import shared
1615
from tools.asm_module import AsmModule
1716

17+
1818
def run():
1919
try:
2020
me, main, side, out = sys.argv[:4]
@@ -34,5 +34,6 @@ def run():
3434
side.relocate_into(main)
3535
main.write(out)
3636

37+
3738
if __name__ == '__main__':
3839
run()

emmake.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
# University of Illinois/NCSA Open Source License. Both these licenses can be
55
# found in the LICENSE file.
66

7-
'''
8-
This is a helper script. It runs make for you, setting
7+
"""This is a helper script. It runs make for you, setting
98
the environment variables to use emcc and so forth. Usage:
109
1110
emmake make [FLAGS]
@@ -20,13 +19,14 @@
2019
emconfigure runs compilation into native code, so
2120
that configure tests pass. emmake uses Emscripten to
2221
generate JavaScript.
23-
'''
22+
"""
2423

2524
from __future__ import print_function
26-
import os, sys
25+
import sys
2726
from tools import shared
2827
from subprocess import CalledProcessError
2928

29+
3030
#
3131
# Main run() function
3232
#
@@ -47,5 +47,6 @@ def run():
4747
except CalledProcessError as e:
4848
sys.exit(e.returncode)
4949

50+
5051
if __name__ == '__main__':
5152
run()

0 commit comments

Comments
 (0)