Repository navigation
[Linting Rule] Call Contracts
Generated from 'wiki-linter.ts' on 2026-11-13, 12:11:51 UTC (v2.17.6), do not edit directly.
Call Contracts [overview]
This rule is a best-effort rule.
Finds calls that hand a function a value its contract rules out, or leave out an argument it needs, so they fail whenever they run.
This linting rule is implemented in src/linter/rules/call-contracts.ts.
f <- function(x, n) { stopifnot(length(x) >= n); x }
f(1:3, 5)
g <- function(how = c("fast", "exact")) match.arg(how)
g("slow")
combn(4, -1)
strsplit(1, "a")The linting query can be used to run this rule on the above example:
[ { "type": "linter", "rules": [ { "name": "call-contracts", "config": {} } ] } ]Results (prettified and summarized):
Query: linter (105 ms)
╰ Call Contracts (call-contracts):
╰ uncertain:
╰ call of f fails its contract at 2.1-9
╰ call of g fails its contract at 4.1-9
╰ call of combn fails its contract at 5.1-12
╰ call of strsplit fails its contract at 6.1-16
More examples are the test cases in test/functionality/linter/lint-call-contracts.test.ts.
Currently maintained by Florian Sihler and Oliver Gerstl at Ulm University
Email | GitHub | Penguins | Portfolio
- 🧑💻 Developer Onboarding
- 💻 Setup
- 👓 Overview
- 🪟 Interfacing with flowR
- 🌋 Core
- 🧹 Testing & Linting (Benchmark Page)
⁉️ FAQ- ℹ️ Extra Information