Commit graph

55 commits

Author SHA1 Message Date
epenet 7eda8aafc8
Ignore nested functions when enforcing type hints in tests (#118948) 2024-06-06 10:43:31 +02:00
epenet 0974ea9a5a
Adjust "hass" type hint for test fixtures in pylint plugin (#118548)
Adjust "hass" type hint in pylint plugin
2024-05-31 13:06:49 +02:00
epenet 7e1f4cd3fb
Check fixtures for type hints in pylint plugin (#118313)
* Check fixtures for type hints in pylint plugin

* Apply suggestion
2024-05-31 12:42:42 +02:00
epenet 06251d403a
Fix special case in pylint type hint plugin (#118454)
* Fix special case in pylint type hint plugin

* Simplify

* Simplify

* Simplify

* Apply

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

---------

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2024-05-30 10:41:32 +02:00
epenet 9221eeb2f7
Add check for usefixtures decorator in pylint plugin (#118456) 2024-05-30 08:54:56 +02:00
epenet 05fc7cfbde
Enforce namespace use for import conventions (#118215)
* Enforce namespace use for import conventions

* Include all registries

* Only apply to functions

* Use blacklist

* Rephrase comment

* Add async_entries_for_config_entry

* Typo

* Improve

* More core files

* Revert "More core files"

This reverts commit 9978b93706.

* Revert diagnostics amends

* Include category/floor/label registries

* Performance

* Adjust text
2024-05-28 18:15:53 +02:00
Marc Mueller dace9b32de
Store runtime data inside ConfigEntry (#115669) 2024-04-30 11:29:43 +02:00
Erik Montnemery 0425b7aa6d
Reduce scope of test fixtures for the pylint plugin tests (#116207) 2024-04-29 08:21:31 +02:00
Marc Mueller 3929273b41
Allow float for int argument type [pylint plugin] (#114105) 2024-03-27 11:51:27 +01:00
Joost Lekkerkerker 6bb4e7d62c
Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
Marc Mueller aa16a9d707
Add empty line after module docstring (3) (#112750) 2024-03-08 20:38:34 +01:00
Marc Mueller 19ab3d6daf
Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
Erik Montnemery 3a5e0c14bf
Remove config flow specifics from FlowResult (#111932)
* Remove config flow specifics from FlowResult

* Improve docstring

* Update pylint rules
2024-03-01 13:07:13 +01:00
Erik Montnemery a0e558c457
Add generic classes BaseFlowHandler and BaseFlowManager (#111814)
* Add generic classes BaseFlowHandler and BaseFlowManager

* Migrate zwave_js

* Update tests

* Update tests

* Address review comments
2024-02-29 16:52:39 +01:00
Jan-Philipp Benecke 1c5be598f5
Run pylint sorted platform check also when platform has type annotations (#111407) 2024-02-25 21:18:07 +01:00
Jan-Philipp Benecke 95aea1488d
Add pylint plugin to check if coordinator is placed in its own module (#108174)
* Add pylint plugin to check if coordinator is placed in its own module

* Remove unintended changes

* Remove pylint disable and let CI only fail on W,E,F

* Make check conventional

* Apply review suggestion

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Use option instead

* Remove pylint arguments from pre-commit

* Partially revert "Remove pylint disable and let CI only fail on W,E,F"

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-01-29 10:30:19 +01:00
Jan-Philipp Benecke 28281523ec
Add pylint plugin to check for sorted platforms list (#108115) 2024-01-16 09:47:53 +01:00
Marc Mueller 37288d7788
Add pylint plugin to check for calls to base implementation (#100432) 2023-09-18 13:39:36 -05:00
Marc Mueller 274507b5c9
Fix pylint plugin test DeprecationWarning (#99711) 2023-09-06 11:35:57 +02:00
Marc Mueller 9d9af0c884
Fix pylint DeprecationWarnings (#97627) 2023-08-02 20:30:41 +02:00
epenet c193402ba7
Remove incorrect ignore in pylint plugin (#90024)
* Remove incorrect ignore_missing_annotations

* Allow tuple[int, int] in hs_color

* Adjust notify targets

* Always check for return type inheritance

* Adjust tests

* Revert "Always check for return type inheritance"

This reverts commit 3528742adf98edc6481f2c954c032ace881e1d6e.

* Revert "Allow tuple[int, int] in hs_color"

This reverts commit d51c1731eff3d59b9e94e7a7e914933ceaf8e34f.

* Revert "Adjust notify targets"

This reverts commit 4cba77a7309dc89980e29d6d5b9107d9e55f7070.
2023-03-27 13:53:14 +02:00
epenet c075dac916
Fix pylint plugin for tuple[float, float] returns (#90047) 2023-03-26 19:54:21 +02:00
epenet 6e92dac61f
Adjust pylint plugin for return type inheritance (#90046) 2023-03-26 18:37:26 +02:00
Franck Nijhof ed79265843
Enable Ruff PT006 (#88165)
* Enable Ruff PT006

* Adjust existing cases

* Fix tests

* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
epenet 8f8bdac451
Fix namespace issue in pylint plugin (#87627) 2023-02-07 13:07:21 +01:00
epenet 30bf0634fe
Add per-file-ignore to pylint (#86289) 2023-01-22 17:26:24 +01:00
Franck Nijhof c507ad86d1
Remove str from cover device class (#83396)
* Remove str from cover device class

* Fix tests
2022-12-06 16:13:29 +01:00
epenet 4b813f2460
Adjust pylint plugin for tests directory (#78727)
* Add module_name to parametrize

* Add tests for tests directory

* Apply patch from mib1185

* Adjust plugin to allow imports from component being tested
2022-09-19 14:27:21 +02:00
epenet 0dcbc85684
Adjust relative-import plugin for tests (#78742) 2022-09-19 12:57:07 +02:00
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