readability-cli 0.11.0__tar.gz → 0.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 (39) hide show
  1. {readability_cli-0.11.0 → readability_cli-0.12.0}/PKG-INFO +29 -15
  2. {readability_cli-0.11.0 → readability_cli-0.12.0}/README.md +28 -14
  3. {readability_cli-0.11.0 → readability_cli-0.12.0}/pyproject.toml +1 -1
  4. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/tools.py +83 -2
  5. {readability_cli-0.11.0 → readability_cli-0.12.0}/test_checking.py +4 -26
  6. readability_cli-0.12.0/test_type_checking.py +114 -0
  7. {readability_cli-0.11.0 → readability_cli-0.12.0}/uv.lock +1 -1
  8. {readability_cli-0.11.0 → readability_cli-0.12.0}/.github/workflows/ci.yml +0 -0
  9. {readability_cli-0.11.0 → readability_cli-0.12.0}/.github/workflows/publish.yml +0 -0
  10. {readability_cli-0.11.0 → readability_cli-0.12.0}/.github/workflows/update-guides.yml +0 -0
  11. {readability_cli-0.11.0 → readability_cli-0.12.0}/.gitignore +0 -0
  12. {readability_cli-0.11.0 → readability_cli-0.12.0}/.python-version +0 -0
  13. {readability_cli-0.11.0 → readability_cli-0.12.0}/LICENSE +0 -0
  14. {readability_cli-0.11.0 → readability_cli-0.12.0}/biome.json +0 -0
  15. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/__init__.py +0 -0
  16. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/checking.py +0 -0
  17. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/cli.py +0 -0
  18. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/configs/biome-default.json +0 -0
  19. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/configs/pyrefly.toml +0 -0
  20. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/configs/ruff.toml +0 -0
  21. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/guide.py +0 -0
  22. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/guides/Rguide.md +0 -0
  23. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/guides/cppguide.md +0 -0
  24. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/guides/csharpguide.md +0 -0
  25. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/guides/docguide-style.md +0 -0
  26. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/guides/go-guide.md +0 -0
  27. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/guides/htmlcssguide.md +0 -0
  28. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/guides/javaguide.md +0 -0
  29. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/guides/jsguide.md +0 -0
  30. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/guides/jsoncguide.md +0 -0
  31. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/guides/objcguide.md +0 -0
  32. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/guides/pyguide.md +0 -0
  33. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/guides/shellguide.md +0 -0
  34. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/guides/tsguide.md +0 -0
  35. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/guides/vimscriptguide.md +0 -0
  36. {readability_cli-0.11.0 → readability_cli-0.12.0}/readability/outline.py +0 -0
  37. {readability_cli-0.11.0 → readability_cli-0.12.0}/test_guide.py +0 -0
  38. {readability_cli-0.11.0 → readability_cli-0.12.0}/test_outline.py +0 -0
  39. {readability_cli-0.11.0 → readability_cli-0.12.0}/test_package.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: readability-cli
3
- Version: 0.11.0
3
+ Version: 0.12.0
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
@@ -23,8 +23,8 @@ quick access to style conventions without browsing HTML pages.
23
23
  ## Features
24
24
 
25
25
  - **Linting & Formatting**: A `check` command that automatically detects and
26
- runs relevant tools (Ruff, Pyrefly, Biome, gofmt, goimports, shfmt,
27
- shellcheck, and rustfmt) for your project.
26
+ runs relevant tools (Ruff, Pyrefly, Biome, tsc, gofmt, goimports, go vet,
27
+ shfmt, shellcheck, and rustfmt) for your project.
28
28
  - **Predictable Ownership**: Every supported format has fixed tools, so
29
29
  configuration customizes checks without changing which formatter runs.
30
30
  - **Style Guides**: A `guide` command that fetches the latest Google style
@@ -103,22 +103,23 @@ such as gofmt and goimports, are unaffected by it.
103
103
 
104
104
  ### Supported Formats
105
105
 
106
- | Formats | Owners | Project configuration |
107
- | ----------------------------------------------------------------------- | --------------------------------------- | ------------------------------------- |
108
- | `.py` | Ruff lint/format; Pyrefly type checking | Ruff and Pyrefly native configuration |
109
- | `.js`, `.jsx`, `.ts`, `.tsx`, `.json`, `.jsonc`, `.css`, `.html`, `.md` | Biome | `biome.json` or `biome.jsonc` |
110
- | `.go` | gofmt, goimports | None |
111
- | `.sh`, `.bash` | shfmt format; shellcheck lint | None |
112
- | `.rs` | rustfmt | None |
106
+ | Formats | Owners | Project configuration |
107
+ | ---------------------------------------------------------------- | --------------------------------------- | ------------------------------------- |
108
+ | `.py` | Ruff lint/format; Pyrefly type checking | Ruff and Pyrefly native configuration |
109
+ | `.js`, `.jsx`, `.ts`, `.tsx`, `.json`, `.jsonc`, `.css`, `.html` | Biome | `biome.json` or `biome.jsonc` |
110
+ | `.ts`, `.tsx` | tsc type checking | `tsconfig.json`, required |
111
+ | `.go` | gofmt, goimports; go vet | `go.mod`, required by go vet |
112
+ | `.sh`, `.bash` | shfmt format; shellcheck lint | None |
113
+ | `.rs` | rustfmt | None |
113
114
 
114
- YAML, SCSS, JSONL, and extensions not listed above are unsupported.
115
+ Markdown, YAML, SCSS, JSONL, and extensions not listed above are unsupported.
115
116
  An unsupported-only path reports that nothing was checked and exits
116
117
  successfully.
117
118
 
118
119
  Biome first checks a project's `node_modules/.bin`. Ruff, Pyrefly, and Biome
119
120
  then use `PATH`, followed by `uvx` for the Python tools or `npx` for Biome. The
120
- runners cache downloads, so subsequent runs work offline. Gofmt and goimports
121
- must be available on `PATH`.
121
+ runners cache downloads, so subsequent runs work offline. Gofmt, goimports, and
122
+ Go itself, for go vet, must be available on `PATH`.
122
123
 
123
124
  That keeps this package at ~4 MB rather than the ~54 MB it would take to carry
124
125
  Ruff and Pyrefly itself — a cost that would fall on everyone using only `guide`.
@@ -132,6 +133,12 @@ to Ruff's — which has published seventeen minor series, roughly one every six
132
133
  weeks. If you need a fixed version, install it: an installed tool always wins
133
134
  over a fetched one.
134
135
 
136
+ Biome is the temporary exception, pinned to 2.5.14: from 2.5.15 it panics
137
+ (`path is expected to be under the root`) when the bundled config sits outside
138
+ the repository being checked, which is every project without its own
139
+ `biome.json` ([biomejs/biome#12158](https://github.com/biomejs/biome/issues/12158)).
140
+ The pin goes once upstream fixes it.
141
+
135
142
  Set `UV_OFFLINE=1` to forbid fetching. A tool that then cannot be reached fails
136
143
  the run rather than passing it.
137
144
 
@@ -139,6 +146,13 @@ Ruff, Pyrefly, and Biome ship with bundled configurations, so they run on every
139
146
  file they own without project setup. Gofmt and goimports run on `.go` files even
140
147
  when there is no `go.mod`.
141
148
 
149
+ Tsc and go vet have no bundled configuration, since neither can type-check a
150
+ file without its project's imports. They run only inside a `tsconfig.json`
151
+ project or a Go module, and check that whole project or package rather than the
152
+ named files. Tsc comes from the nearest `node_modules/.bin`, searching upward
153
+ as Node does, then `PATH`; it is never fetched, so a project whose dependencies
154
+ are not installed reports it as not installed.
155
+
142
156
  A tool that could not be reached at all is never skipped quietly:
143
157
 
144
158
  ```bash
@@ -204,8 +218,8 @@ For Python, add `[tool.ruff]` or `[tool.pyrefly]` to `pyproject.toml`, or use
204
218
  their native project configurations in place of bundled defaults. Readability
205
219
  does not interpret EditorConfig itself; a canonical tool such as Biome may opt
206
220
  into it through that tool's native configuration. Neither gofmt nor goimports
207
- has project settings. The bundled Biome file requires Biome 2.5 or later, and
208
- Markdown needs 2.6.
221
+ has project settings. The bundled Biome file requires Biome 2.5 or later; the
222
+ fallback runner is pinned to 2.5.14 for now.
209
223
 
210
224
  Configuration is found per file, in the file's own directory and then its
211
225
  ancestors, which is where each canonical tool looks. A package keeping its
@@ -9,8 +9,8 @@ quick access to style conventions without browsing HTML pages.
9
9
  ## Features
10
10
 
11
11
  - **Linting & Formatting**: A `check` command that automatically detects and
12
- runs relevant tools (Ruff, Pyrefly, Biome, gofmt, goimports, shfmt,
13
- shellcheck, and rustfmt) for your project.
12
+ runs relevant tools (Ruff, Pyrefly, Biome, tsc, gofmt, goimports, go vet,
13
+ shfmt, shellcheck, and rustfmt) for your project.
14
14
  - **Predictable Ownership**: Every supported format has fixed tools, so
15
15
  configuration customizes checks without changing which formatter runs.
16
16
  - **Style Guides**: A `guide` command that fetches the latest Google style
@@ -89,22 +89,23 @@ such as gofmt and goimports, are unaffected by it.
89
89
 
90
90
  ### Supported Formats
91
91
 
92
- | Formats | Owners | Project configuration |
93
- | ----------------------------------------------------------------------- | --------------------------------------- | ------------------------------------- |
94
- | `.py` | Ruff lint/format; Pyrefly type checking | Ruff and Pyrefly native configuration |
95
- | `.js`, `.jsx`, `.ts`, `.tsx`, `.json`, `.jsonc`, `.css`, `.html`, `.md` | Biome | `biome.json` or `biome.jsonc` |
96
- | `.go` | gofmt, goimports | None |
97
- | `.sh`, `.bash` | shfmt format; shellcheck lint | None |
98
- | `.rs` | rustfmt | None |
92
+ | Formats | Owners | Project configuration |
93
+ | ---------------------------------------------------------------- | --------------------------------------- | ------------------------------------- |
94
+ | `.py` | Ruff lint/format; Pyrefly type checking | Ruff and Pyrefly native configuration |
95
+ | `.js`, `.jsx`, `.ts`, `.tsx`, `.json`, `.jsonc`, `.css`, `.html` | Biome | `biome.json` or `biome.jsonc` |
96
+ | `.ts`, `.tsx` | tsc type checking | `tsconfig.json`, required |
97
+ | `.go` | gofmt, goimports; go vet | `go.mod`, required by go vet |
98
+ | `.sh`, `.bash` | shfmt format; shellcheck lint | None |
99
+ | `.rs` | rustfmt | None |
99
100
 
100
- YAML, SCSS, JSONL, and extensions not listed above are unsupported.
101
+ Markdown, YAML, SCSS, JSONL, and extensions not listed above are unsupported.
101
102
  An unsupported-only path reports that nothing was checked and exits
102
103
  successfully.
103
104
 
104
105
  Biome first checks a project's `node_modules/.bin`. Ruff, Pyrefly, and Biome
105
106
  then use `PATH`, followed by `uvx` for the Python tools or `npx` for Biome. The
106
- runners cache downloads, so subsequent runs work offline. Gofmt and goimports
107
- must be available on `PATH`.
107
+ runners cache downloads, so subsequent runs work offline. Gofmt, goimports, and
108
+ Go itself, for go vet, must be available on `PATH`.
108
109
 
109
110
  That keeps this package at ~4 MB rather than the ~54 MB it would take to carry
110
111
  Ruff and Pyrefly itself — a cost that would fall on everyone using only `guide`.
@@ -118,6 +119,12 @@ to Ruff's — which has published seventeen minor series, roughly one every six
118
119
  weeks. If you need a fixed version, install it: an installed tool always wins
119
120
  over a fetched one.
120
121
 
122
+ Biome is the temporary exception, pinned to 2.5.14: from 2.5.15 it panics
123
+ (`path is expected to be under the root`) when the bundled config sits outside
124
+ the repository being checked, which is every project without its own
125
+ `biome.json` ([biomejs/biome#12158](https://github.com/biomejs/biome/issues/12158)).
126
+ The pin goes once upstream fixes it.
127
+
121
128
  Set `UV_OFFLINE=1` to forbid fetching. A tool that then cannot be reached fails
122
129
  the run rather than passing it.
123
130
 
@@ -125,6 +132,13 @@ Ruff, Pyrefly, and Biome ship with bundled configurations, so they run on every
125
132
  file they own without project setup. Gofmt and goimports run on `.go` files even
126
133
  when there is no `go.mod`.
127
134
 
135
+ Tsc and go vet have no bundled configuration, since neither can type-check a
136
+ file without its project's imports. They run only inside a `tsconfig.json`
137
+ project or a Go module, and check that whole project or package rather than the
138
+ named files. Tsc comes from the nearest `node_modules/.bin`, searching upward
139
+ as Node does, then `PATH`; it is never fetched, so a project whose dependencies
140
+ are not installed reports it as not installed.
141
+
128
142
  A tool that could not be reached at all is never skipped quietly:
129
143
 
130
144
  ```bash
@@ -190,8 +204,8 @@ For Python, add `[tool.ruff]` or `[tool.pyrefly]` to `pyproject.toml`, or use
190
204
  their native project configurations in place of bundled defaults. Readability
191
205
  does not interpret EditorConfig itself; a canonical tool such as Biome may opt
192
206
  into it through that tool's native configuration. Neither gofmt nor goimports
193
- has project settings. The bundled Biome file requires Biome 2.5 or later, and
194
- Markdown needs 2.6.
207
+ has project settings. The bundled Biome file requires Biome 2.5 or later; the
208
+ fallback runner is pinned to 2.5.14 for now.
195
209
 
196
210
  Configuration is found per file, in the file's own directory and then its
197
211
  ancestors, which is where each canonical tool looks. A package keeping its
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "readability-cli"
3
- version = "0.11.0"
3
+ version = "0.12.0"
4
4
  description = "A CLI to lint, format, and type-check code with Google-style defaults, and pull Google style guides in markdown format."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -329,7 +329,8 @@ def _plan(
329
329
  TOOL_RUNNERS = {
330
330
  "ruff": ["uvx", "ruff>=0.15"],
331
331
  "pyrefly": ["uvx", "pyrefly>=1.2"],
332
- "biome": ["npx", "-y", "@biomejs/biome@>=2.6"],
332
+ # Pinned until 2.5.15's panic with an external config is fixed upstream
333
+ "biome": ["npx", "-y", "@biomejs/biome@2.5.14"],
333
334
  }
334
335
 
335
336
  # One formatter owner per extension; configuration never changes selection
@@ -345,13 +346,14 @@ TOOL_EXTENSIONS = {
345
346
  ".jsonc",
346
347
  ".css",
347
348
  ".html",
348
- ".md",
349
349
  ),
350
350
  "gofmt": (".go",),
351
351
  "goimports": (".go",),
352
352
  "shfmt": (".sh", ".bash"),
353
353
  "shellcheck": (".sh", ".bash"),
354
354
  "rustfmt": (".rs",),
355
+ "tsc": (".ts", ".tsx"),
356
+ "go vet": (".go",),
355
357
  }
356
358
 
357
359
  # Headroom below common argv limits; long target lists are split before exec
@@ -390,6 +392,7 @@ CONFIG_SOURCES = {
390
392
  "--project-excludes",
391
393
  ),
392
394
  "biome": (("biome.json", "biome.jsonc"), None, "--config-path", None),
395
+ "tsc": (("tsconfig.json",), None, "-p", None),
393
396
  }
394
397
 
395
398
  # Words each phase needs, before config and targets
@@ -513,6 +516,82 @@ def _tool_command(binary: str, project_root: Path) -> list[str]:
513
516
  return TOOL_RUNNERS.get(binary, [binary])
514
517
 
515
518
 
519
+ def _tsc_command(project: Path) -> list[str]:
520
+ """Build the argv prefix that reaches a project's TypeScript compiler.
521
+
522
+ Args:
523
+ project: The directory holding the tsconfig.json.
524
+
525
+ Returns:
526
+ The nearest installed tsc, else whatever PATH resolves.
527
+ """
528
+ # Node resolves upward, which is where workspaces hoist it
529
+ for directory in (project, *project.parents):
530
+ local = directory / "node_modules" / ".bin" / "tsc"
531
+ if local.is_file() and os.access(local, os.X_OK):
532
+ return [str(local)]
533
+ return [shutil.which("tsc") or "tsc"]
534
+
535
+
536
+ def _type_checker_plans(path: Path, boundary: Path) -> list[ToolPlan]:
537
+ """Plan tsc and go vet, which only run inside a project they can build.
538
+
539
+ Both check whole projects or packages rather than the named files, since
540
+ neither can type-check a file without its imports.
541
+
542
+ Args:
543
+ path: The path being checked.
544
+ boundary: The outermost directory config discovery may consider.
545
+
546
+ Returns:
547
+ One plan per tsconfig.json and per Go module the path reaches.
548
+ """
549
+ plans = [
550
+ ToolPlan(
551
+ name="tsc",
552
+ extensions=TOOL_EXTENSIONS["tsc"],
553
+ check=(*_tsc_command(root), "--noEmit", "-p", str(root)),
554
+ )
555
+ for root, _, _ in _config_groups(path, boundary, "tsc")
556
+ if root is not None
557
+ ]
558
+
559
+ # ./... skips nested modules, so each of those needs its own run
560
+ modules = _config_roots_below(path, ("go.mod",), None, "go vet")
561
+ if _config_root(path, boundary, ("go.mod",), None):
562
+ if path.is_dir():
563
+ # A pattern matching no package is an error, not a pass
564
+ own = [
565
+ file
566
+ for file in _matching_paths(path, TOOL_EXTENSIONS["go vet"])
567
+ if not any(m in Path(file).resolve().parents for m in modules)
568
+ ]
569
+ if own:
570
+ modules.append(path.resolve())
571
+ else:
572
+ plans.append(_go_vet_plan(path.parent.resolve(), "."))
573
+ plans.extend(_go_vet_plan(module, "./...") for module in modules)
574
+ return plans
575
+
576
+
577
+ def _go_vet_plan(directory: Path, pattern: str) -> ToolPlan:
578
+ """Plan go vet over a package pattern, run where the pattern resolves.
579
+
580
+ Args:
581
+ directory: The directory the pattern is relative to.
582
+ pattern: The package pattern to vet.
583
+
584
+ Returns:
585
+ The plan.
586
+ """
587
+ return ToolPlan(
588
+ name="go vet",
589
+ extensions=TOOL_EXTENSIONS["go vet"],
590
+ check=("go", "vet", pattern),
591
+ cwd=directory,
592
+ )
593
+
594
+
516
595
  def _get_tool_definitions(
517
596
  path: Path, project_root: Path, boundary: Path | None = None
518
597
  ) -> list[ToolPlan]:
@@ -610,6 +689,8 @@ def _get_tool_definitions(
610
689
  )
611
690
  )
612
691
 
692
+ plans.extend(_type_checker_plans(path, boundary))
693
+
613
694
  # A directory owning its config alone lets Pyrefly select the files
614
695
  files, section = CONFIG_SOURCES["pyrefly"][:2]
615
696
  groups = _config_groups(path, boundary, "pyrefly")
@@ -215,7 +215,7 @@ def test_check_command_biome(
215
215
  assert [
216
216
  "npx",
217
217
  "-y",
218
- "@biomejs/biome@>=2.6",
218
+ "@biomejs/biome@2.5.14",
219
219
  phase,
220
220
  "--no-errors-on-unmatched",
221
221
  str((Path(cwds[0]) / "script.js").resolve()),
@@ -1457,7 +1457,9 @@ def test_check_runs_biome_without_a_project_config(
1457
1457
  )
1458
1458
 
1459
1459
 
1460
- @pytest.mark.parametrize("extension", (".yml", ".yaml", ".scss", ".jsonl"))
1460
+ @pytest.mark.parametrize(
1461
+ "extension", (".md", ".yml", ".yaml", ".scss", ".jsonl")
1462
+ )
1461
1463
  @patch("shutil.which")
1462
1464
  @patch("subprocess.run")
1463
1465
  def test_unsupported_formats_run_no_tool(
@@ -1480,30 +1482,6 @@ def test_unsupported_formats_run_no_tool(
1480
1482
  mock_run.assert_not_called()
1481
1483
 
1482
1484
 
1483
- @patch("shutil.which")
1484
- @patch("subprocess.run")
1485
- def test_markdown_is_checked_by_biome(
1486
- mock_run: MagicMock, mock_which: MagicMock, tmp_path: Path
1487
- ) -> None:
1488
- """A Markdown file, named or alone in a directory, goes to Biome."""
1489
- mock_which.side_effect = lambda name: name
1490
- mock_run.return_value = MagicMock(returncode=0, stdout="", stderr="")
1491
-
1492
- runner = CliRunner()
1493
- with runner.isolated_filesystem(temp_dir=tmp_path):
1494
- Path("docs").mkdir()
1495
- Path("docs/README.md").touch()
1496
-
1497
- file_result = runner.invoke(cli, ["check", "docs/README.md"])
1498
- directory_result = runner.invoke(cli, ["check", "docs"])
1499
-
1500
- assert file_result.exit_code == 0
1501
- assert directory_result.exit_code == 0
1502
- commands = [invocation.args[0] for invocation in mock_run.call_args_list]
1503
- assert {command[0] for command in commands} == {"biome"}
1504
- assert len(commands) == 4
1505
-
1506
-
1507
1485
  @patch("shutil.which")
1508
1486
  @patch("subprocess.run")
1509
1487
  def test_mixed_directory_scopes_biome_to_owned_files(
@@ -0,0 +1,114 @@
1
+ from pathlib import Path
2
+
3
+ from readability.tools import _get_tool_definitions
4
+
5
+
6
+ def _plans(path: Path, root: Path, name: str) -> list:
7
+ return [p for p in _get_tool_definitions(path, root) if p.name == name]
8
+
9
+
10
+ def _executable(path: Path) -> Path:
11
+ path.parent.mkdir(parents=True, exist_ok=True)
12
+ path.write_text("#!/bin/sh\n")
13
+ path.chmod(0o755)
14
+ return path
15
+
16
+
17
+ def test_tsc_checks_the_project_that_owns_the_tsconfig(
18
+ tmp_path: Path,
19
+ ) -> None:
20
+ (tmp_path / "tsconfig.json").write_text("{}")
21
+ (tmp_path / "src").mkdir()
22
+ source = tmp_path / "src" / "app.ts"
23
+ source.touch()
24
+ tsc = _executable(tmp_path / "node_modules" / ".bin" / "tsc")
25
+
26
+ [plan] = _plans(source, tmp_path, "tsc")
27
+
28
+ assert plan.check == (str(tsc), "--noEmit", "-p", str(tmp_path.resolve()))
29
+ assert plan.format == plan.fix == plan.check_format == ()
30
+
31
+
32
+ def test_tsc_does_not_run_without_a_tsconfig(tmp_path: Path) -> None:
33
+ (tmp_path / "app.ts").touch()
34
+
35
+ assert _plans(tmp_path, tmp_path, "tsc") == []
36
+
37
+
38
+ def test_tsc_is_found_where_a_workspace_hoisted_it(tmp_path: Path) -> None:
39
+ package = tmp_path / "packages" / "web"
40
+ package.mkdir(parents=True)
41
+ (package / "tsconfig.json").write_text("{}")
42
+ (package / "app.ts").touch()
43
+ tsc = _executable(tmp_path / "node_modules" / ".bin" / "tsc")
44
+
45
+ [plan] = _plans(package, tmp_path, "tsc")
46
+
47
+ assert plan.check[0] == str(tsc)
48
+
49
+
50
+ def test_tsc_checks_each_nested_project_once(tmp_path: Path) -> None:
51
+ (tmp_path / "tsconfig.json").write_text("{}")
52
+ (tmp_path / "a.ts").touch()
53
+ (tmp_path / "web").mkdir()
54
+ (tmp_path / "web" / "tsconfig.json").write_text("{}")
55
+ (tmp_path / "web" / "b.ts").touch()
56
+ (tmp_path / "web" / "c.tsx").touch()
57
+
58
+ projects = sorted(p.check[-1] for p in _plans(tmp_path, tmp_path, "tsc"))
59
+
60
+ assert projects == sorted(
61
+ [str(tmp_path.resolve()), str((tmp_path / "web").resolve())]
62
+ )
63
+
64
+
65
+ def test_go_vet_checks_every_package_below_a_directory(
66
+ tmp_path: Path,
67
+ ) -> None:
68
+ (tmp_path / "go.mod").write_text("module example.com/m\n")
69
+ (tmp_path / "cmd").mkdir()
70
+ (tmp_path / "cmd" / "main.go").touch()
71
+
72
+ [plan] = _plans(tmp_path / "cmd", tmp_path, "go vet")
73
+
74
+ assert plan.check == ("go", "vet", "./...")
75
+ assert plan.cwd == (tmp_path / "cmd").resolve()
76
+
77
+
78
+ def test_go_vet_checks_a_files_whole_package(tmp_path: Path) -> None:
79
+ (tmp_path / "go.mod").write_text("module example.com/m\n")
80
+ source = tmp_path / "main.go"
81
+ source.touch()
82
+
83
+ [plan] = _plans(source, tmp_path, "go vet")
84
+
85
+ assert plan.check == ("go", "vet", ".")
86
+ assert plan.cwd == tmp_path.resolve()
87
+
88
+
89
+ def test_go_vet_does_not_run_outside_a_module(tmp_path: Path) -> None:
90
+ (tmp_path / "main.go").touch()
91
+
92
+ assert _plans(tmp_path, tmp_path, "go vet") == []
93
+
94
+
95
+ def test_go_vet_runs_inside_each_nested_module(tmp_path: Path) -> None:
96
+ (tmp_path / "tools").mkdir()
97
+ (tmp_path / "tools" / "go.mod").write_text("module example.com/t\n")
98
+ (tmp_path / "tools" / "gen.go").touch()
99
+
100
+ [plan] = _plans(tmp_path, tmp_path, "go vet")
101
+
102
+ assert plan.check == ("go", "vet", "./...")
103
+ assert plan.cwd == (tmp_path / "tools").resolve()
104
+
105
+
106
+ def test_go_vet_skips_a_module_whose_go_is_all_nested(tmp_path: Path) -> None:
107
+ (tmp_path / "go.mod").write_text("module example.com/m\n")
108
+ (tmp_path / "tools").mkdir()
109
+ (tmp_path / "tools" / "go.mod").write_text("module example.com/t\n")
110
+ (tmp_path / "tools" / "gen.go").touch()
111
+
112
+ [plan] = _plans(tmp_path, tmp_path, "go vet")
113
+
114
+ assert plan.cwd == (tmp_path / "tools").resolve()
@@ -198,7 +198,7 @@ wheels = [
198
198
 
199
199
  [[package]]
200
200
  name = "readability-cli"
201
- version = "0.11.0"
201
+ version = "0.12.0"
202
202
  source = { editable = "." }
203
203
  dependencies = [
204
204
  { name = "click" },