Skip to main content

Strictness Levels

Infr supports three strictness levels that control how aggressively it checks your code. This lets you start permissive and increase strictness as your codebase matures.

Levels

LevelBare <- behaviorNullable access without null checkNotes
relaxed (default)Treated as mutable, no warningsNo diagnosticMaximum compatibility with existing R
moderateTreated as mutable, warns "consider const or let"WarningNudges toward explicit intent
strictError: must use const or letErrorFull explicitness required

Configuration

Set the strictness level in infr.toml:

infr.toml
[check]
strictness = "moderate"

Examples

Bare <- assignment

x <- 10
  • relaxed: No diagnostic
  • moderate: Warning [infr]: Consider using const or let for explicit intent
  • strict: Error [infr]: Must use const or let (strict mode)

Nullable access

const val: numeric? <- maybe_get()
val + 1
  • relaxed: No diagnostic
  • moderate: Warning [infr]: val is numeric? (nullable). Consider checking for NULL first.
  • strict: Error [infr]: Cannot pass numeric? to + which expects numeric. Check for NULL first.
  1. Start with relaxed — check your existing R code without changes
  2. Move to moderate — get warnings that guide you toward const/let and null checks
  3. Adopt strict — enforce full explicitness in mature codebases