Rules

Ur has 111 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.

account-enumerationA sign-in that tells whether an account existsRuns under ur scan
architecture-violationA package depends on one that the project's declared architecture does not let it useOptional
await-raceAn asynchronous function writes a shared value from a read it made before an awaitOn by default
buffer-overflowUntrusted input used as the length of a copyRuns under ur scan
code-injectionUntrusted input run as code or used to choose a method or classRuns under ur scan
command-injectionUntrusted input run as a shell commandRuns under ur scan
cross-site-scriptingUntrusted input printed as HTML without escapingRuns under ur scan
dangerous-accessible-attributeattr_accessible letting a request set a privilege or a foreign keyRuns under ur scan
data-raceA thread writes a variable another thread can use at the same time, with no lock both holdOn by default
deadlockThreads that can run at once take locks in orders that form a cycleOn by default
decided-conditionA test the tests before it already decideOn by default
default-routesA route that lets a request choose the action, so every public method is oneRuns under ur scan
dependency-cyclePackages of the project depend on each other in a cycleOptional
duplicated-dataThe same literal values are written out in more than one placeOn by default
fixed-ivAn encryption IV written into the codeRuns under ur scan
format-stringUntrusted input used as a format stringRuns under ur scan
hardcoded-secretA secret written into the codeRuns under ur scan
insecure-configurationA setting that turns off a protectionRuns under ur scan
jdk-base64-intrinsicUntrusted input decoded by the JDK's Base64 decoder, which can overflow its bufferRuns under ur scan
junk-fileA file an editor, the operating system, or a language's tools left behindOn by default
language-limitA place in the project holds more or fewer files of a language than its limitOptional
layout-mismatchA directory holds an entry its declared layout does not name, or lacks one it requiresOptional
logic-in-entry-pointAn entry point does work itself instead of handing it offOptional
markup-after-sanitizeMarkup written into text after it was sanitized or escapedRuns under ur scan
mass-assignmentA model's attributes set from a request without a list that leaves out privilegesRuns under ur scan
misplaced-fileA file is in a language its place in the project does not allowOptional
missing-csrf-protectionA controller that accepts forged requestsRuns under ur scan
missing-subresource-integrityA script or style sheet loaded from another host without an integrity hashRuns under ur scan
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
open-redirectA redirect to a location a request choseRuns under ur scan
path-traversalA file read or written at a path input choseRuns under ur scan
predictable-tokenA token built from values anyone can guessRuns under ur scan
regex-dosInput matched against a pattern that can take exponential or quadratic timeRuns under ur scan
regex-injectionInput written into a regular expressionRuns under ur scan
rsc-ancestor-walkthe nearest ancestor of a kind found by matching ancestors(n) by handOn by default
rsc-binding-counta name taken to be bound once by counting the patterns that spell itOptional
rsc-binding-scanwhat a name is bound to, found by scanning the blocks around it for letsOptional
rsc-built-replacementa rewrite whose replacement joins a node's text with literal text, as unparse(e) + ".opts()"Optional
rsc-descendant-filterthe parts of a node of one kind enumerated as x <- descendants(t), x is KindOn by default
rsc-enclosing-guardthe conditions a node runs under, found by the ifs and loops among its ancestorsOptional
rsc-implied-declarationa declaration Ur makes for every rule module, written out againOn by default
rsc-last-itemthe last item of a list written as xs[size(xs) - 1]On by default
rsc-memo-candidatea function of no node that walks the whole file, asked at each node it is called atOptional
rsc-spelled-comparisona node's text compared with a literal, as unparse(x) == "pub"On by default
rsc-statement-orderone statement taken to run before another by their places in a block, as index(s) < index(t)Optional
sanitizer-allows-styleA sanitizer configured to keep style or class in the HTML it lets throughRuns under ur scan
semantic-cloneCode with the same behavior appears in more than one placeOn by default
shortcode-injectionUntrusted input run as WordPress shortcodesRuns under ur scan
signal-handlerA signal handler shares a global with the code it interrupts, or calls a function that is not async-signal-safeOn by default
sql-injectionUntrusted input written into SQLRuns under ur scan
ssrfA request sent to a URL a request choseRuns under ur scan
stray-env-varEnvironment variables are used outside an env fileOn by default
stub-mask-overflowA mask built from a length that can wrap, in machine code a stub generator writesRuns under ur scan
timing-attackA secret compared with input by ==Runs under ur scan
toctouA file checked by its path is then used by the same path, and another process can change it in betweenOn by default
trivial-expressionAn expression always gives the same answer, or hands back one of its inputsOn by default
unanchored-format-validationA format validation whose pattern uses ^ or $, which match at any lineRuns under ur scan
unsafe-deserializationUntrusted input loaded as Ruby objectsRuns under ur scan
urscal-errorA Urscal module that does not loadOn by default
view-cross-site-scriptingInput a view prints unescaped or writes into a scriptRuns under ur scan
vue-html-injectionUser data rendered as HTML by v-html, v-safe-html, or innerHTMLRuns under ur scan
vue-untrusted-bindAn object the component did not build spread onto a component chosen at run timeRuns under ur scan
weak-cryptographyA cryptographic primitive that no longer protects what it is givenRuns under ur scan
weak-password-hashA password hashed with a fast digestRuns under ur scan
weak-password-policyA password policy weaker than OWASP ASVS asks forRuns under ur scan
weak-randomnessBytes that must be secret read from a predictable generatorRuns under ur scan
weak-rsaAn RSA key shorter than 2048 bits, or RSA encryption without OAEP paddingRuns under ur scan

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
fixed-pathA test reads or writes a fixed pathOn by default
float-equalityAn assertion compares floating-point values exactlyOn by default
global-stubA test replaces a library function by assigning to itOn by default
logic-in-testLogic in a test hides what it checksOn by default
missing-assertionA test checks nothingOn by default
mock-countA test makes or stubs more test doubles than one or twoOn by default
mock-returns-mockA test double returns another test doubleOn by default
opaque-testA test asserts but writes no value of its ownOn by default
outside-processA test reaches the network or starts another processOn by default
over-specified-verifyA verification fixes every argument of the call it verifiesOn by default
overloaded-testA test checks one scenario, then starts and checks anotherOn by default
real-clockA test reads the clockOn by default
recomputed-in-messageA failure message calls the code under test againOn by default
repeated-argumentA call is given the same value for two parametersOn by default
sleep-in-testA test sleepsOn by default
swallowed-failureA handler catches the failure of the assertion it guardsOn 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
wait-without-timeoutA test waits with no timeoutOn 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