ev3dev / ev3dev-lang-python

Pure python bindings for ev3dev
MIT License
425 stars 144 forks source link

flake8 #714

Closed dwalton76 closed 4 years ago

dwalton76 commented 4 years ago

For grins...using this config file

dwalton@laptop:ev3dev-lang-python$ cat .flake8.cfg 
[flake8]
max-line-length = 120 
max-complexity = 40
ignore =
    E203
exclude =
    .git
    ./ev3dev2/auto.py
    ./tests/fake-sys/
dwalton@laptop:ev3dev-lang-python$

here are the issues flake8 says we should clean up

dwalton@laptop:ev3dev-lang-python$ python3 -m flake8 --config=.flake8.cfg .
./git_version.py:2:10: E401 multiple imports on one line
./git_version.py:15:1: E302 expected 2 blank lines, found 1
./git_version.py:22:5: E722 do not use bare 'except'
./git_version.py:31:5: E722 do not use bare 'except'
./ev3dev2/__init__.py:50:1: E402 module level import not at top of file
./ev3dev2/__init__.py:51:1: E402 module level import not at top of file
./ev3dev2/__init__.py:52:1: E402 module level import not at top of file
./ev3dev2/__init__.py:53:1: E402 module level import not at top of file
./ev3dev2/__init__.py:54:1: E402 module level import not at top of file
./ev3dev2/__init__.py:55:1: E402 module level import not at top of file
./ev3dev2/__init__.py:56:1: E402 module level import not at top of file
./ev3dev2/__init__.py:128:9: E722 do not use bare 'except'
./ev3dev2/power.py:31:1: E402 module level import not at top of file
./ev3dev2/sound.py:31:1: E402 module level import not at top of file
./ev3dev2/sound.py:32:1: E402 module level import not at top of file
./ev3dev2/sound.py:33:1: E402 module level import not at top of file
./ev3dev2/sound.py:34:1: E402 module level import not at top of file
./ev3dev2/sound.py:138:43: F841 local variable 'n' is assigned to but never used
./ev3dev2/sound.py:169:121: E501 line too long (178 > 120 characters)
./ev3dev2/sound.py:209:121: E501 line too long (269 > 120 characters)
./ev3dev2/sound.py:214:121: E501 line too long (178 > 120 characters)
./ev3dev2/sound.py:226:121: E501 line too long (178 > 120 characters)
./ev3dev2/sound.py:261:121: E501 line too long (158 > 120 characters)
./ev3dev2/sound.py:291:121: E501 line too long (158 > 120 characters)
./ev3dev2/sound.py:317:121: E501 line too long (166 > 120 characters)
./ev3dev2/sound.py:344:121: E501 line too long (166 > 120 characters)
./ev3dev2/motor.py:28:1: E402 module level import not at top of file
./ev3dev2/motor.py:29:1: E402 module level import not at top of file
./ev3dev2/motor.py:30:1: E402 module level import not at top of file
./ev3dev2/motor.py:31:1: E402 module level import not at top of file
./ev3dev2/motor.py:40:1: E402 module level import not at top of file
./ev3dev2/motor.py:41:1: E402 module level import not at top of file
./ev3dev2/motor.py:42:1: E402 module level import not at top of file
./ev3dev2/motor.py:43:1: E402 module level import not at top of file
./ev3dev2/motor.py:68:5: F401 'ev3dev2._platform.brickpi3.OUTPUT_E' imported but unused
./ev3dev2/motor.py:68:5: F401 'ev3dev2._platform.brickpi3.OUTPUT_F' imported but unused
./ev3dev2/motor.py:68:5: F401 'ev3dev2._platform.brickpi3.OUTPUT_G' imported but unused
./ev3dev2/motor.py:68:5: F401 'ev3dev2._platform.brickpi3.OUTPUT_H' imported but unused
./ev3dev2/motor.py:68:5: F401 'ev3dev2._platform.brickpi3.OUTPUT_I' imported but unused
./ev3dev2/motor.py:68:5: F401 'ev3dev2._platform.brickpi3.OUTPUT_J' imported but unused
./ev3dev2/motor.py:68:5: F401 'ev3dev2._platform.brickpi3.OUTPUT_K' imported but unused
./ev3dev2/motor.py:68:5: F401 'ev3dev2._platform.brickpi3.OUTPUT_L' imported but unused
./ev3dev2/motor.py:68:5: F401 'ev3dev2._platform.brickpi3.OUTPUT_M' imported but unused
./ev3dev2/motor.py:68:5: F401 'ev3dev2._platform.brickpi3.OUTPUT_N' imported but unused
./ev3dev2/motor.py:68:5: F401 'ev3dev2._platform.brickpi3.OUTPUT_O' imported but unused
./ev3dev2/motor.py:68:5: F401 'ev3dev2._platform.brickpi3.OUTPUT_P' imported but unused
./ev3dev2/motor.py:88:5: F401 'ev3dev2._platform.fake.OUTPUT_A' imported but unused
./ev3dev2/motor.py:88:5: F401 'ev3dev2._platform.fake.OUTPUT_B' imported but unused
./ev3dev2/motor.py:88:5: F401 'ev3dev2._platform.fake.OUTPUT_C' imported but unused
./ev3dev2/motor.py:88:5: F401 'ev3dev2._platform.fake.OUTPUT_D' imported but unused
./ev3dev2/motor.py:1162:121: E501 line too long (121 > 120 characters)
./ev3dev2/motor.py:1181:121: E501 line too long (122 > 120 characters)
./ev3dev2/motor.py:2287:1: W293 blank line contains whitespace
./ev3dev2/motor.py:2561:121: E501 line too long (140 > 120 characters)
./ev3dev2/motor.py:2588:121: E501 line too long (129 > 120 characters)
./ev3dev2/button.py:31:1: E402 module level import not at top of file
./ev3dev2/button.py:32:1: E402 module level import not at top of file
./ev3dev2/button.py:33:1: E402 module level import not at top of file
./ev3dev2/button.py:202:1: C901 'If 202' is too complex (53)
./ev3dev2/led.py:31:1: E402 module level import not at top of file
./ev3dev2/led.py:32:1: E402 module level import not at top of file
./ev3dev2/led.py:33:1: E402 module level import not at top of file
./ev3dev2/led.py:34:1: E402 module level import not at top of file
./ev3dev2/led.py:35:1: E402 module level import not at top of file
./ev3dev2/led.py:36:1: E402 module level import not at top of file
./ev3dev2/led.py:37:1: E402 module level import not at top of file
./ev3dev2/led.py:38:1: E402 module level import not at top of file
./ev3dev2/display.py:31:1: E402 module level import not at top of file
./ev3dev2/display.py:32:1: E402 module level import not at top of file
./ev3dev2/display.py:33:1: E402 module level import not at top of file
./ev3dev2/display.py:34:1: E402 module level import not at top of file
./ev3dev2/display.py:35:1: E402 module level import not at top of file
./ev3dev2/display.py:36:1: E402 module level import not at top of file
./ev3dev2/display.py:37:1: E402 module level import not at top of file
./ev3dev2/display.py:38:1: E402 module level import not at top of file
./ev3dev2/fonts/__init__.py:24:9: F841 local variable 'pbm_file' is assigned to but never used
./ev3dev2/control/GyroBalancer.py:417:21: W503 line break before binary operator
./ev3dev2/control/GyroBalancer.py:418:21: W503 line break before binary operator
./ev3dev2/control/GyroBalancer.py:419:21: W503 line break before binary operator
./ev3dev2/control/GyroBalancer.py:420:21: W503 line break before binary operator
./ev3dev2/control/webserver.py:227:38: W605 invalid escape sequence '\?'
./ev3dev2/control/rc_tank.py:11:1: E302 expected 2 blank lines, found 1
./ev3dev2/sensor/__init__.py:31:1: E402 module level import not at top of file
./ev3dev2/sensor/__init__.py:31:1: F401 'numbers' imported but unused
./ev3dev2/sensor/__init__.py:32:1: E402 module level import not at top of file
./ev3dev2/sensor/__init__.py:33:1: E402 module level import not at top of file
./ev3dev2/sensor/__init__.py:34:1: E402 module level import not at top of file
./ev3dev2/sensor/__init__.py:53:5: F401 'ev3dev2._platform.brickpi3.INPUT_5' imported but unused
./ev3dev2/sensor/__init__.py:53:5: F401 'ev3dev2._platform.brickpi3.INPUT_6' imported but unused
./ev3dev2/sensor/__init__.py:53:5: F401 'ev3dev2._platform.brickpi3.INPUT_7' imported but unused
./ev3dev2/sensor/__init__.py:53:5: F401 'ev3dev2._platform.brickpi3.INPUT_8' imported but unused
./ev3dev2/sensor/__init__.py:53:5: F401 'ev3dev2._platform.brickpi3.INPUT_9' imported but unused
./ev3dev2/sensor/__init__.py:53:5: F401 'ev3dev2._platform.brickpi3.INPUT_10' imported but unused
./ev3dev2/sensor/__init__.py:53:5: F401 'ev3dev2._platform.brickpi3.INPUT_11' imported but unused
./ev3dev2/sensor/__init__.py:53:5: F401 'ev3dev2._platform.brickpi3.INPUT_12' imported but unused
./ev3dev2/sensor/__init__.py:53:5: F401 'ev3dev2._platform.brickpi3.INPUT_13' imported but unused
./ev3dev2/sensor/__init__.py:53:5: F401 'ev3dev2._platform.brickpi3.INPUT_14' imported but unused
./ev3dev2/sensor/__init__.py:53:5: F401 'ev3dev2._platform.brickpi3.INPUT_15' imported but unused
./ev3dev2/sensor/__init__.py:53:5: F401 'ev3dev2._platform.brickpi3.INPUT_16' imported but unused
./ev3dev2/sensor/__init__.py:73:5: F401 'ev3dev2._platform.fake.INPUT_1' imported but unused
./ev3dev2/sensor/__init__.py:73:5: F401 'ev3dev2._platform.fake.INPUT_2' imported but unused
./ev3dev2/sensor/__init__.py:73:5: F401 'ev3dev2._platform.fake.INPUT_3' imported but unused
./ev3dev2/sensor/__init__.py:73:5: F401 'ev3dev2._platform.fake.INPUT_4' imported but unused
./ev3dev2/sensor/__init__.py:271:32: E711 comparison to None should be 'if cond is None:'
./ev3dev2/sensor/__init__.py:276:17: E711 comparison to None should be 'if cond is None:'
./ev3dev2/sensor/lego.py:31:1: E402 module level import not at top of file
./ev3dev2/sensor/lego.py:32:1: E402 module level import not at top of file
./ev3dev2/sensor/lego.py:33:1: E402 module level import not at top of file
./ev3dev2/sensor/lego.py:216:1: W293 blank line contains whitespace
./ev3dev2/sensor/lego.py:351:9: E741 ambiguous variable name 'l'
./ev3dev2/sensor/lego.py:356:12: E741 ambiguous variable name 'l'
./ev3dev2/sensor/lego.py:837:1: W293 blank line contains whitespace
./ev3dev2/sensor/lego.py:853:1: W293 blank line contains whitespace
./ev3dev2/sensor/lego.py:872:9: F841 local variable 'old_state' is assigned to but never used
./tests/api_tests.py:2:16: E401 multiple imports on one line
./tests/api_tests.py:11:1: E402 module level import not at top of file
./tests/api_tests.py:12:1: E402 module level import not at top of file
./tests/api_tests.py:14:1: E402 module level import not at top of file
./tests/api_tests.py:15:1: E402 module level import not at top of file
./tests/api_tests.py:16:1: E402 module level import not at top of file
./tests/api_tests.py:33:1: E402 module level import not at top of file
./tests/api_tests.py:44:1: E402 module level import not at top of file
./tests/api_tests.py:45:1: E402 module level import not at top of file
./tests/api_tests.py:130:13: F841 local variable 'd' is assigned to but never used
./tests/api_tests.py:169:13: F841 local variable 'c' is assigned to but never used
./tests/motor/ev3dev_port_logger.py:15:1: E302 expected 2 blank lines, found 1
./tests/motor/motor_motion_unittest.py:13:1: F401 'motor_info.motor_info' imported but unused
./tests/motor/motor_run_direct_unittest.py:13:1: F401 'motor_info.motor_info' imported but unused
./tests/motor/motor_param_unittest.py:8:1: F401 'time' imported but unused
./tests/motor/motor_param_unittest.py:9:1: F401 'sys' imported but unused
./tests/motor/motor_param_unittest.py:596:54: F821 undefined name 'TestTachoMotorStopCommandValue'
./tests/motor/motor_param_unittest.py:597:54: F821 undefined name 'TestTachoMotorStopCommandsValue'
./utils/move_differential.py:9:1: F401 'ev3dev2.unit.DistanceFeet' imported but unused
./utils/move_differential.py:12:1: F401 'sys' imported but unused
./utils/line-follower-find-kp-ki-kd.py:18:1: F401 'time.sleep' imported but unused
./utils/line-follower-find-kp-ki-kd.py:20:1: F401 'sys' imported but unused
./utils/line-follower-find-kp-ki-kd.py:68:9: E722 do not use bare 'except'
./utils/move_motor.py:11:1: F401 'sys' imported but unused
./docs/conf.py:18:1: F401 'shlex' imported but unused
./docs/conf.py:22:1: E402 module level import not at top of file
./docs/conf.py:29:1: E402 module level import not at top of file
./docs/conf.py:30:1: E402 module level import not at top of file
./docs/conf.py:31:1: E402 module level import not at top of file
./docs/conf.py:230:5: E265 block comment should start with '# '
./docs/conf.py:232:5: E265 block comment should start with '# '
./docs/conf.py:234:5: E265 block comment should start with '# '
./docs/conf.py:236:5: E265 block comment should start with '# '
dwalton@laptop:ev3dev-lang-python$ 
WasabiFan commented 4 years ago

It would certainly be nice to clean these up; we could also add it to the CI checks if we got it passing.