readability-cli 0.8.1__tar.gz → 0.8.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.
- {readability_cli-0.8.1 → readability_cli-0.8.2}/PKG-INFO +5 -2
- {readability_cli-0.8.1 → readability_cli-0.8.2}/README.md +4 -1
- {readability_cli-0.8.1 → readability_cli-0.8.2}/pyproject.toml +1 -1
- {readability_cli-0.8.1 → readability_cli-0.8.2}/readability.py +17 -5
- {readability_cli-0.8.1 → readability_cli-0.8.2}/test_readability.py +33 -3
- {readability_cli-0.8.1 → readability_cli-0.8.2}/uv.lock +1 -1
- {readability_cli-0.8.1 → readability_cli-0.8.2}/.github/workflows/ci.yml +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/.github/workflows/publish.yml +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/.github/workflows/update-guides.yml +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/.gitignore +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/.python-version +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/LICENSE +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/configs/pyrefly.toml +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/configs/ruff.toml +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/guides/Rguide.md +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/guides/cppguide.md +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/guides/csharp-style.md +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/guides/docguide-style.md +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/guides/go-guide.md +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/guides/htmlcssguide.md +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/guides/javaguide.md +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/guides/jsguide.md +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/guides/jsoncstyleguide.md +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/guides/objcguide.md +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/guides/pyguide.md +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/guides/shellguide.md +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/guides/tsguide.md +0 -0
- {readability_cli-0.8.1 → readability_cli-0.8.2}/guides/vimscriptguide.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: readability-cli
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.2
|
|
4
4
|
Summary: A CLI to lint, format, and type-check code with Google-style defaults, and pull Google style guides in markdown format.
|
|
5
5
|
Project-URL: Homepage, https://github.com/owahltinez/readability
|
|
6
6
|
Project-URL: Repository, https://github.com/owahltinez/readability
|
|
@@ -164,7 +164,10 @@ if report.findings or report.failed or not report.ran:
|
|
|
164
164
|
|
|
165
165
|
The returned `CheckReport` records only whether findings occurred and which
|
|
166
166
|
tools ran, were skipped, or failed. Detailed tool findings are still written
|
|
167
|
-
as each tool runs.
|
|
167
|
+
as each tool runs. Every path is validated before any tool runs, and a missing
|
|
168
|
+
one raises `FileNotFoundError` rather than being misreported as a finding.
|
|
169
|
+
Relative paths remain relative to the process working directory;
|
|
170
|
+
`project_root` controls configuration discovery only.
|
|
168
171
|
|
|
169
172
|
### Default Configurations
|
|
170
173
|
|
|
@@ -150,7 +150,10 @@ if report.findings or report.failed or not report.ran:
|
|
|
150
150
|
|
|
151
151
|
The returned `CheckReport` records only whether findings occurred and which
|
|
152
152
|
tools ran, were skipped, or failed. Detailed tool findings are still written
|
|
153
|
-
as each tool runs.
|
|
153
|
+
as each tool runs. Every path is validated before any tool runs, and a missing
|
|
154
|
+
one raises `FileNotFoundError` rather than being misreported as a finding.
|
|
155
|
+
Relative paths remain relative to the process working directory;
|
|
156
|
+
`project_root` controls configuration discovery only.
|
|
154
157
|
|
|
155
158
|
### Default Configurations
|
|
156
159
|
|
|
@@ -1196,18 +1196,30 @@ def check_paths(
|
|
|
1196
1196
|
the result.
|
|
1197
1197
|
|
|
1198
1198
|
Args:
|
|
1199
|
-
paths: Files or directories to check, as strings or paths.
|
|
1200
|
-
|
|
1201
|
-
|
|
1199
|
+
paths: Files or directories to check, as strings or paths. Relative
|
|
1200
|
+
paths are interpreted from the current working directory.
|
|
1201
|
+
project_root: Root used only to discover tool configuration. Defaults
|
|
1202
|
+
to the current working directory; it does not rebase paths.
|
|
1202
1203
|
fix: Whether to apply automatic fixes.
|
|
1203
1204
|
|
|
1204
1205
|
Returns:
|
|
1205
1206
|
A report aggregated across all provided paths.
|
|
1207
|
+
|
|
1208
|
+
Raises:
|
|
1209
|
+
FileNotFoundError: If any requested path does not exist. Every path is
|
|
1210
|
+
validated before any tools run.
|
|
1206
1211
|
"""
|
|
1207
1212
|
root = Path.cwd() if project_root is None else project_root
|
|
1213
|
+
requested_paths = [Path(path) for path in paths]
|
|
1214
|
+
missing_path = next(
|
|
1215
|
+
(path for path in requested_paths if not path.exists()), None
|
|
1216
|
+
)
|
|
1217
|
+
if missing_path is not None:
|
|
1218
|
+
raise FileNotFoundError(f"Path does not exist: {missing_path}")
|
|
1219
|
+
|
|
1208
1220
|
report = CheckReport()
|
|
1209
|
-
for path in
|
|
1210
|
-
report.absorb(_check_path(
|
|
1221
|
+
for path in requested_paths:
|
|
1222
|
+
report.absorb(_check_path(path, root, fix=fix))
|
|
1211
1223
|
return report
|
|
1212
1224
|
|
|
1213
1225
|
|
|
@@ -522,10 +522,17 @@ def test_bundled_default_configs_are_valid(tmp_path: Path) -> None:
|
|
|
522
522
|
|
|
523
523
|
@patch("readability._check_path")
|
|
524
524
|
def test_check_paths_aggregates_str_and_path_inputs(
|
|
525
|
-
mock_check_path: MagicMock,
|
|
525
|
+
mock_check_path: MagicMock,
|
|
526
|
+
tmp_path: Path,
|
|
527
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
526
528
|
) -> None:
|
|
527
529
|
"""The public API folds each per-path result into one limited report."""
|
|
528
530
|
project_root = tmp_path / "project"
|
|
531
|
+
project_root.mkdir()
|
|
532
|
+
(tmp_path / "src").mkdir()
|
|
533
|
+
(tmp_path / "src" / "example.py").touch()
|
|
534
|
+
(tmp_path / "README.md").touch()
|
|
535
|
+
monkeypatch.chdir(tmp_path)
|
|
529
536
|
mock_check_path.side_effect = [
|
|
530
537
|
CheckReport(ran={"ruff"}, skipped={"pyrefly"}),
|
|
531
538
|
CheckReport(
|
|
@@ -561,6 +568,7 @@ def test_check_paths_defaults_project_root_to_cwd(
|
|
|
561
568
|
) -> None:
|
|
562
569
|
"""The public API discovers configuration from the caller's directory."""
|
|
563
570
|
monkeypatch.chdir(tmp_path)
|
|
571
|
+
(tmp_path / "example.py").touch()
|
|
564
572
|
|
|
565
573
|
check_paths([Path("example.py")])
|
|
566
574
|
|
|
@@ -581,6 +589,23 @@ def test_check_paths_with_no_paths_reports_that_nothing_ran(
|
|
|
581
589
|
mock_check_path.assert_not_called()
|
|
582
590
|
|
|
583
591
|
|
|
592
|
+
@patch("readability._check_path")
|
|
593
|
+
def test_check_paths_rejects_missing_paths_before_dispatch(
|
|
594
|
+
mock_check_path: MagicMock,
|
|
595
|
+
tmp_path: Path,
|
|
596
|
+
) -> None:
|
|
597
|
+
"""A missing path prevents partial checks and fixes on earlier paths."""
|
|
598
|
+
existing = tmp_path / "exists.py"
|
|
599
|
+
missing = tmp_path / "missing.py"
|
|
600
|
+
existing.touch()
|
|
601
|
+
|
|
602
|
+
with pytest.raises(FileNotFoundError) as excinfo:
|
|
603
|
+
check_paths([existing, missing], project_root=tmp_path, fix=True)
|
|
604
|
+
|
|
605
|
+
assert str(missing) in str(excinfo.value)
|
|
606
|
+
mock_check_path.assert_not_called()
|
|
607
|
+
|
|
608
|
+
|
|
584
609
|
@patch(
|
|
585
610
|
"readability._check_path",
|
|
586
611
|
return_value=CheckReport(
|
|
@@ -590,10 +615,15 @@ def test_check_paths_with_no_paths_reports_that_nothing_ran(
|
|
|
590
615
|
),
|
|
591
616
|
)
|
|
592
617
|
def test_check_paths_returns_report_without_cli_status_prose(
|
|
593
|
-
mock_check_path: MagicMock,
|
|
618
|
+
mock_check_path: MagicMock,
|
|
619
|
+
capsys: pytest.CaptureFixture[str],
|
|
620
|
+
tmp_path: Path,
|
|
594
621
|
) -> None:
|
|
595
622
|
"""Library callers receive report states without CLI policy or summaries."""
|
|
596
|
-
|
|
623
|
+
path = tmp_path / "example.py"
|
|
624
|
+
path.touch()
|
|
625
|
+
|
|
626
|
+
report = check_paths([path])
|
|
597
627
|
|
|
598
628
|
assert report.findings is True
|
|
599
629
|
assert report.skipped == {"pyrefly"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|