From 4acfb7a835dea43ead49bea697397e13ff805853 Mon Sep 17 00:00:00 2001 From: Joshua Bishop <13187637+MJoshuaB@users.noreply.github.com> Date: Wed, 16 Oct 2024 10:21:10 +1300 Subject: [PATCH] clean up remaining TODOs --- .../azure-pylint-guidelines-checker/README.md | 6 ++---- .../pylint_guidelines_checker.py | 16 +--------------- .../tests/test_pylint_custom_plugins.py | 8 -------- 3 files changed, 3 insertions(+), 27 deletions(-) diff --git a/tools/pylint-extensions/azure-pylint-guidelines-checker/README.md b/tools/pylint-extensions/azure-pylint-guidelines-checker/README.md index 099abe0bd0d..a4d7b444323 100644 --- a/tools/pylint-extensions/azure-pylint-guidelines-checker/README.md +++ b/tools/pylint-extensions/azure-pylint-guidelines-checker/README.md @@ -96,9 +96,7 @@ In the case of a false positive, use the disable command to remove the pylint er | do-not-log-raised-errors | Do not log errors at `error` or `warning` level when error is raised in an exception block. | pylint:disable=do-not-log-raised-errors | No Link. | | do-not-use-legacy-typing | Do not use legacy (<Python 3.8) type hinting comments | pylint:disable=do-not-use-legacy-typing | No Link. | | do-not-import-asyncio | Do not import asyncio directly. | pylint:disable=do-not-import-asyncio | No Link. | -| invalid-use-of-overload | Do not mix async and synchronous overloads | pylint:disable=invalid-use-of-overload | No Link. | | Add a check for connection_verify hardcoded settings #35355 | | | +| invalid-use-of-overload | Do not mix async and synchronous overloads | pylint:disable=invalid-use-of-overload | No Link. | | do-not-hardcode-connection-verify | Do not hardcode a boolean value to connection_verify | pylint:disable=do-not-hardcode-connection-verify | No LInk. | -| TODO | custom linter check for invalid use of @overload #3229 | | | | do-not-log-exceptions | Do not log exceptions in levels other than debug, otherwise it can reveal sensitive information | pylint:disable=do-not-log-exceptions | [link](https://azure.github.io/azure-sdk/python_implementation.html#python-logging-sensitive-info) | -| unapproved-client-method-name-prefix | Clients should use preferred verbs for method names | pylint:disable=unapproved-client-method-name-prefix | [link](https://azure.github.io/azure-sdk/python_design.html#naming) | -| TODO | Address Commented out Pylint Custom Plugin Checkers #3228 | | | +| unapproved-client-method-name-prefix | Clients should use preferred verbs for method names | pylint:disable=unapproved-client-method-name-prefix | [link](https://azure.github.io/azure-sdk/python_design.html#naming) | \ No newline at end of file diff --git a/tools/pylint-extensions/azure-pylint-guidelines-checker/pylint_guidelines_checker.py b/tools/pylint-extensions/azure-pylint-guidelines-checker/pylint_guidelines_checker.py index 531539b55f6..ccc024a91b0 100644 --- a/tools/pylint-extensions/azure-pylint-guidelines-checker/pylint_guidelines_checker.py +++ b/tools/pylint-extensions/azure-pylint-guidelines-checker/pylint_guidelines_checker.py @@ -2817,12 +2817,6 @@ def visit_import(self, node): ) except: pass -# [Pylint] custom linter check for invalid use of @overload #3229 -# [Pylint] Custom Linter check for Exception Logging #3227 -# [Pylint] Address Commented out Pylint Custom Plugin Checkers #3228 -# [Pylint] Add a check for connection_verify hardcoded settings #35355 -# [Pylint] Refactor test suite for custom pylint checkers to use files instead of docstrings #3233 -# [Pylint] Investigate pylint rule around missing dependency #3231 class DoNotUseLegacyTyping(BaseChecker): @@ -2886,6 +2880,7 @@ def visit_import(self, node): class InvalidUseOfOverload(BaseChecker): + """Rule to check that use of the @overload decorator matches the async/sync nature of the underlying function""" name = "invalid-use-of-overload" @@ -3014,9 +3009,6 @@ def check_for_logging(self, node, exception_name): self.check_for_logging(j.orelse, exception_name) -# [Pylint] Address Commented out Pylint Custom Plugin Checkers #3228 - - class DoNotHardcodeConnectionVerify(BaseChecker): """Rule to check that developers do not hardcode a boolean to connection_verify.""" @@ -3088,10 +3080,6 @@ def visit_annassign(self, node): pass - -# [Pylint] Investigate pylint rule around missing dependency #3231 - - # if a linter is registered in this function then it will be checked with pylint def register(linter): linter.register_checker(ClientsDoNotUseStaticMethods(linter)) @@ -3130,9 +3118,7 @@ def register(linter): linter.register_checker(InvalidUseOfOverload(linter)) linter.register_checker(DoNotLogExceptions(linter)) - # [Pylint] Address Commented out Pylint Custom Plugin Checkers #3228 linter.register_checker(DoNotHardcodeConnectionVerify(linter)) - # [Pylint] Investigate pylint rule around missing dependency #3231 # disabled by default, use pylint --enable=check-docstrings if you want to use it linter.register_checker(CheckDocstringParameters(linter)) diff --git a/tools/pylint-extensions/azure-pylint-guidelines-checker/tests/test_pylint_custom_plugins.py b/tools/pylint-extensions/azure-pylint-guidelines-checker/tests/test_pylint_custom_plugins.py index adbe1fcb3ae..b1d95b7f315 100644 --- a/tools/pylint-extensions/azure-pylint-guidelines-checker/tests/test_pylint_custom_plugins.py +++ b/tools/pylint-extensions/azure-pylint-guidelines-checker/tests/test_pylint_custom_plugins.py @@ -3767,9 +3767,6 @@ def test_guidelines_link_active(self): assert response.http_response.status_code == 200 -# [Pylint] Address Commented out Pylint Custom Plugin Checkers #3228 - - class TestDoNotHardcodeConnectionVerify(pylint.testutils.CheckerTestCase): """Test that we are not hard-coding a True or False to connection_verify""" @@ -3904,8 +3901,3 @@ def test_invalid_connection_verify(self): self.checker.visit_annassign(annotated_assignment) self.checker.visit_annassign(annotated_self_assignment) - - -# [Pylint] Refactor test suite for custom pylint checkers to use files instead of docstrings #3233 -# [Pylint] Investigate pylint rule around missing dependency #3231 -