Commit Graph

26 Commits

Author SHA1 Message Date
epenet 3941290edc
Force root import of const from other components (#78014)
* Force root import of const from other components

* Add missing commit

* Add tests

* Add tests

* Apply suggestion

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>

* Apply suggestion

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2022-09-14 14:07:57 +02:00
epenet f1c7fb7866
Adjust pylint plugin for relative imports (#78277) 2022-09-14 00:11:57 +02:00
epenet 9fb0b3995c
Adjust pylint checks for notify get_service (#77606)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2022-09-07 09:44:15 +02:00
epenet 8ed689fede
Add new rule to enforce relative imports in pylint (#77358)
* Add new rule to enforce relative imports in pylint

* Early return

* Adjust components
2022-08-29 08:55:32 +02:00
epenet 38ca74b547
Adjust pylint plugin for absolute/relative imports (#77219)
* Adjust pylint plugin for absolute/relative imports

* Adjust components

* One more

* Adjust mqtt

* Adjust mqtt.DOMAIN import

* Adjust internal import

* Add tests for valid local component imports

* Adjust relative path check

* Fixes

* Fixes
2022-08-26 14:27:13 +02:00
epenet fb5a67fb1f
Add vacuum checks to pylint plugin (#76560) 2022-08-18 19:22:08 +02:00
epenet 6243f24b05
Add media-player checks to pylint plugin (#76675)
* Add media-player checks to pylint plugin

* Fix invalid hints

* Add tests

* Adjust tests

* Add extra test

* Adjust regex

* Cleanup comment

* Move media player tests up
2022-08-15 09:48:03 +02:00
epenet 982d197ff3
Add number checks to pylint plugin (#76457)
* Add number checks to pylint plugin

* Adjust ancestor checks

* Add tests

* Add comments in tests
2022-08-10 16:30:58 +02:00
epenet 3eafe13085
Improve UI in pylint plugin (#74157)
* Adjust FlowResult result type

* Adjust tests

* Adjust return_type

* Use StrEnum for base device_class

* Add test for device_class

* Add and use SentinelValues.DEVICE_CLASS

* Remove duplicate device_class

* Cleanup return-type

* Drop inheritance check from device_class

* Add caching for class methods

* Improve tests

* Adjust duplicate checks

* Adjust tests

* Fix rebase
2022-08-02 00:03:52 +02:00
epenet 1a40d400dc
Add function/property name to pylint message (#75913) 2022-08-01 14:09:47 +02:00
Marc Mueller 003fe9220e
Add protocol types for device_tracker `async_see` and `see` (#75891) 2022-07-29 00:27:47 +02:00
epenet 40ee7bab8f
Fix false-positive in pylint plugin (#74244) 2022-07-10 00:31:09 +02:00
epenet 1bfd8b1a76
Add enforce_type_hints to vscode tasks (#74227) 2022-06-30 20:49:41 +02:00
epenet b185de0ac0
Add base Entity to pylint checks (#73902)
* Add base entity properties

* Add special case of Mapping[xxx, Any]

* Add Mapping tests

* Add entity functions

* Adjust docstring

* Add update/async_update
2022-06-27 12:10:31 +02:00
epenet 31af4b709e
Add FanEntity type hint checks to pylint plugin (#73801)
* Add FanEntity type hint checks to pylint plugin

* Add test

* Add test

* Review comments

* Adjust tests

* Rename variable

* also test keyword_only args

* Use docstrings

* Fix tests

* Better return type
2022-06-22 12:48:23 +02:00
epenet 9fd48da132
Add lock checks to pylint type-hint plugin (#73521)
* Add ability to check kwargs type annotation

* Add checks for lock

* Add tests

* Fix components

* Fix spelling

* Revert "Fix components"

This reverts commit 121ff6dc51.

* Adjust comment

* Add comments to TypeHintMatch
2022-06-21 18:53:31 +02:00
epenet 1b8dd3368a
Add checks for lock properties in type-hint plugin (#73729)
* Add checks for lock properties in type-hint plugin

* Adjust comment

* Simplify return-type

* Only check properties when ignore_missing_annotations is disabled

* Adjust tests

* Add comment

* Adjust docstring
2022-06-21 14:36:22 +02:00
epenet 187d56b88b
Add ability to run plugin on unannotated functions (#73520)
* Add ability to run plugin on unannotated functions

* Use options

* Adjust help text

* Add test for the option
2022-06-16 20:12:30 +02:00
epenet ca0a185b32
Enforce config-flow type hints to get options flow (#72831)
* Enforce config-flow type hints to get options flow

* Add checks on return_type

* Fix tests

* Add tests

* Add BinOp to test

* Update tests/pylint/test_enforce_type_hints.py

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>

* Update pylint/plugins/hass_enforce_type_hints.py

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>

* Add TypeHintMatch property

* Update pylint/plugins/hass_enforce_type_hints.py

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2022-06-13 11:14:30 +02:00
epenet 4c7837a576
Enforce type hints for config_flow (#72756)
* Enforce type hints for config_flow

* Keep astroid migration for another PR

* Defer elif case

* Adjust tests

* Use ancestors

* Match on single base_class

* Invert for loops

* Review comments

* slots is new in 3.10
2022-06-01 13:09:53 +02:00
Marc Mueller 4902af2f4e
Fix conftest for pylint plugin (#72777) 2022-06-01 09:22:47 +02:00
epenet cf17169b0e
Refactor type-hint pylint plugin (#72692)
* Cleanup unused variable

* Adjust tests

* Refactor _METHOD_MATCH dict

* Remove duplicate function

* Early exit

* Undo object hint

* METHOD > FUNCTION

* Add comment

* Remove extend

* Remove break

* Extract __any_platform__

* Add tests

* Cache _PLATFORMS

* Adjust tests

* Review comments

* mypy

* shorthand
2022-05-31 11:20:31 +02:00
epenet f25663067c
Enforce type hints on device_automation platform (#72126) 2022-05-23 18:51:40 +02:00
Marc Mueller 53245c6523
Update pylint to 2.13.0 (#68656) 2022-03-25 15:14:48 -07:00
epenet c8504bd21d
Add tests for pylint plugins (#65436)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-02-03 10:01:02 +01:00
epenet 367521e369
Adjust pylint plugin to enforce device_tracker type hints (#64903)
* Adjust pylint plugin to enforce device_tracker type hints

* Use a constant for the type hint matchers

* Add tests

* Add x_of_y match

* Adjust bluetooth_tracker

* Adjust mysensors

* Adjust tile

Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-25 18:21:59 +01:00