Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Code Style Checker #118

Merged
merged 3 commits into from
May 14, 2018
Merged

Adding Code Style Checker #118

merged 3 commits into from
May 14, 2018

Conversation

cdce8p
Copy link
Contributor

@cdce8p cdce8p commented May 8, 2018

Adding static code style checkers can hugely improve the code quality and catch errors sooner. At the moment these test fail completely, so we might have to decide if we want to add it to travis or leave it out for now. If we move forward with this.

@codecov-io
Copy link

codecov-io commented May 9, 2018

Codecov Report

Merging #118 into dev will decrease coverage by 0.1%.
The diff coverage is 40%.

@@            Coverage Diff             @@
##              dev     #118      +/-   ##
==========================================
- Coverage   50.93%   50.82%   -0.11%     
==========================================
  Files          14       14              
  Lines        1337     1332       -5     
  Branches      140      140              
==========================================
- Hits          681      677       -4     
+ Misses        643      642       -1     
  Partials       13       13
Impacted Files Coverage Δ
pyhap/encoder.py 100% <ø> (ø) ⬆️
pyhap/util.py 70.45% <ø> (ø) ⬆️
pyhap/iid_manager.py 100% <ø> (ø) ⬆️
pyhap/loader.py 90% <ø> (ø) ⬆️
pyhap/hap_server.py 26.08% <0%> (ø) ⬆️
pyhap/tlv.py 10.34% <0%> (+0.34%) ⬆️
pyhap/hsrp.py 21.34% <0%> (-0.88%) ⬇️
pyhap/service.py 94.87% <100%> (-0.13%) ⬇️
pyhap/characteristic.py 98.18% <100%> (-0.02%) ⬇️
pyhap/accessory_driver.py 56.27% <100%> (ø) ⬆️
... and 3 more

@cdce8p cdce8p changed the title WIP: Adding Code Style Checker Adding Code Style Checker May 9, 2018
@cdce8p
Copy link
Contributor Author

cdce8p commented May 9, 2018

I excluded some tests for now (mainly docstrings) and fixed many other lint errors. The ones that are still remaining require a bit more attention if I should move forward.

https://travis-ci.org/ikalchev/HAP-python/jobs/376972170#L522-L569

@ikalchev
Copy link
Owner

Sounds very good. The checks are currently passing because of this, can we exclude the failing checks and enable them gradually?

@cdce8p
Copy link
Contributor Author

cdce8p commented May 11, 2018

What do you think about disabling pylint for travis, at least for now?
We can still test it locally with tox.

- python: "3.5"
env: TOXENV=lint
# - python: "3.5"
# env: TOXENV=pylint
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disabled the pylint tests in travis for now, since they require more attention and should be handled separately.
The test suite can be run with tox -e pylint. That will exclude missing-docs.

deps =
-r{toxinidir}/requirements_test.txt
commands =
flake8 pyhap tests --ignore=D10,D205,D4,E501 --exclude=pyhap/accessories/*
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ignores should be removed once the docs pass.
Also the --exclude flag can be removed with #115.

-r{toxinidir}/requirements_all.txt
-r{toxinidir}/requirements_test.txt
commands =
pylint pyhap --disable=missing-docstring,invalid-name,fixme
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here for the --disabled flag.

-r{toxinidir}/requirements_test.txt
commands =
flake8 pyhap tests --select=D10,D205,D4,E501 --exclude=pyhap/accessories/*
pylint pyhap --disable=all --enable=missing-docstring
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run tox -e doc-errors locally to check which docs needs to be fixed.

@cdce8p
Copy link
Contributor Author

cdce8p commented May 12, 2018

@ikalchev This should be ready now if you approve.

@ikalchev ikalchev merged commit eed1d66 into ikalchev:dev May 14, 2018
@cdce8p cdce8p deleted the style-checker branch May 14, 2018 20:25
ikalchev added a commit that referenced this pull request May 18, 2018
* Merge master back into dev (#111)

* Fix typo in log message (#112)

* Fix typo in SDS011

* Documentation improvements for version 2.0.0 (#114)

* Replace event_loop with loop (#107)

* Changelog update (#116)

* Added entry for event loop change

* Additional changes

* Small changes - Accessory (#117)

* Improved bridge.to_HAP

* Updated changelog

* Fix another typo in SDS011 which prevented pm10 from getting updates.

* Added getter_callback to Characteristic #78

* Fix typo bridge.to_HAP (#119)

* Adding Code Style Checker (#118)

* Add basis for style checker

* Fixed lint errors

* Updated changelog

* Improvements 7 - Config class (#120)

Added a State class which keeps Accessory runtime properties such as port, address, paired clients, etc. This state is stored and managed by the driver.

* Remove the pyhap.accessories package. (#115)

* Remove the pyhap.accessories package.

All accessories are temporarily moved to the root accessories folder.
These will be moved into separate repositories as appropriate.

pyhap.accessories is now an implicit namespace package. See
pyhap/accessories/README.md for how others can share their accessories
as HAP-python subpackages.

* Release v2.1.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants