prospector 1.11.0__tar.gz → 1.12.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. {prospector-1.11.0 → prospector-1.12.0}/PKG-INFO +2 -2
  2. {prospector-1.11.0 → prospector-1.12.0}/prospector/blender.py +2 -2
  3. {prospector-1.11.0 → prospector-1.12.0}/prospector/config/configuration.py +3 -2
  4. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profile.py +1 -1
  5. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/mypy/__init__.py +5 -0
  6. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/pylint/__init__.py +2 -2
  7. prospector-1.12.0/prospector/tools/pylint/linter.py +78 -0
  8. {prospector-1.11.0 → prospector-1.12.0}/pyproject.toml +4 -3
  9. {prospector-1.11.0 → prospector-1.12.0}/setup.py +2 -2
  10. prospector-1.11.0/prospector/tools/pylint/linter.py +0 -40
  11. {prospector-1.11.0 → prospector-1.12.0}/LICENSE +0 -0
  12. {prospector-1.11.0 → prospector-1.12.0}/README.rst +0 -0
  13. {prospector-1.11.0 → prospector-1.12.0}/prospector/__init__.py +0 -0
  14. {prospector-1.11.0 → prospector-1.12.0}/prospector/__main__.py +0 -0
  15. {prospector-1.11.0 → prospector-1.12.0}/prospector/autodetect.py +0 -0
  16. {prospector-1.11.0 → prospector-1.12.0}/prospector/blender_combinations.yaml +0 -0
  17. {prospector-1.11.0 → prospector-1.12.0}/prospector/compat.py +0 -0
  18. {prospector-1.11.0 → prospector-1.12.0}/prospector/config/__init__.py +0 -0
  19. {prospector-1.11.0 → prospector-1.12.0}/prospector/config/datatype.py +0 -0
  20. {prospector-1.11.0 → prospector-1.12.0}/prospector/encoding.py +0 -0
  21. {prospector-1.11.0 → prospector-1.12.0}/prospector/exceptions.py +0 -0
  22. {prospector-1.11.0 → prospector-1.12.0}/prospector/finder.py +0 -0
  23. {prospector-1.11.0 → prospector-1.12.0}/prospector/formatters/__init__.py +0 -0
  24. {prospector-1.11.0 → prospector-1.12.0}/prospector/formatters/base.py +0 -0
  25. {prospector-1.11.0 → prospector-1.12.0}/prospector/formatters/emacs.py +0 -0
  26. {prospector-1.11.0 → prospector-1.12.0}/prospector/formatters/grouped.py +0 -0
  27. {prospector-1.11.0 → prospector-1.12.0}/prospector/formatters/json.py +0 -0
  28. {prospector-1.11.0 → prospector-1.12.0}/prospector/formatters/pylint.py +0 -0
  29. {prospector-1.11.0 → prospector-1.12.0}/prospector/formatters/text.py +0 -0
  30. {prospector-1.11.0 → prospector-1.12.0}/prospector/formatters/vscode.py +0 -0
  31. {prospector-1.11.0 → prospector-1.12.0}/prospector/formatters/xunit.py +0 -0
  32. {prospector-1.11.0 → prospector-1.12.0}/prospector/formatters/yaml.py +0 -0
  33. {prospector-1.11.0 → prospector-1.12.0}/prospector/message.py +0 -0
  34. {prospector-1.11.0 → prospector-1.12.0}/prospector/pathutils.py +0 -0
  35. {prospector-1.11.0 → prospector-1.12.0}/prospector/postfilter.py +0 -0
  36. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/__init__.py +0 -0
  37. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/exceptions.py +0 -0
  38. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profiles/default.yaml +0 -0
  39. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profiles/doc_warnings.yaml +0 -0
  40. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profiles/flake8.yaml +0 -0
  41. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profiles/full_pep8.yaml +0 -0
  42. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profiles/member_warnings.yaml +0 -0
  43. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profiles/no_doc_warnings.yaml +0 -0
  44. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profiles/no_member_warnings.yaml +0 -0
  45. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profiles/no_pep8.yaml +0 -0
  46. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profiles/no_test_warnings.yaml +0 -0
  47. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profiles/strictness_high.yaml +0 -0
  48. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profiles/strictness_low.yaml +0 -0
  49. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profiles/strictness_medium.yaml +0 -0
  50. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profiles/strictness_none.yaml +0 -0
  51. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profiles/strictness_veryhigh.yaml +0 -0
  52. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profiles/strictness_verylow.yaml +0 -0
  53. {prospector-1.11.0 → prospector-1.12.0}/prospector/profiles/profiles/test_warnings.yaml +0 -0
  54. {prospector-1.11.0 → prospector-1.12.0}/prospector/run.py +0 -0
  55. {prospector-1.11.0 → prospector-1.12.0}/prospector/suppression.py +0 -0
  56. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/__init__.py +0 -0
  57. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/bandit/__init__.py +0 -0
  58. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/base.py +0 -0
  59. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/dodgy/__init__.py +0 -0
  60. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/exceptions.py +0 -0
  61. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/mccabe/__init__.py +0 -0
  62. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/profile_validator/__init__.py +0 -0
  63. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/pycodestyle/__init__.py +0 -0
  64. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/pydocstyle/__init__.py +0 -0
  65. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/pyflakes/__init__.py +0 -0
  66. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/pylint/collector.py +0 -0
  67. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/pyright/__init__.py +0 -0
  68. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/pyroma/__init__.py +0 -0
  69. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/utils.py +0 -0
  70. {prospector-1.11.0 → prospector-1.12.0}/prospector/tools/vulture/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prospector
3
- Version: 1.11.0
3
+ Version: 1.12.0
4
4
  Summary: Prospector is a tool to analyse Python code by aggregating the result of other tools.
5
5
  Home-page: http://prospector.readthedocs.io
6
6
  License: GPLv2+
@@ -44,7 +44,7 @@ Requires-Dist: pep8-naming (>=0.3.3,<=0.10.0)
44
44
  Requires-Dist: pycodestyle (>=2.9.0)
45
45
  Requires-Dist: pydocstyle (>=2.0.0)
46
46
  Requires-Dist: pyflakes (>=2.2.0,<4)
47
- Requires-Dist: pylint (>=2.8.3,<3.0)
47
+ Requires-Dist: pylint (>=3.0)
48
48
  Requires-Dist: pylint-celery (==0.3)
49
49
  Requires-Dist: pylint-django (>=2.5,<2.6)
50
50
  Requires-Dist: pylint-flask (==0.6)
@@ -4,9 +4,9 @@
4
4
  # the same line. For example, both pyflakes and pylint will generate an
5
5
  # "Unused Import" warning on the same line. This is obviously redundant, so we
6
6
  # remove duplicates.
7
+ import pkgutil
7
8
  from collections import defaultdict
8
9
 
9
- import pkg_resources
10
10
  import yaml
11
11
 
12
12
  __all__ = (
@@ -98,7 +98,7 @@ def blend(messages, blend_combos=None):
98
98
 
99
99
 
100
100
  def get_default_blend_combinations():
101
- combos = yaml.safe_load(pkg_resources.resource_string(__name__, "blender_combinations.yaml"))
101
+ combos = yaml.safe_load(pkgutil.get_data(__name__, "blender_combinations.yaml"))
102
102
  combos = combos.get("combinations", [])
103
103
 
104
104
  defaults = []
@@ -1,5 +1,6 @@
1
1
  # flake8: noqa
2
- import pkg_resources
2
+ import importlib.metadata
3
+
3
4
  import setoptconf as soc
4
5
 
5
6
  from prospector.config.datatype import OutputChoice
@@ -8,7 +9,7 @@ from prospector.tools import DEFAULT_TOOLS, TOOLS
8
9
 
9
10
  __all__ = ("build_manager",)
10
11
 
11
- _VERSION = pkg_resources.get_distribution("prospector").version
12
+ _VERSION = importlib.metadata.version("prospector")
12
13
 
13
14
 
14
15
  def build_manager():
@@ -121,7 +121,7 @@ def _load_content_package(name):
121
121
  file_names = (
122
122
  ["prospector.yaml", "prospector.yml"]
123
123
  if len(name_split) == 1
124
- else [f"{name_split[1]}.yaml", f"{name_split[1]}.yaml"]
124
+ else [f"{name_split[1]}.yaml", f"{name_split[1]}.yml"]
125
125
  )
126
126
 
127
127
  data = None
@@ -21,6 +21,7 @@ VALID_OPTIONS = LIST_OPTIONS + [
21
21
  "python-2-mode",
22
22
  "python-version",
23
23
  "namespace-packages",
24
+ "check-untyped-defs",
24
25
  ]
25
26
 
26
27
 
@@ -90,6 +91,7 @@ class MypyTool(ToolBase):
90
91
  python_version = options.get("python-version", None)
91
92
  strict_optional = options.get("strict-optional", False)
92
93
  namespace_packages = options.get("namespace-packages", False)
94
+ check_untyped_defs = options.get("check-untyped-defs", False)
93
95
 
94
96
  self.options.append(f"--follow-imports={follow_imports}")
95
97
 
@@ -117,6 +119,9 @@ class MypyTool(ToolBase):
117
119
  if namespace_packages:
118
120
  self.options.append("--namespace-packages")
119
121
 
122
+ if check_untyped_defs:
123
+ self.options.append("--check-untyped-defs")
124
+
120
125
  for list_option in LIST_OPTIONS:
121
126
  for entry in options.get(list_option, []):
122
127
  self.options.append(f"--{list_option}-{entry}")
@@ -64,7 +64,7 @@ class PylintTool(ToolBase):
64
64
  continue
65
65
  for option in checker.options:
66
66
  if option[0] in options:
67
- checker.set_option(option[0], options[option[0]])
67
+ checker._arguments_manager.set_option(option[0], options[option[0]])
68
68
 
69
69
  # The warnings about disabling warnings are useful for figuring out
70
70
  # with other tools to suppress messages from. For example, an unused
@@ -167,7 +167,7 @@ class PylintTool(ToolBase):
167
167
  def _get_pylint_configuration(
168
168
  self, check_paths: List[Path], linter: ProspectorLinter, prospector_config, pylint_options
169
169
  ):
170
- self._args = linter.load_command_line_configuration(str(path) for path in check_paths)
170
+ self._args = check_paths
171
171
  linter.load_default_plugins()
172
172
 
173
173
  config_messages = self._prospector_configure(prospector_config, linter)
@@ -0,0 +1,78 @@
1
+ from pathlib import Path
2
+
3
+ from packaging import version as packaging_version
4
+ from pylint import version as pylint_version
5
+ from pylint.config.config_file_parser import _ConfigurationFileParser
6
+ from pylint.config.config_initialization import _order_all_first
7
+ from pylint.lint import PyLinter
8
+ from pylint.utils import _splitstrip, utils
9
+
10
+
11
+ class ProspectorLinter(PyLinter):
12
+ def __init__(self, found_files, *args, **kwargs):
13
+ self._files = found_files
14
+ # set up the standard PyLint linter
15
+ PyLinter.__init__(self, *args, **kwargs)
16
+
17
+ # Largely inspired by https://github.com/pylint-dev/pylint/blob/main/pylint/config/config_initialization.py#L26
18
+ def config_from_file(self, config_file=None):
19
+ """Will return `True` if plugins have been loaded. For pylint>=1.5. Else `False`."""
20
+ config_file_parser = _ConfigurationFileParser(False, self)
21
+ config_data, config_args = config_file_parser.parse_config_file(file_path=config_file)
22
+ if config_data.get("MASTER", {}).get("load-plugins"):
23
+ plugins = _splitstrip(config_data["MASTER"]["load-plugins"])
24
+ self.load_plugin_modules(plugins)
25
+
26
+ config_args = _order_all_first(config_args, joined=False)
27
+
28
+ if "init-hook" in config_data:
29
+ exec(utils._unquote(config_data["init-hook"])) # pylint: disable=exec-used
30
+
31
+ # Load plugins if specified in the config file
32
+ if "load-plugins" in config_data:
33
+ self.load_plugin_modules(utils._splitstrip(config_data["load-plugins"]))
34
+
35
+ self._parse_configuration_file(config_args)
36
+
37
+ # Set the current module to the command line
38
+ # to allow raising messages on it
39
+ self.set_current_module(config_file)
40
+
41
+ self._emit_stashed_messages()
42
+
43
+ # Set the current module to configuration as we don't know where
44
+ # the --load-plugins key is coming from
45
+ self.set_current_module("Command line or configuration file")
46
+
47
+ # We have loaded configuration from config file and command line. Now, we can
48
+ # load plugin specific configuration.
49
+ self.load_plugin_configuration()
50
+
51
+ # Now that plugins are loaded, get list of all fail_on messages, and
52
+ # enable them
53
+ self.enable_fail_on_messages()
54
+
55
+ self._parse_error_mode()
56
+
57
+ # Link the base Namespace object on the current directory
58
+ self._directory_namespaces[Path().resolve()] = (self.config, {})
59
+
60
+ return True
61
+
62
+ def _expand_files(self, modules):
63
+ expanded = super()._expand_files(modules)
64
+ filtered = {}
65
+ # PyLinter._expand_files returns dict since 2.15.7.
66
+ if packaging_version.parse(pylint_version) > packaging_version.parse("2.15.6"):
67
+ for module in expanded:
68
+ if not self._files.is_excluded(Path(module)):
69
+ filtered[module] = expanded[module]
70
+ return filtered
71
+ else:
72
+ for module in expanded:
73
+ # need to de-duplicate, as pylint also walks directories given to it, so it will find
74
+ # files that prospector has already provided and end up checking it more than once
75
+ if not self._files.is_excluded(Path(module["path"])):
76
+ # if the key exists, just overwrite it with the same value, so we don't need an extra if statement
77
+ filtered[module["path"]] = module
78
+ return filtered.values()
@@ -1,11 +1,12 @@
1
1
  [tool.poetry]
2
2
  name = "prospector"
3
- version = "1.11.0"
3
+ version = "1.12.0"
4
4
  description = "Prospector is a tool to analyse Python code by aggregating the result of other tools."
5
5
  authors = ["Carl Crowder <git@carlcrowder.com>"]
6
6
  maintainers = ["Carl Crowder <git@carlcrowder.com>",
7
7
  "Carlos Coelho <carlospecter@gmail.com>",
8
- "Pierre Sassoulas <pierre.sassoulas@gmail.com>"]
8
+ "Pierre Sassoulas <pierre.sassoulas@gmail.com>",
9
+ "Stéphane Brunner <stephane.brunner@gmail.com>"]
9
10
  readme = "README.rst"
10
11
  homepage = "http://prospector.readthedocs.io"
11
12
  repository = "https://github.com/PyCQA/prospector"
@@ -38,7 +39,7 @@ prospector = 'prospector.run:main'
38
39
 
39
40
  [tool.poetry.dependencies]
40
41
  python = ">=3.8.1,<4.0"
41
- pylint = ">=2.8.3,<3.0"
42
+ pylint = ">=3.0"
42
43
  pylint-celery = "0.3"
43
44
  pylint-django = "~2.5"
44
45
  pylint-plugin-utils = "~0.7"
@@ -38,7 +38,7 @@ install_requires = \
38
38
  'pylint-django>=2.5,<2.6',
39
39
  'pylint-flask==0.6',
40
40
  'pylint-plugin-utils>=0.7,<0.8',
41
- 'pylint>=2.8.3,<3.0',
41
+ 'pylint>=3.0',
42
42
  'requirements-detector>=1.2.0',
43
43
  'setoptconf-tmp>=0.3.1,<0.4.0',
44
44
  'toml>=0.10.2,<0.11.0']
@@ -60,7 +60,7 @@ entry_points = \
60
60
 
61
61
  setup_kwargs = {
62
62
  'name': 'prospector',
63
- 'version': '1.11.0',
63
+ 'version': '1.12.0',
64
64
  'description': 'Prospector is a tool to analyse Python code by aggregating the result of other tools.',
65
65
  'long_description': 'prospector\n==========\n\n.. image:: https://img.shields.io/pypi/v/prospector.svg\n :target: https://pypi.python.org/pypi/prospector\n :alt: Latest Version of Prospector\n.. image:: https://github.com/PyCQA/prospector/actions/workflows/tests.yml/badge.svg\n :target: https://github.com/PyCQA/prospector/actions/workflows/tests.yml\n :alt: Build Status\n.. image:: https://img.shields.io/coveralls/PyCQA/prospector.svg?style=flat\n :target: https://coveralls.io/r/PyCQA/prospector\n :alt: Test Coverage\n.. image:: https://readthedocs.org/projects/prospector/badge/?version=latest\n :target: https://prospector.readthedocs.io/\n :alt: Documentation\n\n\nAbout\n-----\n\nProspector is a tool to analyse Python code and output information about\nerrors, potential problems, convention violations and complexity.\n\nIt brings together the functionality of other Python analysis tools such as\n`Pylint <https://docs.pylint.org/>`_,\n`pycodestyle <https://pycodestyle.pycqa.org/>`_,\nand `McCabe complexity <https://pypi.python.org/pypi/mccabe>`_.\nSee the `Supported Tools <https://prospector.readthedocs.io/en/latest/supported_tools.html>`_\ndocumentation section for a complete list.\n\nThe primary aim of Prospector is to be useful \'out of the box\'. A common complaint of other\nPython analysis tools is that it takes a long time to filter through which errors are relevant\nor interesting to your own coding style. Prospector provides some default profiles, which\nhopefully will provide a good starting point and will be useful straight away, and adapts\nthe output depending on the libraries your project uses.\n\nInstallation\n------------\n\nProspector can be installed from PyPI using ``pip`` by running the following command::\n\n pip install prospector\n\nOptional dependencies for Prospector, such as ``pyroma`` can also be installed by running::\n\n pip install prospector[with_pyroma]\n\nSome shells (such as ``Zsh``, the default shell of macOS Catalina) require brackets to be escaped::\n\n pip install prospector\\[with_pyroma\\]\n\nFor a list of all of the optional dependencies, see the optional extras section on the ReadTheDocs\npage on `Supported Tools Extras <https://prospector.readthedocs.io/en/latest/supported_tools.html#optional-extras>`_.\n\nFor local development, `poetry <https://python-poetry.org/>`_ is used. Check out the code, then run::\n\n poetry install\n\nAnd for extras::\n\n poetry install -E with_everything\n\nFor more detailed information on installing the tool, see the\n`installation section <https://prospector.readthedocs.io/en/latest/#installation>`_ of the tool\'s main page\non ReadTheDocs.\n\nDocumentation\n-------------\n\nFull `documentation is available at ReadTheDocs <https://prospector.readthedocs.io>`_.\n\nUsage\n-----\n\nSimply run prospector from the root of your project::\n\n prospector\n\nThis will output a list of messages pointing out potential problems or errors, for example::\n\n prospector.tools.base (prospector/tools/base.py):\n L5:0 ToolBase: pylint - R0922\n Abstract class is only referenced 1 times\n\nOptions\n```````\n\nRun ``prospector --help`` for a full list of options and their effects.\n\nOutput Format\n~~~~~~~~~~~~~\n\nThe default output format of ``prospector`` is designed to be human readable. For parsing\n(for example, for reporting), you can use the ``--output-format json`` flag to get JSON-formatted\noutput.\n\nProfiles\n~~~~~~~~\n\nProspector is configurable using "profiles". These are composable YAML files with directives to\ndisable or enable tools or messages. For more information, read\n`the documentation about profiles <https://prospector.readthedocs.io/en/latest/profiles.html>`_.\n\nIf your code uses frameworks and libraries\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nOften tools such as pylint find errors in code which is not an error, for example due to attributes of classes being\ncreated at run time by a library or framework used by your project.\nFor example, by default, pylint will generate an error for Django models when accessing ``objects``, as the\n``objects`` attribute is not part of the ``Model`` class definition.\n\nProspector mitigates this by providing an understanding of these frameworks to the underlying tools.\n\nProspector will try to intuit which libraries your project uses by\n`detecting dependencies <https://github.com/landscapeio/requirements-detector>`_ and automatically turning on\nsupport for the requisite libraries. You can see which adaptors were run in the metadata section of the report.\n\nIf Prospector does not correctly detect your project\'s dependencies, you can specify them manually from the commandline::\n\n prospector --uses django celery\n\nAdditionally, if Prospector is automatically detecting a library that you do not in fact use, you can turn\noff autodetection completely::\n\n prospector --no-autodetect\n\nNote that as far as possible, these adaptors have been written as plugins or augmentations for the underlying\ntools so that they can be used without requiring Prospector. For example, the Django support is available as a pylint plugin.\n\nStrictness\n~~~~~~~~~~\n\nProspector has a configurable \'strictness\' level which will determine how harshly it searches for errors::\n\n prospector --strictness high\n\nPossible values are ``verylow``, ``low``, ``medium``, ``high``, ``veryhigh``.\n\nProspector does not include documentation warnings by default, but you can turn\nthis on using the ``--doc-warnings`` flag.\n\npre-commit\n----------\n\nIf you\'d like Prospector to be run automatically when making changes to files in your Git\nrepository, you can install `pre-commit <https://pre-commit.com/>`_ and add the following\ntext to your repositories\' ``.pre-commit-config.yaml``::\n\n repos:\n - repo: https://github.com/PyCQA/prospector\n rev: 1.10.0 # The version of Prospector to use, if not \'master\' for latest\n hooks:\n - id: prospector\n\nThis only installs base prospector - if you also use optional tools, for example bandit and/or mypy, then you can add\nthem to the hook configuration like so::\n\n repos:\n - repo: https://github.com/PyCQA/prospector\n rev: 1.10.0\n hooks:\n - id: prospector\n additional_dependencies:\n - ".[with_mypy,with_bandit]"\n - args: [\n \'--with-tool=mypy\',\n \'--with-tool=bandit\',\n ]\n\nAdditional dependencies can be `individually configured <https://prospector.landscape.io/en/master/profiles.html#individual-configuration-options>`_ in your `prospector.yml` file ::\n\n # https://bandit.readthedocs.io/en/latest/config.html\n bandit:\n options:\n skips:\n - B201\n - B601\n - B610\n - B611\n - B703\n\n # https://mypy.readthedocs.io/en/stable/command_line.html\n mypy:\n options:\n ignore-missing-imports: true\n\nFor prospector options which affect display only - those which are not configurable using a profile - these can be\nadded as command line arguments to the hook. For example::\n\n repos:\n - repo: https://github.com/PyCQA/prospector\n rev: 1.10.0\n hooks:\n - id: prospector\n additional_dependencies:\n - ".[with_mypy,with_bandit]"\n args:\n - --with-tool=mypy\n - --with-tool=bandit\n - --summary-only\n - --zero-exit\n\n\n\nLicense\n-------\n\nProspector is available under the GPLv2 License.\n',
66
66
  'author': 'Carl Crowder',
@@ -1,40 +0,0 @@
1
- from pathlib import Path
2
-
3
- from packaging import version as packaging_version
4
- from pylint import version as pylint_version
5
- from pylint.lint import PyLinter
6
- from pylint.utils import _splitstrip
7
-
8
-
9
- class ProspectorLinter(PyLinter):
10
- def __init__(self, found_files, *args, **kwargs):
11
- self._files = found_files
12
- # set up the standard PyLint linter
13
- PyLinter.__init__(self, *args, **kwargs)
14
-
15
- def config_from_file(self, config_file=None):
16
- """Will return `True` if plugins have been loaded. For pylint>=1.5. Else `False`."""
17
- self.read_config_file(config_file)
18
- if self.cfgfile_parser.has_option("MASTER", "load-plugins"):
19
- plugins = _splitstrip(self.cfgfile_parser.get("MASTER", "load-plugins"))
20
- self.load_plugin_modules(plugins)
21
- self.load_config_file()
22
- return True
23
-
24
- def _expand_files(self, modules):
25
- expanded = super()._expand_files(modules)
26
- filtered = {}
27
- # PyLinter._expand_files returns dict since 2.15.7.
28
- if packaging_version.parse(pylint_version) > packaging_version.parse("2.15.6"):
29
- for module in expanded:
30
- if not self._files.is_excluded(Path(module)):
31
- filtered[module] = expanded[module]
32
- return filtered
33
- else:
34
- for module in expanded:
35
- # need to de-duplicate, as pylint also walks directories given to it, so it will find
36
- # files that prospector has already provided and end up checking it more than once
37
- if not self._files.is_excluded(Path(module["path"])):
38
- # if the key exists, just overwrite it with the same value, so we don't need an extra if statement
39
- filtered[module["path"]] = module
40
- return filtered.values()
File without changes
File without changes