MCPcopy Create free account
hub / github.com/codespell-project/codespell / run_codespell_stdin

Function run_codespell_stdin

codespell_lib/tests/test_basic.py:1438–1454  ·  view source on GitHub ↗

Run codespell in stdin mode and return number of lines in output.

(
    text: str,
    args: tuple[Any, ...],
    cwd: Optional[Path] = None,
)

Source from the content-addressed store, hash-verified

1436
1437
1438def run_codespell_stdin(
1439 text: str,
1440 args: tuple[Any, ...],
1441 cwd: Optional[Path] = None,
1442) -> int:
1443 """Run codespell in stdin mode and return number of lines in output."""
1444 proc = subprocess.run( # noqa: S603
1445 ["codespell", *args, "-"], # noqa: S607
1446 cwd=cwd,
1447 input=text,
1448 capture_output=True,
1449 encoding="utf-8",
1450 check=False,
1451 )
1452 output = proc.stdout
1453 # get number of lines
1454 return output.count("\n")
1455
1456
1457def test_stdin(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:

Callers 1

test_stdinFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…