Skip to content

S0005 test-lines

Rule: A crate's test code stays under its line limit.

Code S0005 (stable, never reused)
Id test-lines
Category size
Source spirit_level
Fix by hand

Level per tier

Tier Level Reason
small off
small-workspace off
medium off
big warn test code builds and links too
ai off
embedded off
ui off
egui off
units-strict off
units-paranoid off

Parameters

Name Type Default Meaning
max-lines integer 20000 code lines in tests/, benches/ and examples/ above which a crate is reported

Why

Test code builds too: a crate with a huge tests/ folder relinks its library into every test binary and slows the edit-test loop as much as a big src/. Counted apart from src/ so a well-tested crate is not pushed to split its library.

How to fix

Move integration tests into a test-only crate (a tests layer), or split the crate under test.

Configure

[lints.test-lines]
level = "deny"
max-lines = 20000
reason = "why this project wants it at this level"

Allow one finding in the code with // spirit-level: allow(test-lines) <reason> (waivers); the code works there too, as in [lints.S0005].