diff options
author | Adrien Ferrand <adferrand@users.noreply.github.com> | 2021-11-30 00:24:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-30 00:24:39 +0300 |
commit | aeb7beb1b1d7ef6b520fbcd4a67c44787920aad6 (patch) | |
tree | 2732432dfe01f1f3866c3cc6fbcda8a58951614a /linter_plugin.py | |
parent | 0d10a44f4bd7a6cbd9dbc59d905876e9b0a6ca1b (diff) |
Fully type certbot-ci module (#9120)
* Fully type certbot-ci module
* Fix lint, focus lint
* Add trailing comma
* Remove unused private function
* Type properly for future usages
* Update certbot-ci/certbot_integration_tests/utils/acme_server.py
Co-authored-by: alexzorin <alex@zor.io>
* Cleanup files
* Fix import
* Fix mypy and lint
Co-authored-by: alexzorin <alex@zor.io>
Diffstat (limited to 'linter_plugin.py')
-rw-r--r-- | linter_plugin.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/linter_plugin.py b/linter_plugin.py index a19bf7df9..1eb13ffcf 100644 --- a/linter_plugin.py +++ b/linter_plugin.py @@ -6,12 +6,18 @@ deprecated modules. You can check its behavior as a reference to what is coded h See https://github.com/PyCQA/pylint/blob/b20a2984c94e2946669d727dbda78735882bf50a/pylint/checkers/imports.py#L287 See https://docs.pytest.org/en/latest/writing_plugins.html """ +import os.path +import re + from pylint.checkers import BaseChecker from pylint.interfaces import IAstroidChecker -# Modules in theses packages can import the os module. -WHITELIST_PACKAGES = [ - 'acme', 'certbot_integration_tests', 'certbot_compatibility_test', 'lock_test' +# Modules whose file is matching one of these paths can import the os module. +WHITELIST_PATHS = [ + '/acme/acme/', + '/certbot-ci/', + '/certbot-compatibility-test/', + '/tests/lock_test', ] @@ -50,5 +56,5 @@ def register(linter): def _check_disabled(node): module = node.root() - return any(package for package in WHITELIST_PACKAGES - if module.name.startswith(package + '.') or module.name == package) + return any(path for path in WHITELIST_PATHS + if os.path.normpath(path) in os.path.normpath(module.file)) |