raetha / wyzesense2mqtt

Configurable WyzeSense to MQTT Gateway intended for use with Home Assistant or other platforms that use MQTT discovery mechanisms.
MIT License
79 stars 22 forks source link

Resolve most flake8 issues #34

Closed dale3h closed 4 years ago

dale3h commented 4 years ago

Resolve all flake8 issues except for E501 and E722.

pi@wyzesense2mqtt:/etc/wyzesense2mqtt $ flake8 --ignore=E501,W503,E722 .
pi@wyzesense2mqtt:/etc/wyzesense2mqtt $ flake8 .
./wyzesense2mqtt/wyzesense2mqtt.py:383:80: E501 line too long (83 > 79 characters)
./wyzesense2mqtt/wyzesense.py:75:80: E501 line too long (85 > 79 characters)
./wyzesense2mqtt/wyzesense.py:77:80: E501 line too long (92 > 79 characters)
./wyzesense2mqtt/wyzesense.py:142:80: E501 line too long (90 > 79 characters)
./wyzesense2mqtt/wyzesense.py:220:80: E501 line too long (88 > 79 characters)
./wyzesense2mqtt/wyzesense.py:236:80: E501 line too long (81 > 79 characters)
./wyzesense2mqtt/wyzesense.py:238:80: E501 line too long (90 > 79 characters)
./wyzesense2mqtt/wyzesense.py:240:80: E501 line too long (84 > 79 characters)
./wyzesense2mqtt/wyzesense.py:257:80: E501 line too long (84 > 79 characters)
./wyzesense2mqtt/wyzesense.py:271:80: E501 line too long (118 > 79 characters)
./wyzesense2mqtt/wyzesense.py:273:80: E501 line too long (87 > 79 characters)
./wyzesense2mqtt/wyzesense.py:464:80: E501 line too long (86 > 79 characters)
./wyzesense2mqtt/wyzesense.py:469:80: E501 line too long (80 > 79 characters)
./wyzesense2mqtt/wyzesense.py:476:80: E501 line too long (104 > 79 characters)
./wyzesense2mqtt/wyzesense.py:499:9: E722 do not use bare 'except'
./wyzesense2mqtt/wyzesense.py:523:80: E501 line too long (92 > 79 characters)
./wyzesense2mqtt/wyzesense.py:532:80: E501 line too long (94 > 79 characters)
./wyzesense2mqtt/wyzesense.py:552:80: E501 line too long (87 > 79 characters)
./wyzesense2mqtt/wyzesense.py:553:80: E501 line too long (103 > 79 characters)
./wyzesense2mqtt/bridge_tool_cli.py:2:80: E501 line too long (99 > 79 characters)
./wyzesense2mqtt/bridge_tool_cli.py:75:80: E501 line too long (83 > 79 characters)
./wyzesense2mqtt/bridge_tool_cli.py:76:80: E501 line too long (91 > 79 characters)
./wyzesense2mqtt/bridge_tool_cli.py:85:80: E501 line too long (82 > 79 characters)

I am not 100% sure how to address the remaining rules, so I didn't touch them.

raetha commented 4 years ago

@dale3h, nice job, this looks good. I'm not too worried about the line too long, and Github uses 127 characters for the length limit in the web based editor, which is a good baseline. I actually did add automated lint testing using flake8 to all checkins: https://github.com/raetha/wyzesense2mqtt/blob/master/.github/workflows/pythonapp.yaml

It would be good to check that it is configured well, as I did that before I really understood linting.

Otherwise I expect I'll merge this soon.

dale3h commented 4 years ago

Thank you for pointing me in the right direction of the workflow file. I will use these as guidelines for running flake8 locally from now on!

I am not 100% familiar on how to setup checks on all PRs, but is this something that you might be able to do?

raetha commented 4 years ago

I think you might need to add Actions support to your fork of the repository, and then you'll see them on the commits. Since the file is already in place, it should just run. But I'm not sure how to display that in the PR itself, maybe that happens automatically if the associated commits were running it.

Under the Settings section is an Actions tab where you can enable them to run. Give that a try on your fork and see if they show up the next time you commit something.