polycheck 0.2.0__tar.gz → 0.2.1__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 (67) hide show
  1. {polycheck-0.2.0/src/polycheck.egg-info → polycheck-0.2.1}/PKG-INFO +2 -1
  2. {polycheck-0.2.0 → polycheck-0.2.1}/pyproject.toml +2 -1
  3. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/__init__.py +3 -1
  4. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/reporters/markdown_reporter.py +23 -5
  5. {polycheck-0.2.0 → polycheck-0.2.1/src/polycheck.egg-info}/PKG-INFO +2 -1
  6. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck.egg-info/requires.txt +1 -0
  7. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_meta.py +17 -4
  8. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_reporters.py +44 -0
  9. {polycheck-0.2.0 → polycheck-0.2.1}/LICENSE +0 -0
  10. {polycheck-0.2.0 → polycheck-0.2.1}/README.md +0 -0
  11. {polycheck-0.2.0 → polycheck-0.2.1}/setup.cfg +0 -0
  12. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/cli.py +0 -0
  13. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/config.py +0 -0
  14. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/detect.py +0 -0
  15. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/finding.py +0 -0
  16. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/initializer.py +0 -0
  17. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/languages/__init__.py +0 -0
  18. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/mcp_server.py +0 -0
  19. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/py.typed +0 -0
  20. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/registry.py +0 -0
  21. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/reporters/__init__.py +0 -0
  22. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/reporters/json_reporter.py +0 -0
  23. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/reporters/sarif_reporter.py +0 -0
  24. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/runner.py +0 -0
  25. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/session.py +0 -0
  26. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/__init__.py +0 -0
  27. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/actionlint.py +0 -0
  28. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/base.py +0 -0
  29. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/depcheck.py +0 -0
  30. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/deptry.py +0 -0
  31. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/eslint.py +0 -0
  32. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/gitleaks.py +0 -0
  33. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/hadolint.py +0 -0
  34. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/knip.py +0 -0
  35. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/mypy.py +0 -0
  36. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/npm_audit.py +0 -0
  37. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/pip_audit.py +0 -0
  38. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/ruff.py +0 -0
  39. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/semgrep.py +0 -0
  40. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/shellcheck.py +0 -0
  41. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/sonarless.py +0 -0
  42. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/tsc.py +0 -0
  43. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/tools/vulture.py +0 -0
  44. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/verify.py +0 -0
  45. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck/workflows/__init__.py +0 -0
  46. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck.egg-info/SOURCES.txt +0 -0
  47. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck.egg-info/dependency_links.txt +0 -0
  48. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck.egg-info/entry_points.txt +0 -0
  49. {polycheck-0.2.0 → polycheck-0.2.1}/src/polycheck.egg-info/top_level.txt +0 -0
  50. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_baseline.py +0 -0
  51. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_cli_baseline.py +0 -0
  52. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_cli_helpers.py +0 -0
  53. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_config.py +0 -0
  54. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_detect.py +0 -0
  55. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_finding.py +0 -0
  56. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_initializer.py +0 -0
  57. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_install.py +0 -0
  58. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_mcp_server.py +0 -0
  59. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_registry.py +0 -0
  60. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_runner.py +0 -0
  61. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_session.py +0 -0
  62. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_smoke.py +0 -0
  63. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_sonarless.py +0 -0
  64. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_tool_adapters.py +0 -0
  65. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_tool_smoke.py +0 -0
  66. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_tool_smoke_heavy.py +0 -0
  67. {polycheck-0.2.0 → polycheck-0.2.1}/tests/test_verify.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polycheck
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Polyglot static analysis pipeline that produces LLM-ready triage output
5
5
  Author-email: Philip Hofmann <philiphofmann@hotmail.com>
6
6
  License: MIT
@@ -27,6 +27,7 @@ Requires-Dist: requests>=2.28
27
27
  Requires-Dist: tomli>=2.0; python_version < "3.11"
28
28
  Provides-Extra: dev
29
29
  Requires-Dist: pytest>=7.0; extra == "dev"
30
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
30
31
  Requires-Dist: pytest-mock>=3.10; extra == "dev"
31
32
  Requires-Dist: ruff>=0.2; extra == "dev"
32
33
  Requires-Dist: mypy>=1.0; extra == "dev"
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "polycheck"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description = "Polyglot static analysis pipeline that produces LLM-ready triage output"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -42,6 +42,7 @@ dependencies = [
42
42
  [project.optional-dependencies]
43
43
  dev = [
44
44
  "pytest>=7.0",
45
+ "pytest-cov>=4.0",
45
46
  "pytest-mock>=3.10",
46
47
  "ruff>=0.2",
47
48
  "mypy>=1.0",
@@ -15,5 +15,7 @@ The package is structured as:
15
15
  """
16
16
  from __future__ import annotations
17
17
 
18
- __version__ = "0.1.0"
18
+ # Keep in sync with pyproject.toml and CHANGELOG.md —
19
+ # tests/test_meta.py enforces it.
20
+ __version__ = "0.2.1"
19
21
  __all__ = ["__version__"]
@@ -116,26 +116,44 @@ def _findings_sections(findings: list) -> list[str]:
116
116
  return lines
117
117
 
118
118
 
119
+ _RULE_EXAMPLE_CAP = 5
120
+
121
+
119
122
  def _category_findings_table(cat: Category, items: list, cap: int) -> list[str]:
120
- """Generate a findings table for a single category."""
123
+ """Generate a findings table for a single category.
124
+
125
+ Rows are capped twice: per rule (a rule repeated 50 times is one
126
+ insight, not 50 rows) and per category. Both notes carry the exact
127
+ hidden count so nothing is silently dropped.
128
+ """
121
129
  lines = [
122
130
  f"## {cat.value} ({len(items)})",
123
131
  "",
124
132
  "| Severity | Tool | Rule | Location | Message |",
125
133
  "|----------|------|------|----------|---------|",
126
134
  ]
127
- for f in items[:cap]:
135
+ per_rule: Counter = Counter()
136
+ shown = 0
137
+ for f in items:
138
+ if shown >= cap:
139
+ break
140
+ if per_rule[f.rule] >= _RULE_EXAMPLE_CAP:
141
+ continue
142
+ per_rule[f.rule] += 1
143
+ shown += 1
128
144
  sev = _SEV_BADGE.get(f.severity, "?")
129
145
  loc = f.file or "?"
130
146
  if f.line:
131
147
  loc += f":{f.line}"
132
148
  msg = f.message.replace("|", "\\|")[:120]
133
149
  lines.append(f"| {sev} | `{f.tool}` | `{f.rule}` | `{loc}` | {msg} |")
134
- if len(items) > cap:
150
+ hidden = len(items) - shown
151
+ if hidden:
135
152
  lines.extend([
136
153
  "",
137
- f"_…and {len(items) - cap} more. See "
138
- f"`polycheck-report.json` for the full list._",
154
+ f"_…and {hidden} more (capped at {_RULE_EXAMPLE_CAP} examples "
155
+ f"per rule, {cap} per category). See `polycheck-report.json` "
156
+ f"for the full list._",
139
157
  ])
140
158
  lines.append("")
141
159
  return lines
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polycheck
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Polyglot static analysis pipeline that produces LLM-ready triage output
5
5
  Author-email: Philip Hofmann <philiphofmann@hotmail.com>
6
6
  License: MIT
@@ -27,6 +27,7 @@ Requires-Dist: requests>=2.28
27
27
  Requires-Dist: tomli>=2.0; python_version < "3.11"
28
28
  Provides-Extra: dev
29
29
  Requires-Dist: pytest>=7.0; extra == "dev"
30
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
30
31
  Requires-Dist: pytest-mock>=3.10; extra == "dev"
31
32
  Requires-Dist: ruff>=0.2; extra == "dev"
32
33
  Requires-Dist: mypy>=1.0; extra == "dev"
@@ -9,6 +9,7 @@ tomli>=2.0
9
9
 
10
10
  [dev]
11
11
  pytest>=7.0
12
+ pytest-cov>=4.0
12
13
  pytest-mock>=3.10
13
14
  ruff>=0.2
14
15
  mypy>=1.0
@@ -1,17 +1,30 @@
1
1
  """Consistency guards for facts that live in more than one place."""
2
2
  from __future__ import annotations
3
3
 
4
+ import sys
4
5
  from pathlib import Path
5
6
 
7
+ if sys.version_info >= (3, 11):
8
+ import tomllib
9
+ else:
10
+ import tomli as tomllib
11
+
6
12
  REPO_ROOT = Path(__file__).resolve().parent.parent
7
13
 
8
14
 
9
- def test_changelog_mentions_current_version():
10
- from polycheck import __version__
15
+ def test_version_is_consistent_across_pyproject_init_and_changelog():
16
+ import polycheck
11
17
 
18
+ pyproject = tomllib.loads((REPO_ROOT / "pyproject.toml").read_text(encoding="utf-8"))
12
19
  changelog = (REPO_ROOT / "CHANGELOG.md").read_text(encoding="utf-8")
13
- assert f"## {__version__}" in changelog, (
14
- f"CHANGELOG.md has no '## {__version__}' section; "
20
+
21
+ version = pyproject["project"]["version"]
22
+ assert polycheck.__version__ == version, (
23
+ "src/polycheck/__init__.py __version__ and pyproject.toml version "
24
+ "must match (the published wheel and `polycheck --version` disagree otherwise)"
25
+ )
26
+ assert f"## {version}" in changelog, (
27
+ f"CHANGELOG.md has no '## {version}' section; "
15
28
  "bump the changelog together with pyproject.toml"
16
29
  )
17
30
 
@@ -62,6 +62,50 @@ def test_markdown_reporter(tmp_path: Path):
62
62
  assert "attr-defined" in text
63
63
 
64
64
 
65
+ def test_markdown_caps_repeated_rule_examples(tmp_path: Path):
66
+ """One rule repeated many times is one insight: the report shows a
67
+ bounded number of example rows plus an exact hidden count."""
68
+ findings = [
69
+ Finding(tool="ruff", rule="E501", severity=Severity.LOW,
70
+ category=Category.LINT, message=f"line too long {i}",
71
+ file=f"f{i}.py", line=i)
72
+ for i in range(20)
73
+ ]
74
+ results = [ToolResult(tool="ruff", status="ok", findings=findings,
75
+ duration_sec=0.1)]
76
+
77
+ written = render("markdown", tmp_path, findings, results,
78
+ report_dir=tmp_path / "out")
79
+ text = written[0].read_text(encoding="utf-8")
80
+
81
+ rows = [
82
+ row for row in text.splitlines()
83
+ if row.startswith("| LOW ") and "`ruff`" in row and "`E501`" in row
84
+ ]
85
+ assert len(rows) == 5 # per-rule example cap
86
+ assert "and 15 more" in text
87
+
88
+
89
+ def test_markdown_shows_distinct_rules_beyond_five(tmp_path: Path):
90
+ """The cap is per rule, not per category: six distinct rules all show."""
91
+ findings = [
92
+ Finding(tool="ruff", rule=f"E50{i}", severity=Severity.LOW,
93
+ category=Category.LINT, message=f"issue {i}",
94
+ file="a.py", line=i)
95
+ for i in range(6)
96
+ ]
97
+ results = [ToolResult(tool="ruff", status="ok", findings=findings,
98
+ duration_sec=0.1)]
99
+
100
+ written = render("markdown", tmp_path, findings, results,
101
+ report_dir=tmp_path / "out")
102
+ text = written[0].read_text(encoding="utf-8")
103
+
104
+ for i in range(6):
105
+ assert f"E50{i}" in text
106
+ assert "and 0 more" not in text
107
+
108
+
65
109
  def test_sarif_reporter(tmp_path: Path):
66
110
  written = render("sarif", tmp_path, _findings(), _results(),
67
111
  report_dir=tmp_path / "out")
File without changes
File without changes
File without changes
File without changes