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-data | The same literal values are written out in more than one place | On by default |
mutated-while-iterating | A loop resizes the collection it walks | On by default |
negated-operator | not written before a membership or identity test | On by default |
no-comments | An ordinary comment outside the file's header | Optional |
semantic-clone | Code with the same behavior appears in more than one place | On by default |
stray-env-var | Environment variables are used outside an env file | On by default |
trivial-expression | An expression always gives the same answer, or hands back one of its inputs | On 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-expectation | A test computes the value it expects | On by default |
logic-in-test | Logic in a test hides what it checks | On by default |
missing-assertion | A test checks nothing | On by default |
opaque-test | A test asserts but writes no value of its own | On by default |
overloaded-test | A test checks one scenario, then sets up and checks an unrelated one | On by default |
repeated-argument | A call is given the same value for two parameters | On by default |
tautological-assertion | An assertion compares a value with itself | On by default |
trivial-inputs | A test passes the code it tests only default values | On by default |
uninformative-assertion | An assertion is given only the result of a comparison | On by default |
vacuous-assertion | An assertion that cannot fail | On by default |
Lean proofs
Theorems that rest on proofs Lean has not checked.
hand-written-dual | A Lean theorem that states another's order dual, written by hand | Optional |
rests-on-unproved | A Lean theorem whose proof reads a declaration that is not proved | On by default |
unchecked-proof | A Lean proof that Lean takes on trust rather than checks | On by default |
Urscal grammars
Grammar rules that never match, or conditions that change nothing.
grammar-dead-condition | A condition tag that holds for no release, dialect, or feature | On by default |
grammar-redundant-condition | A condition tag that holds wherever its construct can occur | On by default |
grammar-shadowed-alternative | An alternative of an ordered choice that an earlier alternative always wins | On by default |
grammar-unreachable-sort | A sort that no start rule reaches | On 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-motion | A transition or animation written ad hoc | Optional |
deep-nesting | A line indented deeper than its project allows | Optional |
hardcoded-color | A color written out instead of a theme token | Optional |
hardcoded-font | A font stack written out instead of a theme token | Optional |
inline-svg | An SVG drawn inline in component source | Optional |
long-file | A file longer than its project allows | Optional |
stray-emoji | An emoji in a file | Optional |
stray-todo | A marker of work left for later | Optional |
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-recursion | A recursive walk over a type is written out by hand, arm by arm | Runs under ur report |
constructor-boilerplate | One tree of constructors is built by hand at many sites | Runs under ur report |
duplicated-name-list | One set of names is written out by hand in several places | Runs under ur report |
near-miss-clone | Blocks of code are alike but for a few names or literals | Runs under ur report |
suppression-debt | Many ur-allow comments excuse code of one shape | Runs under ur report |