prospector 1.16.1__tar.gz → 1.17.2__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 (75) hide show
  1. {prospector-1.16.1 → prospector-1.17.2}/PKG-INFO +48 -44
  2. {prospector-1.16.1 → prospector-1.17.2}/README.rst +21 -21
  3. {prospector-1.16.1 → prospector-1.17.2}/prospector/blender_combinations.yaml +16 -0
  4. {prospector-1.16.1 → prospector-1.17.2}/prospector/config/configuration.py +2 -2
  5. {prospector-1.16.1 → prospector-1.17.2}/prospector/formatters/__init__.py +2 -1
  6. prospector-1.17.2/prospector/formatters/gitlab.py +52 -0
  7. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profile.py +1 -3
  8. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profiles/strictness_veryhigh.yaml +1 -1
  9. {prospector-1.16.1 → prospector-1.17.2}/prospector/run.py +3 -3
  10. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/mypy/__init__.py +38 -3
  11. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/pyright/__init__.py +1 -1
  12. prospector-1.17.2/pyproject.toml +130 -0
  13. prospector-1.16.1/pyproject.toml +0 -109
  14. prospector-1.16.1/setup.py +0 -80
  15. {prospector-1.16.1 → prospector-1.17.2}/LICENSE +0 -0
  16. {prospector-1.16.1 → prospector-1.17.2}/prospector/__init__.py +0 -0
  17. {prospector-1.16.1 → prospector-1.17.2}/prospector/__main__.py +0 -0
  18. {prospector-1.16.1 → prospector-1.17.2}/prospector/autodetect.py +0 -0
  19. {prospector-1.16.1 → prospector-1.17.2}/prospector/blender.py +0 -0
  20. {prospector-1.16.1 → prospector-1.17.2}/prospector/compat.py +0 -0
  21. {prospector-1.16.1 → prospector-1.17.2}/prospector/config/__init__.py +0 -0
  22. {prospector-1.16.1 → prospector-1.17.2}/prospector/config/datatype.py +0 -0
  23. {prospector-1.16.1 → prospector-1.17.2}/prospector/encoding.py +0 -0
  24. {prospector-1.16.1 → prospector-1.17.2}/prospector/exceptions.py +0 -0
  25. {prospector-1.16.1 → prospector-1.17.2}/prospector/finder.py +0 -0
  26. {prospector-1.16.1 → prospector-1.17.2}/prospector/formatters/base.py +0 -0
  27. {prospector-1.16.1 → prospector-1.17.2}/prospector/formatters/base_summary.py +0 -0
  28. {prospector-1.16.1 → prospector-1.17.2}/prospector/formatters/emacs.py +0 -0
  29. {prospector-1.16.1 → prospector-1.17.2}/prospector/formatters/grouped.py +0 -0
  30. {prospector-1.16.1 → prospector-1.17.2}/prospector/formatters/json.py +0 -0
  31. {prospector-1.16.1 → prospector-1.17.2}/prospector/formatters/pylint.py +0 -0
  32. {prospector-1.16.1 → prospector-1.17.2}/prospector/formatters/pylint_parseable.py +0 -0
  33. {prospector-1.16.1 → prospector-1.17.2}/prospector/formatters/text.py +0 -0
  34. {prospector-1.16.1 → prospector-1.17.2}/prospector/formatters/vscode.py +0 -0
  35. {prospector-1.16.1 → prospector-1.17.2}/prospector/formatters/xunit.py +0 -0
  36. {prospector-1.16.1 → prospector-1.17.2}/prospector/formatters/yaml.py +0 -0
  37. {prospector-1.16.1 → prospector-1.17.2}/prospector/identify.py +0 -0
  38. {prospector-1.16.1 → prospector-1.17.2}/prospector/message.py +0 -0
  39. {prospector-1.16.1 → prospector-1.17.2}/prospector/pathutils.py +0 -0
  40. {prospector-1.16.1 → prospector-1.17.2}/prospector/postfilter.py +0 -0
  41. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/__init__.py +0 -0
  42. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/exceptions.py +0 -0
  43. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profiles/default.yaml +0 -0
  44. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profiles/doc_warnings.yaml +0 -0
  45. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profiles/flake8.yaml +0 -0
  46. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profiles/full_pep8.yaml +0 -0
  47. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profiles/member_warnings.yaml +0 -0
  48. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profiles/no_doc_warnings.yaml +0 -0
  49. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profiles/no_member_warnings.yaml +0 -0
  50. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profiles/no_pep8.yaml +0 -0
  51. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profiles/no_test_warnings.yaml +0 -0
  52. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profiles/strictness_high.yaml +0 -0
  53. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profiles/strictness_low.yaml +0 -0
  54. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profiles/strictness_medium.yaml +0 -0
  55. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profiles/strictness_none.yaml +0 -0
  56. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profiles/strictness_verylow.yaml +0 -0
  57. {prospector-1.16.1 → prospector-1.17.2}/prospector/profiles/profiles/test_warnings.yaml +0 -0
  58. {prospector-1.16.1 → prospector-1.17.2}/prospector/suppression.py +0 -0
  59. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/__init__.py +0 -0
  60. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/bandit/__init__.py +0 -0
  61. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/base.py +0 -0
  62. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/dodgy/__init__.py +0 -0
  63. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/exceptions.py +0 -0
  64. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/mccabe/__init__.py +0 -0
  65. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/profile_validator/__init__.py +0 -0
  66. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/pycodestyle/__init__.py +0 -0
  67. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/pydocstyle/__init__.py +0 -0
  68. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/pyflakes/__init__.py +0 -0
  69. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/pylint/__init__.py +0 -0
  70. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/pylint/collector.py +0 -0
  71. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/pylint/linter.py +0 -0
  72. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/pyroma/__init__.py +0 -0
  73. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/ruff/__init__.py +0 -0
  74. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/utils.py +0 -0
  75. {prospector-1.16.1 → prospector-1.17.2}/prospector/tools/vulture/__init__.py +0 -0
@@ -1,43 +1,41 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: prospector
3
- Version: 1.16.1
3
+ Version: 1.17.2
4
4
  Summary: Prospector is a tool to analyse Python code by aggregating the result of other tools.
5
- Home-page: http://prospector.readthedocs.io
6
5
  License: GPLv2+
7
- Keywords: pylint,prospector,static code analysis
6
+ Keywords: prospector,pylint,static code analysis
8
7
  Author: Carl Crowder
9
8
  Author-email: git@carlcrowder.com
10
9
  Maintainer: Carl Crowder
11
10
  Maintainer-email: git@carlcrowder.com
12
- Requires-Python: >=3.9,<4.0
11
+ Requires-Python: >=3.9
13
12
  Classifier: Development Status :: 5 - Production/Stable
14
13
  Classifier: Environment :: Console
15
14
  Classifier: Intended Audience :: Developers
16
15
  Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
17
- Classifier: License :: Other/Proprietary License
18
16
  Classifier: Operating System :: Unix
19
- Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
20
18
  Classifier: Programming Language :: Python :: 3.9
21
19
  Classifier: Programming Language :: Python :: 3.10
22
- Classifier: Programming Language :: Python :: 3.10
23
20
  Classifier: Programming Language :: Python :: 3.11
24
21
  Classifier: Programming Language :: Python :: 3.12
25
22
  Classifier: Programming Language :: Python :: 3.13
26
- Classifier: Programming Language :: Python :: 3.9
27
23
  Classifier: Topic :: Software Development :: Quality Assurance
28
- Provides-Extra: with_bandit
29
- Provides-Extra: with_everything
30
- Provides-Extra: with_mypy
31
- Provides-Extra: with_pyright
32
- Provides-Extra: with_pyroma
33
- Provides-Extra: with_ruff
34
- Provides-Extra: with_vulture
24
+ Provides-Extra: with-bandit
25
+ Provides-Extra: with-everything
26
+ Provides-Extra: with-mypy
27
+ Provides-Extra: with-pyright
28
+ Provides-Extra: with-pyroma
29
+ Provides-Extra: with-ruff
30
+ Provides-Extra: with-vulture
35
31
  Requires-Dist: GitPython (>=3.1.27,<4.0.0)
36
32
  Requires-Dist: PyYAML
37
- Requires-Dist: bandit (>=1.5.1); extra == "with_bandit" or extra == "with_everything"
33
+ Requires-Dist: bandit ; extra == "with-bandit"
34
+ Requires-Dist: bandit ; extra == "with-everything"
38
35
  Requires-Dist: dodgy (>=0.2.1,<0.3.0)
39
36
  Requires-Dist: mccabe (>=0.7.0,<0.8.0)
40
- Requires-Dist: mypy (>=0.600); extra == "with_mypy" or extra == "with_everything"
37
+ Requires-Dist: mypy ; extra == "with-everything"
38
+ Requires-Dist: mypy ; extra == "with-mypy"
41
39
  Requires-Dist: packaging
42
40
  Requires-Dist: pep8-naming (>=0.3.3,<=0.10.0)
43
41
  Requires-Dist: pycodestyle (>=2.9.0)
@@ -46,14 +44,20 @@ Requires-Dist: pyflakes (>=2.2.0)
46
44
  Requires-Dist: pylint (>=3.0)
47
45
  Requires-Dist: pylint-celery (==0.3)
48
46
  Requires-Dist: pylint-django (>=2.6.1)
49
- Requires-Dist: pyright (>=1.1.3); extra == "with_pyright" or extra == "with_everything"
50
- Requires-Dist: pyroma (>=2.4); extra == "with_pyroma" or extra == "with_everything"
47
+ Requires-Dist: pyright ; extra == "with-everything"
48
+ Requires-Dist: pyright ; extra == "with-pyright"
49
+ Requires-Dist: pyroma ; extra == "with-everything"
50
+ Requires-Dist: pyroma ; extra == "with-pyroma"
51
51
  Requires-Dist: requirements-detector (>=1.3.2)
52
- Requires-Dist: ruff; extra == "with_ruff" or extra == "with_everything"
52
+ Requires-Dist: ruff ; extra == "with-everything"
53
+ Requires-Dist: ruff ; extra == "with-ruff"
53
54
  Requires-Dist: setoptconf-tmp (>=0.3.1,<0.4.0)
54
55
  Requires-Dist: toml (>=0.10.2,<0.11.0)
55
- Requires-Dist: vulture (>=1.5); extra == "with_vulture" or extra == "with_everything"
56
- Project-URL: Repository, https://github.com/PyCQA/prospector
56
+ Requires-Dist: vulture ; extra == "with-everything"
57
+ Requires-Dist: vulture ; extra == "with-vulture"
58
+ Project-URL: Bug Tracker, https://github.com/prospector-dev/prospector/issues
59
+ Project-URL: Homepage, http://prospector.readthedocs.io
60
+ Project-URL: Repository, https://github.com/prospector-dev/prospector
57
61
  Description-Content-Type: text/x-rst
58
62
 
59
63
  prospector
@@ -205,22 +209,22 @@ repository, you can install `pre-commit <https://pre-commit.com/>`_ and add the
205
209
  text to your repositories' ``.pre-commit-config.yaml``::
206
210
 
207
211
  repos:
208
- - repo: https://github.com/PyCQA/prospector
209
- rev: 1.10.0 # The version of Prospector to use, if not 'master' for latest
210
- hooks:
211
- - id: prospector
212
+ - repo: https://github.com/PyCQA/prospector
213
+ rev: v1.16.1 # The version of Prospector to use, if not 'master' for latest
214
+ hooks:
215
+ - id: prospector
212
216
 
213
217
  This only installs base prospector - if you also use optional tools, for example bandit and/or mypy, then you can add
214
218
  them to the hook configuration like so::
215
219
 
216
220
  repos:
217
- - repo: https://github.com/PyCQA/prospector
218
- rev: 1.10.0
219
- hooks:
220
- - id: prospector
221
- additional_dependencies:
221
+ - repo: https://github.com/PyCQA/prospector
222
+ rev: v1.16.1
223
+ hooks:
224
+ - id: prospector
225
+ additional_dependencies:
222
226
  - ".[with_mypy,with_bandit]"
223
- - args: [
227
+ args: [
224
228
  '--with-tool=mypy',
225
229
  '--with-tool=bandit',
226
230
  ]
@@ -246,17 +250,17 @@ For prospector options which affect display only - those which are not configura
246
250
  added as command line arguments to the hook. For example::
247
251
 
248
252
  repos:
249
- - repo: https://github.com/PyCQA/prospector
250
- rev: 1.10.0
251
- hooks:
252
- - id: prospector
253
- additional_dependencies:
254
- - ".[with_mypy,with_bandit]"
255
- args:
256
- - --with-tool=mypy
257
- - --with-tool=bandit
258
- - --summary-only
259
- - --zero-exit
253
+ - repo: https://github.com/PyCQA/prospector
254
+ rev: v1.16.1
255
+ hooks:
256
+ - id: prospector
257
+ additional_dependencies:
258
+ - ".[with_mypy,with_bandit]"
259
+ args:
260
+ - --with-tool=mypy
261
+ - --with-tool=bandit
262
+ - --summary-only
263
+ - --zero-exit
260
264
 
261
265
 
262
266
 
@@ -147,22 +147,22 @@ repository, you can install `pre-commit <https://pre-commit.com/>`_ and add the
147
147
  text to your repositories' ``.pre-commit-config.yaml``::
148
148
 
149
149
  repos:
150
- - repo: https://github.com/PyCQA/prospector
151
- rev: 1.10.0 # The version of Prospector to use, if not 'master' for latest
152
- hooks:
153
- - id: prospector
150
+ - repo: https://github.com/PyCQA/prospector
151
+ rev: v1.16.1 # The version of Prospector to use, if not 'master' for latest
152
+ hooks:
153
+ - id: prospector
154
154
 
155
155
  This only installs base prospector - if you also use optional tools, for example bandit and/or mypy, then you can add
156
156
  them to the hook configuration like so::
157
157
 
158
158
  repos:
159
- - repo: https://github.com/PyCQA/prospector
160
- rev: 1.10.0
161
- hooks:
162
- - id: prospector
163
- additional_dependencies:
159
+ - repo: https://github.com/PyCQA/prospector
160
+ rev: v1.16.1
161
+ hooks:
162
+ - id: prospector
163
+ additional_dependencies:
164
164
  - ".[with_mypy,with_bandit]"
165
- - args: [
165
+ args: [
166
166
  '--with-tool=mypy',
167
167
  '--with-tool=bandit',
168
168
  ]
@@ -188,17 +188,17 @@ For prospector options which affect display only - those which are not configura
188
188
  added as command line arguments to the hook. For example::
189
189
 
190
190
  repos:
191
- - repo: https://github.com/PyCQA/prospector
192
- rev: 1.10.0
193
- hooks:
194
- - id: prospector
195
- additional_dependencies:
196
- - ".[with_mypy,with_bandit]"
197
- args:
198
- - --with-tool=mypy
199
- - --with-tool=bandit
200
- - --summary-only
201
- - --zero-exit
191
+ - repo: https://github.com/PyCQA/prospector
192
+ rev: v1.16.1
193
+ hooks:
194
+ - id: prospector
195
+ additional_dependencies:
196
+ - ".[with_mypy,with_bandit]"
197
+ args:
198
+ - --with-tool=mypy
199
+ - --with-tool=bandit
200
+ - --summary-only
201
+ - --zero-exit
202
202
 
203
203
 
204
204
 
@@ -1347,3 +1347,19 @@ combinations:
1347
1347
  - ruff: D419
1348
1348
  - pycodestyle: D419
1349
1349
  - pep257: D419
1350
+
1351
+ - # Use lazy % formatting in logging functions
1352
+ - pylint: logging-fstring-interpolation
1353
+ - ruff: G004
1354
+
1355
+ - # No name '{}' in module '{}'
1356
+ - pylint: no-name-in-module
1357
+ - mypy: attr-defined
1358
+
1359
+ - # Module '{}' has no '{}' member
1360
+ - pylint: no-member
1361
+ - mypy: attr-defined
1362
+
1363
+ - # Missing return type annotation for public function `{}` [Fix applicability: unsafe]
1364
+ - ruff: ANN201
1365
+ - mypy: no-untyped-def
@@ -178,11 +178,11 @@ def build_command_line_source(
178
178
  },
179
179
  "messages_only": {
180
180
  "flags": ["-M", "--messages-only"],
181
- "help": "Only output message information (don't output summary" " information about the checks)",
181
+ "help": "Only output message information (don't output summary information about the checks)",
182
182
  },
183
183
  "summary_only": {
184
184
  "flags": ["-S", "--summary-only"],
185
- "help": "Only output summary information about the checks (don't" "output message information)",
185
+ "help": "Only output summary information about the checks (don't output message information)",
186
186
  },
187
187
  "output_format": {
188
188
  "flags": ["-o", "--output-format"],
@@ -1,4 +1,4 @@
1
- from . import emacs, grouped, json, pylint, pylint_parseable, text, vscode, xunit, yaml
1
+ from . import emacs, gitlab, grouped, json, pylint, pylint_parseable, text, vscode, xunit, yaml
2
2
  from .base import Formatter
3
3
 
4
4
  __all__ = ("FORMATTERS", "Formatter")
@@ -7,6 +7,7 @@ __all__ = ("FORMATTERS", "Formatter")
7
7
  FORMATTERS: dict[str, type[Formatter]] = {
8
8
  "json": json.JsonFormatter,
9
9
  "text": text.TextFormatter,
10
+ "gitlab": gitlab.GitlabFormatter,
10
11
  "grouped": grouped.GroupedFormatter,
11
12
  "emacs": emacs.EmacsFormatter,
12
13
  "yaml": yaml.YamlFormatter,
@@ -0,0 +1,52 @@
1
+ import hashlib
2
+ import json
3
+ from typing import Any
4
+
5
+ from prospector.formatters.base import Formatter
6
+
7
+ __all__ = ("GitlabFormatter",)
8
+
9
+
10
+ class GitlabFormatter(Formatter):
11
+ """
12
+ This formatter outputs messages in the GitLab Code Quality report format.
13
+ https://docs.gitlab.com/ci/testing/code_quality/#code-quality-report-format
14
+ """
15
+
16
+ def render(self, summary: bool = True, messages: bool = True, profile: bool = False) -> str:
17
+ output: list[dict[str, Any]] = []
18
+ fingerprints = set()
19
+
20
+ if messages:
21
+ for message in sorted(self.messages):
22
+ # Make sure that we do not get a fingerprint that is already in use
23
+ # by adding in the previously generated one.
24
+ message_hash = ":".join([str(message.location.path), str(message.location.line), message.code])
25
+ sha256_hash = hashlib.sha256(message_hash.encode())
26
+ MAX_ITERATIONS = 1000
27
+ iteration_count = 0
28
+ while sha256_hash.hexdigest() in fingerprints:
29
+ # In cases of hash collisions, new hashes will be generated.
30
+ sha256_hash.update(sha256_hash.hexdigest().encode())
31
+ iteration_count += 1
32
+ if iteration_count > MAX_ITERATIONS:
33
+ raise RuntimeError("Maximum iteration limit reached while resolving hash collisions.")
34
+
35
+ fingerprint = sha256_hash.hexdigest()
36
+ fingerprints.add(fingerprint)
37
+
38
+ output.append(
39
+ {
40
+ "type": "issue",
41
+ "check_name": message.code,
42
+ "description": f"{message.source}[{message.code}]: {message.message.strip()}",
43
+ "severity": "major",
44
+ "location": {
45
+ "path": str(self._make_path(message.location)),
46
+ "lines": {"begin": message.location.line, "end": message.location.line_end},
47
+ },
48
+ "fingerprint": fingerprint,
49
+ }
50
+ )
51
+
52
+ return json.dumps(output, indent=2)
@@ -25,9 +25,7 @@ class ProspectorProfile:
25
25
  self.output_format = profile_dict.get("output-format")
26
26
  self.output_target = profile_dict.get("output-target")
27
27
  self.autodetect = profile_dict.get("autodetect", True)
28
- self.uses = [
29
- uses for uses in _ensure_list(profile_dict.get("uses", [])) if uses in ("django", "celery")
30
- ]
28
+ self.uses = [uses for uses in _ensure_list(profile_dict.get("uses", [])) if uses in ("django", "celery")]
31
29
  self.max_line_length = profile_dict.get("max-line-length")
32
30
 
33
31
  # informational shorthands
@@ -40,5 +40,5 @@ pydocstyle:
40
40
  - D000
41
41
 
42
42
  mypy:
43
- options:
43
+ options:
44
44
  strict: true
@@ -104,10 +104,10 @@ class Prospector:
104
104
  messages.append(Message(toolname, "hidden-output", loc, message=msg))
105
105
 
106
106
  except FatalProspectorException as fatal:
107
- sys.stderr.write(str(fatal))
107
+ sys.stderr.write(f"FatalProspectorException: {str(fatal)}")
108
108
  sys.exit(2)
109
109
 
110
- except Exception as ex: # pylint:disable=broad-except
110
+ except (SystemExit, Exception) as ex: # pylint:disable=broad-except
111
111
  if self.config.die_on_tool_error:
112
112
  raise FatalProspectorException(f"Tool {toolname} failed to run.") from ex
113
113
  loc = Location(self.config.workdir, None, None, None, None)
@@ -198,7 +198,7 @@ def main() -> None:
198
198
 
199
199
  paths = config.paths
200
200
  if len(paths) > 1 and not all(os.path.isfile(path) for path in paths):
201
- sys.stderr.write("\nIn multi-path mode, all inputs must be files, not directories.\n\n")
201
+ sys.stderr.write(f"\nIn multi-path mode, all inputs must be files, not directories, for {paths}.\n\n")
202
202
  get_parser().print_usage()
203
203
  sys.exit(2)
204
204
 
@@ -125,11 +125,46 @@ class MypyTool(ToolBase):
125
125
  return self._run_std(args)
126
126
 
127
127
  def _run_std(self, args: list[str]) -> list[Message]:
128
- sources, options = mypy.main.process_options(args, fscache=self.fscache)
128
+ messages = []
129
+ try:
130
+ sources, options = mypy.main.process_options(args, fscache=self.fscache)
131
+ except (SystemExit, Exception) as e:
132
+ message = "The error(s) will be displayed before the messages" if isinstance(e, SystemExit) else str(e)
133
+ messages.append(
134
+ Message(
135
+ "mypy",
136
+ code="fatal-options-error",
137
+ message=message,
138
+ location=Location(
139
+ path="",
140
+ module=None,
141
+ function=None,
142
+ line=0,
143
+ character=0,
144
+ ),
145
+ )
146
+ )
147
+ return messages
129
148
  options.output = "json"
130
- res = mypy.build.build(sources, options, fscache=self.fscache)
149
+ try:
150
+ res = mypy.build.build(sources, options, fscache=self.fscache)
151
+ except Exception as e:
152
+ messages.append(
153
+ Message(
154
+ "mypy",
155
+ code="fatal-build-error",
156
+ message=str(e),
157
+ location=Location(
158
+ path="",
159
+ module=None,
160
+ function=None,
161
+ line=0,
162
+ character=0,
163
+ ),
164
+ )
165
+ )
166
+ return messages
131
167
 
132
- messages = []
133
168
  for mypy_json in res.errors:
134
169
  mypy_message = json.loads(mypy_json)
135
170
  message = f"{mypy_message['message']}."
@@ -63,7 +63,7 @@ class PyrightTool(ToolBase):
63
63
  if option_key not in VALID_OPTIONS:
64
64
  url = "https://github.com/PyCQA/prospector/blob/master/prospector/tools/pyright/__init__.py"
65
65
  raise BadToolConfig(
66
- "pyright", f"Option {option_key} is not valid. " f"See the list of possible options: {url}"
66
+ "pyright", f"Option {option_key} is not valid. See the list of possible options: {url}"
67
67
  )
68
68
 
69
69
  level = options.get("level", None)
@@ -0,0 +1,130 @@
1
+ [build-system]
2
+ build-backend = "poetry.core.masonry.api"
3
+
4
+ requires = [ "poetry-core>=1" ]
5
+
6
+ [project]
7
+ name = "prospector"
8
+ version = "1.17.2"
9
+ description = "Prospector is a tool to analyse Python code by aggregating the result of other tools."
10
+ readme = "README.rst"
11
+ keywords = [ "prospector", "pylint", "static code analysis" ]
12
+ license = "GPLv2+"
13
+ maintainers = [
14
+ { name = "Carl Crowder", email = "git@carlcrowder.com" },
15
+ { name = "Carlos Coelho", email = "carlospecter@gmail.com" },
16
+ { name = "Pierre Sassoulas", email = "pierre.sassoulas@gmail.com" },
17
+ { name = "Stéphane Brunner", email = "stephane.brunner@gmail.com" },
18
+ ]
19
+ authors = [
20
+ { name = "Carl Crowder", email = "git@carlcrowder.com" },
21
+ ]
22
+ requires-python = ">=3.9"
23
+ classifiers = [
24
+ "Development Status :: 5 - Production/Stable",
25
+ "Environment :: Console",
26
+ "Intended Audience :: Developers",
27
+ "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
28
+ "Operating System :: Unix",
29
+ "Programming Language :: Python :: 3 :: Only",
30
+ "Programming Language :: Python :: 3.9",
31
+ "Programming Language :: Python :: 3.10",
32
+ "Programming Language :: Python :: 3.11",
33
+ "Programming Language :: Python :: 3.12",
34
+ "Programming Language :: Python :: 3.13",
35
+ "Topic :: Software Development :: Quality Assurance",
36
+ ]
37
+ dynamic = [ "dependencies" ]
38
+
39
+ optional-dependencies.with_bandit = [ "bandit" ]
40
+ optional-dependencies.with_everything = [ "bandit", "mypy", "pyright", "pyroma", "ruff", "vulture" ]
41
+ optional-dependencies.with_mypy = [ "mypy" ]
42
+ optional-dependencies.with_pyright = [ "pyright" ]
43
+ optional-dependencies.with_pyroma = [ "pyroma" ]
44
+ optional-dependencies.with_ruff = [ "ruff" ]
45
+ optional-dependencies.with_vulture = [ "vulture" ]
46
+ urls."Bug Tracker" = "https://github.com/prospector-dev/prospector/issues"
47
+ urls."homepage" = "http://prospector.readthedocs.io"
48
+ urls."repository" = "https://github.com/prospector-dev/prospector"
49
+ scripts.prospector = "prospector.run:main"
50
+
51
+ [tool.poetry]
52
+ # The format is a workaround aganst https://github.com/python-poetry/poetry/issues/9961
53
+ packages = [
54
+ { include = "prospector/", format = [ "sdist" ] },
55
+ ]
56
+ include = [
57
+ "prospector/blender_combinations.yaml",
58
+ "prospector/profiles/profiles/*.yaml",
59
+ ]
60
+
61
+ [tool.poetry.dependencies]
62
+ python = ">=3.9,<4.0"
63
+ pylint = ">=3.0"
64
+ pylint-celery = "0.3"
65
+ pylint-django = ">=2.6.1"
66
+ requirements-detector = ">=1.3.2"
67
+ PyYAML = "*"
68
+ mccabe = "^0.7.0"
69
+ pyflakes = ">=2.2.0"
70
+ pycodestyle = ">=2.9.0"
71
+ pep8-naming = ">=0.3.3,<=0.10.0"
72
+ pydocstyle = ">=2.0.0"
73
+ dodgy = "^0.2.1"
74
+ toml = "^0.10.2"
75
+ setoptconf-tmp = "^0.3.1"
76
+ GitPython = "^3.1.27"
77
+ packaging = "*"
78
+ bandit = { version = ">=1.5.1", optional = true }
79
+ vulture = { version = ">=1.5", optional = true }
80
+ mypy = { version = ">=0.600", optional = true }
81
+ pyright = { version = ">=1.1.3", optional = true }
82
+ pyroma = { version = ">=2.4", optional = true }
83
+ ruff = { version = "*", optional = true }
84
+
85
+ [tool.poetry.group.dev.dependencies]
86
+ coveralls = "^3.3.1"
87
+ pytest = "^7.2.0"
88
+ pytest-benchmark = "^4.0.0"
89
+ pytest-cov = "^4.0.0"
90
+ tzlocal = "^4.2"
91
+ coverage = "^6.5"
92
+ pre-commit = "^4.2.0"
93
+ tox = "^3.27.1"
94
+ twine = "^5.1.1"
95
+ types-PyYAML = "^6.0.4"
96
+
97
+ [tool.ruff]
98
+ target-version = "py39"
99
+
100
+ line-length = 120
101
+ lint.extend-select = [
102
+ "B", # flake8-bugbear
103
+ # pydocstyle
104
+ "D213",
105
+ "D214",
106
+ "D215",
107
+ "D405",
108
+ "D406",
109
+ "D407",
110
+ "D408",
111
+ "D409",
112
+ "D410",
113
+ "D411",
114
+ "D413",
115
+ "D416",
116
+ "D417",
117
+ "E",
118
+ "F", # Pyflakes
119
+ "I", # isort
120
+ "PT", # flake8-pytest-style
121
+ "S", # flake8-bandit
122
+ "SIM", # flake8-simplify
123
+ "UP", # pyupgrade
124
+ "W", # Pycodestyle
125
+ ]
126
+ lint.ignore = [
127
+ "S101", # Use of assert detected
128
+ "SIM105", # suppressible-exception (slow code)
129
+ ]
130
+ lint.fixable = [ "ALL" ]
@@ -1,109 +0,0 @@
1
- [tool.poetry]
2
- name = "prospector"
3
- version = "1.16.1"
4
- description = "Prospector is a tool to analyse Python code by aggregating the result of other tools."
5
- authors = ["Carl Crowder <git@carlcrowder.com>"]
6
- maintainers = ["Carl Crowder <git@carlcrowder.com>",
7
- "Carlos Coelho <carlospecter@gmail.com>",
8
- "Pierre Sassoulas <pierre.sassoulas@gmail.com>",
9
- "Stéphane Brunner <stephane.brunner@gmail.com>"]
10
- readme = "README.rst"
11
- homepage = "http://prospector.readthedocs.io"
12
- repository = "https://github.com/PyCQA/prospector"
13
- keywords = ["pylint", "prospector", "static code analysis"]
14
- license = "GPLv2+"
15
- classifiers = [
16
- "Development Status :: 5 - Production/Stable",
17
- "Environment :: Console",
18
- "Intended Audience :: Developers",
19
- "Operating System :: Unix",
20
- "Topic :: Software Development :: Quality Assurance",
21
- "Programming Language :: Python :: 3.9",
22
- "Programming Language :: Python :: 3.10",
23
- "Programming Language :: Python :: 3.11",
24
- "Programming Language :: Python :: 3.12",
25
- "Programming Language :: Python :: 3.13",
26
- "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
27
- ]
28
- # The format is a workaround aganst https://github.com/python-poetry/poetry/issues/9961
29
- packages = [
30
- { include = "prospector/", format = ["sdist"] }
31
- ]
32
- include = [
33
- "prospector/blender_combinations.yaml",
34
- "prospector/profiles/profiles/*.yaml",
35
- ]
36
-
37
- [tool.poetry.scripts]
38
- prospector = 'prospector.run:main'
39
-
40
- [tool.poetry.dependencies]
41
- python = ">=3.9,<4.0"
42
- pylint = ">=3.0"
43
- pylint-celery = "0.3"
44
- pylint-django = ">=2.6.1"
45
- requirements-detector = ">=1.3.2"
46
- PyYAML = "*"
47
- mccabe = "^0.7.0"
48
- pyflakes = ">=2.2.0"
49
- pycodestyle = ">=2.9.0"
50
- pep8-naming = ">=0.3.3,<=0.10.0"
51
- pydocstyle = ">=2.0.0"
52
- dodgy = "^0.2.1"
53
- toml = "^0.10.2"
54
- setoptconf-tmp = "^0.3.1"
55
- GitPython = "^3.1.27"
56
- packaging = "*"
57
- bandit = {version = ">=1.5.1", optional = true}
58
- vulture = {version = ">=1.5", optional = true}
59
- mypy = {version = ">=0.600", optional = true}
60
- pyright = {version = ">=1.1.3", optional = true}
61
- pyroma = {version = ">=2.4", optional = true}
62
- ruff = {version = "*", optional = true}
63
-
64
- [tool.poetry.extras]
65
- with_bandit = ["bandit"]
66
- with_mypy = ["mypy"]
67
- with_pyright = ["pyright"]
68
- with_pyroma = ["pyroma"]
69
- with_vulture = ["vulture"]
70
- with_ruff = ["ruff"]
71
- with_everything = ["bandit", "mypy", "pyright", "pyroma", "vulture", "ruff"]
72
-
73
- [tool.poetry.group.dev.dependencies]
74
- coveralls = "^3.3.1"
75
- pytest = "^7.2.0"
76
- pytest-benchmark = "^4.0.0"
77
- pytest-cov = "^4.0.0"
78
- tzlocal = "^4.2"
79
- coverage = "^6.5"
80
- pre-commit = "^2.20.0"
81
- tox = "^3.27.1"
82
- twine = "^5.1.1"
83
- types-PyYAML = "^6.0.4"
84
-
85
- [build-system]
86
- requires = ["poetry-core>=1.0.0"]
87
- build-backend = "poetry.core.masonry.api"
88
-
89
- [tool.ruff]
90
- line-length = 120
91
- target-version = "py39"
92
-
93
- [tool.ruff.lint]
94
- fixable = ["ALL"]
95
- extend-select = [
96
- "UP", # pyupgrade
97
- "F", # Pyflakes
98
- "E", "W", # Pycodestyle
99
- "I", # isort
100
- "S", # flake8-bandit
101
- "SIM", # flake8-simplify
102
- "B", # flake8-bugbear
103
- # pydocstyle
104
- "D213", "D214", "D215", "D405", "D406", "D407", "D408", "D409", "D410", "D411", "D413", "D416", "D417",
105
- ]
106
- ignore= [
107
- "S101", # Use of assert detected
108
- "SIM105", # suppressible-exception (slow code)
109
- ]
@@ -1,80 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- from setuptools import setup
3
-
4
- packages = \
5
- ['prospector',
6
- 'prospector.config',
7
- 'prospector.formatters',
8
- 'prospector.profiles',
9
- 'prospector.tools',
10
- 'prospector.tools.bandit',
11
- 'prospector.tools.dodgy',
12
- 'prospector.tools.mccabe',
13
- 'prospector.tools.mypy',
14
- 'prospector.tools.profile_validator',
15
- 'prospector.tools.pycodestyle',
16
- 'prospector.tools.pydocstyle',
17
- 'prospector.tools.pyflakes',
18
- 'prospector.tools.pylint',
19
- 'prospector.tools.pyright',
20
- 'prospector.tools.pyroma',
21
- 'prospector.tools.ruff',
22
- 'prospector.tools.vulture']
23
-
24
- package_data = \
25
- {'': ['*'], 'prospector.profiles': ['profiles/*']}
26
-
27
- install_requires = \
28
- ['GitPython>=3.1.27,<4.0.0',
29
- 'PyYAML',
30
- 'dodgy>=0.2.1,<0.3.0',
31
- 'mccabe>=0.7.0,<0.8.0',
32
- 'packaging',
33
- 'pep8-naming>=0.3.3,<=0.10.0',
34
- 'pycodestyle>=2.9.0',
35
- 'pydocstyle>=2.0.0',
36
- 'pyflakes>=2.2.0',
37
- 'pylint-celery==0.3',
38
- 'pylint-django>=2.6.1',
39
- 'pylint>=3.0',
40
- 'requirements-detector>=1.3.2',
41
- 'setoptconf-tmp>=0.3.1,<0.4.0',
42
- 'toml>=0.10.2,<0.11.0']
43
-
44
- extras_require = \
45
- {'with_bandit': ['bandit>=1.5.1'],
46
- 'with_everything': ['bandit>=1.5.1',
47
- 'vulture>=1.5',
48
- 'mypy>=0.600',
49
- 'pyright>=1.1.3',
50
- 'pyroma>=2.4',
51
- 'ruff'],
52
- 'with_mypy': ['mypy>=0.600'],
53
- 'with_pyright': ['pyright>=1.1.3'],
54
- 'with_pyroma': ['pyroma>=2.4'],
55
- 'with_ruff': ['ruff'],
56
- 'with_vulture': ['vulture>=1.5']}
57
-
58
- entry_points = \
59
- {'console_scripts': ['prospector = prospector.run:main']}
60
-
61
- setup_kwargs = {
62
- 'name': 'prospector',
63
- 'version': '1.16.1',
64
- 'description': 'Prospector is a tool to analyse Python code by aggregating the result of other tools.',
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
- 'author': 'Carl Crowder',
67
- 'author_email': 'git@carlcrowder.com',
68
- 'maintainer': 'Carl Crowder',
69
- 'maintainer_email': 'git@carlcrowder.com',
70
- 'url': 'http://prospector.readthedocs.io',
71
- 'packages': packages,
72
- 'package_data': package_data,
73
- 'install_requires': install_requires,
74
- 'extras_require': extras_require,
75
- 'entry_points': entry_points,
76
- 'python_requires': '>=3.9,<4.0',
77
- }
78
-
79
-
80
- setup(**setup_kwargs)
File without changes