Skip to content

Configure checks

Use sprawl-guard.toml in the repository root to configure checks. Add only the settings you want to change. Everything else keeps its default. The configuration reference lists every setting.

These are the built-in limits. Change any of them:

sprawl-guard.toml
[limits.max_lines_per_file]
production = 400
test = 800
[limits.max_direct_files_per_directory]
production = 10
test = 10

Test files have their own limits. By default, a file is a test file when its path matches a common test pattern, such as tests/** or **/*.test.*. To use your own patterns, set [tests].globs:

sprawl-guard.toml
[tests]
globs = ["tests/**", "**/*_test.py"]

This list replaces the default patterns, so include any of them you still need.

Sprawl Guard counts only lines of code by default. To also count comments or blank lines, set count_lines = ["comments", "blank_lines"] under [limits.max_lines_per_file].

Sprawl Guard checks every file written in a language it recognizes. It skips hidden files and directories, and anything that .gitignore or a similar ignore file excludes. Run sprawl-guard languages --detected to see which languages it finds in the repository.

To skip generated or third-party code, exclude it:

sprawl-guard.toml
[files]
extend_exclude = ["vendor/**", "src/generated/**"]

To stop checking a language, disable it:

sprawl-guard.toml
[languages.markdown]
enabled = false

To give some paths different limits, add an override with a reason:

sprawl-guard.toml
[[overrides]]
paths = ["src/legacy/**"]
max_lines_per_file = { production = 1000 }
reason = "Legacy subsystem, scheduled for removal"

Use an override for an exception you intend to keep. For a violation you intend to fix, record it in the ratchet file instead.

When a result surprises you, ask Sprawl Guard how it treats the path:

Terminal window
pnpm exec sprawl-guard explain src/example.rs

explain shows whether the path is checked, its language, whether it is a test file, its limits, and the overrides that apply to it. For a path that doesn’t exist yet, it shows the language and whether it would be a test file, so you can check where a new file would land. To see the whole configuration with defaults filled in, run sprawl-guard config resolved.

© 2026 Konstantin Pozin