diff options
author | Peter Kolbus <peter.kolbus@gmail.com> | 2020-11-29 07:57:39 -0600 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-03-09 09:13:05 +0100 |
commit | 12beaa0d3fa050b68dff092520966c63d2f0e437 (patch) | |
tree | 43db9ce6bb831103042cc9c19e56145c7781ce25 /pylint/lint | |
parent | f17007b55e79af1e36d4aad5ec1802fe1ba51662 (diff) | |
download | pylint-git-12beaa0d3fa050b68dff092520966c63d2f0e437.tar.gz |
Add extension-pkg-allow-list option
Add an option extension-pkg-allow-list to the main checker. This is an
alternate name for extension-pkg-whitelist.
Diffstat (limited to 'pylint/lint')
-rw-r--r-- | pylint/lint/pylinter.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py index 502109347..1f7b528a5 100644 --- a/pylint/lint/pylinter.py +++ b/pylint/lint/pylinter.py @@ -367,7 +367,7 @@ class PyLinter( }, ), ( - "extension-pkg-whitelist", + "extension-pkg-allow-list", { "type": "csv", "metavar": "<pkg[,pkg]>", @@ -381,6 +381,21 @@ class PyLinter( }, ), ( + "extension-pkg-whitelist", + { + "type": "csv", + "metavar": "<pkg[,pkg]>", + "default": [], + "help": ( + "A comma-separated list of package or module names" + " from where C extensions may be loaded. Extensions are" + " loading into the active Python interpreter and may run" + " arbitrary code. (This is an alternative name to" + " extension-pkg-allow-list for backward compatibility.)" + ), + }, + ), + ( "suggestion-mode", { "type": "yn", @@ -1106,7 +1121,11 @@ class PyLinter( self.stats = {"by_module": {}, "by_msg": {}} MANAGER.always_load_extensions = self.config.unsafe_load_any_extension MANAGER.max_inferable_values = self.config.limit_inference_results - MANAGER.extension_package_whitelist.update(self.config.extension_pkg_whitelist) + MANAGER.extension_package_whitelist.update(self.config.extension_pkg_allow_list) + if self.config.extension_pkg_whitelist: + MANAGER.extension_package_whitelist.update( + self.config.extension_pkg_whitelist + ) for msg_cat in MSG_TYPES.values(): self.stats[msg_cat] = 0 |