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-enumeration | A sign-in that tells whether an account exists | Runs under ur scan |
architecture-violation | A package depends on one that the project's declared architecture does not let it use | Optional |
await-race | An asynchronous function writes a shared value from a read it made before an await | On by default |
buffer-overflow | Untrusted input used as the length of a copy | Runs under ur scan |
code-injection | Untrusted input run as code or used to choose a method or class | Runs under ur scan |
command-injection | Untrusted input run as a shell command | Runs under ur scan |
cross-site-scripting | Untrusted input printed as HTML without escaping | Runs under ur scan |
dangerous-accessible-attribute | attr_accessible letting a request set a privilege or a foreign key | Runs under ur scan |
data-race | A thread writes a variable another thread can use at the same time, with no lock both hold | On by default |
deadlock | Threads that can run at once take locks in orders that form a cycle | On by default |
decided-condition | A test the tests before it already decide | On by default |
default-routes | A route that lets a request choose the action, so every public method is one | Runs under ur scan |
dependency-cycle | Packages of the project depend on each other in a cycle | Optional |
duplicated-data | The same literal values are written out in more than one place | On by default |
fixed-iv | An encryption IV written into the code | Runs under ur scan |
format-string | Untrusted input used as a format string | Runs under ur scan |
hardcoded-secret | A secret written into the code | Runs under ur scan |
insecure-configuration | A setting that turns off a protection | Runs under ur scan |
jdk-base64-intrinsic | Untrusted input decoded by the JDK's Base64 decoder, which can overflow its buffer | Runs under ur scan |
junk-file | A file an editor, the operating system, or a language's tools left behind | On by default |
language-limit | A place in the project holds more or fewer files of a language than its limit | Optional |
layout-mismatch | A directory holds an entry its declared layout does not name, or lacks one it requires | Optional |
logic-in-entry-point | An entry point does work itself instead of handing it off | Optional |
markup-after-sanitize | Markup written into text after it was sanitized or escaped | Runs under ur scan |
mass-assignment | A model's attributes set from a request without a list that leaves out privileges | Runs under ur scan |
misplaced-file | A file is in a language its place in the project does not allow | Optional |
missing-csrf-protection | A controller that accepts forged requests | Runs under ur scan |
missing-subresource-integrity | A script or style sheet loaded from another host without an integrity hash | Runs under ur scan |
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 |
open-redirect | A redirect to a location a request chose | Runs under ur scan |
path-traversal | A file read or written at a path input chose | Runs under ur scan |
predictable-token | A token built from values anyone can guess | Runs under ur scan |
regex-dos | Input matched against a pattern that can take exponential or quadratic time | Runs under ur scan |
regex-injection | Input written into a regular expression | Runs under ur scan |
rsc-ancestor-walk | the nearest ancestor of a kind found by matching ancestors(n) by hand | On by default |
rsc-binding-count | a name taken to be bound once by counting the patterns that spell it | Optional |
rsc-binding-scan | what a name is bound to, found by scanning the blocks around it for lets | Optional |
rsc-built-replacement | a rewrite whose replacement joins a node's text with literal text, as unparse(e) + ".opts()" | Optional |
rsc-descendant-filter | the parts of a node of one kind enumerated as x <- descendants(t), x is Kind | On by default |
rsc-enclosing-guard | the conditions a node runs under, found by the ifs and loops among its ancestors | Optional |
rsc-implied-declaration | a declaration Ur makes for every rule module, written out again | On by default |
rsc-last-item | the last item of a list written as xs[size(xs) - 1] | On by default |
rsc-memo-candidate | a function of no node that walks the whole file, asked at each node it is called at | Optional |
rsc-spelled-comparison | a node's text compared with a literal, as unparse(x) == "pub" | On by default |
rsc-statement-order | one statement taken to run before another by their places in a block, as index(s) < index(t) | Optional |
sanitizer-allows-style | A sanitizer configured to keep style or class in the HTML it lets through | Runs under ur scan |
semantic-clone | Code with the same behavior appears in more than one place | On by default |
shortcode-injection | Untrusted input run as WordPress shortcodes | Runs under ur scan |
signal-handler | A signal handler shares a global with the code it interrupts, or calls a function that is not async-signal-safe | On by default |
sql-injection | Untrusted input written into SQL | Runs under ur scan |
ssrf | A request sent to a URL a request chose | Runs under ur scan |
stray-env-var | Environment variables are used outside an env file | On by default |
stub-mask-overflow | A mask built from a length that can wrap, in machine code a stub generator writes | Runs under ur scan |
timing-attack | A secret compared with input by == | Runs under ur scan |
toctou | A file checked by its path is then used by the same path, and another process can change it in between | On by default |
trivial-expression | An expression always gives the same answer, or hands back one of its inputs | On by default |
unanchored-format-validation | A format validation whose pattern uses ^ or $, which match at any line | Runs under ur scan |
unsafe-deserialization | Untrusted input loaded as Ruby objects | Runs under ur scan |
urscal-error | A Urscal module that does not load | On by default |
view-cross-site-scripting | Input a view prints unescaped or writes into a script | Runs under ur scan |
vue-html-injection | User data rendered as HTML by v-html, v-safe-html, or innerHTML | Runs under ur scan |
vue-untrusted-bind | An object the component did not build spread onto a component chosen at run time | Runs under ur scan |
weak-cryptography | A cryptographic primitive that no longer protects what it is given | Runs under ur scan |
weak-password-hash | A password hashed with a fast digest | Runs under ur scan |
weak-password-policy | A password policy weaker than OWASP ASVS asks for | Runs under ur scan |
weak-randomness | Bytes that must be secret read from a predictable generator | Runs under ur scan |
weak-rsa | An RSA key shorter than 2048 bits, or RSA encryption without OAEP padding | Runs 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-expectation | A test computes the value it expects | On by default |
fixed-path | A test reads or writes a fixed path | On by default |
float-equality | An assertion compares floating-point values exactly | On by default |
global-stub | A test replaces a library function by assigning to it | 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 |
mock-count | A test makes or stubs more test doubles than one or two | On by default |
mock-returns-mock | A test double returns another test double | On by default |
opaque-test | A test asserts but writes no value of its own | On by default |
outside-process | A test reaches the network or starts another process | On by default |
over-specified-verify | A verification fixes every argument of the call it verifies | On by default |
overloaded-test | A test checks one scenario, then starts and checks another | On by default |
real-clock | A test reads the clock | On by default |
recomputed-in-message | A failure message calls the code under test again | On by default |
repeated-argument | A call is given the same value for two parameters | On by default |
sleep-in-test | A test sleeps | On by default |
swallowed-failure | A handler catches the failure of the assertion it guards | 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 |
wait-without-timeout | A test waits with no timeout | 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 |