-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
A-lintArea: New lintsArea: New lintsL-restrictionLint: Belongs in the restriction lint groupLint: Belongs in the restriction lint group
Description
What it does
Disallows usage of any conditional compilation that always excludes code from test builds.
Advantage
- Prevents code being excluded from tests builds. Preventing the case where a codebase appears to have 100% coverage while having untested code.
- Enforces simplicity in testing, guarding against excessive mocking anti-pattern.
Drawbacks
- May prevent rare legitimate use cases for excluding code from test runs.
Example
The following would trigger this lint:
#[cfg(not(test))]
#[cfg(all(debug_assertions, not(test)))]
#[cfg(not(any(not(debug_assertions), test)))]
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsL-restrictionLint: Belongs in the restriction lint groupLint: Belongs in the restriction lint group