Rules

Ur has 37 lint rules. ur check and ur lint run the rules that are on by default, and an optional rule once a project turns it on or names it with --rule. ur report runs the opportunities. Each rule's page shows an example and what Ur prints for it.

Code

Code that does nothing, says the same thing twice, or misuses what it touches.

duplicated-dataThe same literal values are written out in more than one placeOn by default
mutated-while-iteratingA loop resizes the collection it walksOn by default
negated-operatornot written before a membership or identity testOn by default
no-commentsAn ordinary comment outside the file's headerOptional
semantic-cloneCode with the same behavior appears in more than one placeOn by default
stray-env-varEnvironment variables are used outside an env fileOn by default
trivial-expressionAn expression always gives the same answer, or hands back one of its inputsOn by default

Tests

Tests that cannot fail, or whose failure would not say where to look, from Google's Testing Blog and its Effective Testing.

circular-expectationA test computes the value it expectsOn by default
logic-in-testLogic in a test hides what it checksOn by default
missing-assertionA test checks nothingOn by default
opaque-testA test asserts but writes no value of its ownOn by default
overloaded-testA test checks one scenario, then sets up and checks an unrelated oneOn by default
repeated-argumentA call is given the same value for two parametersOn by default
tautological-assertionAn assertion compares a value with itselfOn by default
trivial-inputsA test passes the code it tests only default valuesOn by default
uninformative-assertionAn assertion is given only the result of a comparisonOn by default
vacuous-assertionAn assertion that cannot failOn by default

Lean proofs

Theorems that rest on proofs Lean has not checked.

hand-written-dualA Lean theorem that states another's order dual, written by handOptional
rests-on-unprovedA Lean theorem whose proof reads a declaration that is not provedOn by default
unchecked-proofA Lean proof that Lean takes on trust rather than checksOn by default

Urscal grammars

Grammar rules that never match, or conditions that change nothing.

grammar-dead-conditionA condition tag that holds for no release, dialect, or featureOn by default
grammar-redundant-conditionA condition tag that holds wherever its construct can occurOn by default
grammar-shadowed-alternativeAn alternative of an ordered choice that an earlier alternative always winsOn by default
grammar-unreachable-sortA sort that no start rule reachesOn by default

Text

Optional rules over a file's text, for projects that want them: off until a project's ur.toml or --rule turns one on.

ad-hoc-motionA transition or animation written ad hocOptional
deep-nestingA line indented deeper than its project allowsOptional
hardcoded-colorA color written out instead of a theme tokenOptional
hardcoded-fontA font stack written out instead of a theme tokenOptional
inline-svgAn SVG drawn inline in component sourceOptional
long-fileA file longer than its project allowsOptional
stray-emojiAn emoji in a fileOptional
stray-todoA marker of work left for laterOptional

Opportunities

Code of one shape written out by hand in many places, which ur report ranks by the lines sharing it would save. They never fail a check.

boilerplate-recursionA recursive walk over a type is written out by hand, arm by armRuns under ur report
constructor-boilerplateOne tree of constructors is built by hand at many sitesRuns under ur report
duplicated-name-listOne set of names is written out by hand in several placesRuns under ur report
near-miss-cloneBlocks of code are alike but for a few names or literalsRuns under ur report
suppression-debtMany ur-allow comments excuse code of one shapeRuns under ur report