(ctx: Context, files: list[pathlib.Path])
| 377 | |
| 378 | |
| 379 | def check_stray(ctx: Context, files: list[pathlib.Path]) -> int: |
| 380 | exitcode = 0 |
| 381 | exclude_pathlib_paths: tuple[pathlib.Path, ...] |
| 382 | exclude_paths: tuple[str, ...] |
| 383 | |
| 384 | exclude_pathlib_paths = ( |
| 385 | DOCS_DIR / "_inc", |
| 386 | DOCS_DIR / "ref" / "cli" / "_includes", |
| 387 | DOCS_DIR / "ref" / "cli", |
| 388 | DOCS_DIR / "ref" / "configuration", |
| 389 | DOCS_DIR / "ref" / "file_server" / "backends.rst", |
| 390 | DOCS_DIR / "ref" / "file_server" / "environments.rst", |
| 391 | DOCS_DIR / "ref" / "file_server" / "file_roots.rst", |
| 392 | DOCS_DIR / "ref" / "internals", |
| 393 | DOCS_DIR / "ref" / "modules" / "all" / "salt.modules.inspectlib.rst", |
| 394 | DOCS_DIR / "ref" / "peer.rst", |
| 395 | DOCS_DIR / "ref" / "publisheracl.rst", |
| 396 | DOCS_DIR / "ref" / "python-api.rst", |
| 397 | DOCS_DIR / "ref" / "states" / "aggregate.rst", |
| 398 | DOCS_DIR / "ref" / "states" / "altering_states.rst", |
| 399 | DOCS_DIR / "ref" / "states" / "backup_mode.rst", |
| 400 | DOCS_DIR / "ref" / "states" / "compiler_ordering.rst", |
| 401 | DOCS_DIR / "ref" / "states" / "extend.rst", |
| 402 | DOCS_DIR / "ref" / "states" / "failhard.rst", |
| 403 | DOCS_DIR / "ref" / "states" / "global_state_arguments.rst", |
| 404 | DOCS_DIR / "ref" / "states" / "highstate.rst", |
| 405 | DOCS_DIR / "ref" / "states" / "include.rst", |
| 406 | DOCS_DIR / "ref" / "states" / "layers.rst", |
| 407 | DOCS_DIR / "ref" / "states" / "master_side.rst", |
| 408 | DOCS_DIR / "ref" / "states" / "ordering.rst", |
| 409 | DOCS_DIR / "ref" / "states" / "parallel.rst", |
| 410 | DOCS_DIR / "ref" / "states" / "providers.rst", |
| 411 | DOCS_DIR / "ref" / "states" / "requisites.rst", |
| 412 | DOCS_DIR / "ref" / "states" / "startup.rst", |
| 413 | DOCS_DIR / "ref" / "states" / "testing.rst", |
| 414 | DOCS_DIR / "ref" / "states" / "top.rst", |
| 415 | DOCS_DIR / "ref" / "states" / "vars.rst", |
| 416 | DOCS_DIR / "ref" / "states" / "writing.rst", |
| 417 | DOCS_DIR / "topics", |
| 418 | ) |
| 419 | exclude_paths = tuple( |
| 420 | str(p.relative_to(tools.utils.REPO_ROOT)) for p in exclude_pathlib_paths |
| 421 | ) |
| 422 | files = build_docs_paths(files) |
| 423 | for path in files: |
| 424 | if not str(path).startswith( |
| 425 | str((DOCS_DIR / "ref").relative_to(tools.utils.REPO_ROOT)) |
| 426 | ): |
| 427 | continue |
| 428 | if str(path).startswith(exclude_paths): |
| 429 | continue |
| 430 | if path.name in ("index.rst", "glossary.rst", "faq.rst", "README.rst"): |
| 431 | continue |
| 432 | if path not in DOC_PATH_TO_PYTHON_MODULE: |
| 433 | contents = path.read_text() |
| 434 | if ".. _virtual-" in contents: |
| 435 | continue |
| 436 | exitcode += 1 |
no test coverage detected