Commands

Ur is one binary, ur. ur check is the command to run after each change: it lints the files changed since its last clean run. ur format formats files, ur lint lints every file it is given, ur report lists opportunities to make the code smaller, and ur init sets a project up for coding agents. ur <command> --help prints what this page lists.

ur check

Lint a directory, reporting findings in files changed since the last clean check.

ur check [OPTIONS] [DIRECTORY]
--fixWrite the fixes of lint findings that have one instead of reporting them.
--hook <HOOK>Run as an agent's stop hook, speaking its protocol: claude for Claude Code and Cursor, codex for Codex, gemini for Gemini CLI, droid for Factory Droid, copilot for GitHub Copilot's CLI. One of "claude", "codex", "gemini", "droid", "copilot".
--allReport findings in every file, not only in files changed since the last clean check.
--include-vendoredCheck vendored and generated code too, which the check leaves out otherwise.
<DIRECTORY>Directory to check; defaults to the current directory.
--expansions <DIRECTORY>For a Cargo workspace, read what a build recorded its macros' invocations to expand to from the .jsonl files of this directory, as ur names --expansions does.

ur format

Format files as each language's usual formatter does, such as black, prettier, and rustfmt.

ur format [OPTIONS] [FILES...]
--checkWrite nothing; list the files that would change and fail if any would.
--fixWrite the formatting, as ur format does without --check; accepted so that --fix writes fixes in ur format, ur lint, and ur check alike.
--whyWith --check, list under each file that would change the gaps its style corrects, each with the rule that decides it, where the style changes only gaps, as RuboCop's and Mathlib's do.
--report <REPORT>With --check --why, the report's format: text, or a SARIF 2.1.0 log with a result for each gap under its rule, whose fix is the gap as the style lays it out. One of "text", "sarif". By default text.
--rule <RULE>Lay out only the gaps this rule of the file's style decides, such as space@rubocop::Spacing:56, and keep every other gap as written, where the style changes only gaps; repeat for several. --check --why names the rule behind each gap. The rules are listed in Rules.
--verifyVerify each formatted file: it must parse as the original did, differ only in layout, and format again to itself; a file that fails keeps its source.
--profile <PROFILE>Language profile to format its language's files as, such as sql-postgres-18, as if ur.toml targeted it; other languages' files keep their own.
--style <STYLE>Style to format in, such as river, for the files whose language has it; others keep the style their configuration chooses.
--rulesList the rules each style that changes only gaps decides gaps by, the names --rule takes, instead of formatting; with --style, that style's alone.
--include-vendoredAlso format the vendored and generated files a search of a directory finds: those under directories of other people's code, such as vendor or third_party, those .gitattributes marks linguist-vendored or linguist-generated, and those whose header says not to edit them.
<FILES>Files to format; directories are searched for source files, hidden ones too, skipping ignored paths, caches, a build's output, and vendored and generated code.

ur init

Set a project up for Ur: run ur check as each coding agent's stop hook.

ur init [DIRECTORY]
<DIRECTORY>The project's root directory; the current directory by default.

ur lint

Report duplicated code and data, expressions that do nothing, tests that cannot fail, and other mistakes.

ur lint [OPTIONS] [FILES...]
--format <FORMAT>Report format. One of "text", "sarif". By default text.
--output <OUTPUT>Write the report to this file instead of standard output.
--timingsPrint to standard error where the run spent its time, by each step of each file's analysis and each lint module, without the steps inside it, and the files that took longest, each with the most memory its analysis held. Results restored from Ur's cache take no time, so clear UR_CACHE_DIR to see everything.
--min-tokens <MIN_TOKENS>Smallest block of statements to compare, in tokens. By default 25.
--min-function-tokens <MIN_FUNCTION_TOKENS>Smallest function to compare, in tokens. By default 20.
--across-projectsReport clones and duplicated data across projects too, such as two crates that are not in one Cargo workspace; otherwise code and data are compared only with those of their own project.
--trivialReport every clone the token thresholds admit, including small fragments of otherwise different code, one-line functions, and repeated steps in one block.
--profile <PROFILE>Profile to parse and analyze a language's files with, such as python-2.7; give at most one per language. Otherwise each file's project decides: a Rust file uses its Cargo.toml edition, and a Python file that the latest profile rejects is tried as Python 2.7.
--include-vendoredAlso read the vendored and generated files a search of a directory finds: those under directories of other people's code, such as vendor or third_party, and those .gitattributes marks linguist-vendored or linguist-generated.
--solver <PROGRAM>Ask this SMT solver, z3, cvc5, bitwuzla, or another program that reads SMT-LIB on its standard input, whether the path to each taint finding's sink can run: a finding on a path that cannot is left out, and the others name the values that reach the sink. It also runs decided-condition, which asks whether the tests before each test decide it. auto takes the first of the three that is installed.
--explainPrint every unit's normalized form and fingerprint instead of findings, with the names each theorem reads, the constants each file declares, and each function's events and paths.
--fixApply the fixes of findings that have one, then report the findings left.
--batch <FILES>Analyse at most this many files at a time, keeping what the rules about the whole project compare on disk, for a project too large to analyse at once; the findings are the same.
--undoPut back the files the last --fix or --suppress in this project changed, except those changed since, instead of linting.
--suppressAccept every finding left: write an ur-allow comment above each of its locations instead of reporting it.
--suppressionsList the findings ur-allow comments suppress, where each comment is, and how many each rule has, instead of the findings left.
--rule <RULE>Run only this rule, one of Ur's or one a lint module given with --lints or in ur.toml states; repeat to run several. Otherwise every rule runs. The rules are listed in Rules.
--lints <MODULE>Also run the lints the Urscal lint module at this path states, on the files of the language its name starts with, as rust::Names lints Rust; repeat to give several. A project gives its own with lints in the [lint] table of its ur.toml.
--rulesList the rules, with the instruction each gives and its source, instead of linting.
<FILES>Files to lint; directories are searched for source files and Urscal modules (.rsc), skipping ignored paths and vendored and generated code.

ur report

Report everything the project turns on, ranked by importance: leads, mistakes, then opportunities to make the code smaller.

ur report [OPTIONS] [FILES...]
--format <FORMAT>Report format. One of "text", "sarif". By default text.
--output <OUTPUT>Write the report to this file instead of standard output.
--timingsPrint to standard error where the run spent its time, by each step of each file's analysis and each lint module, without the steps inside it, and the files that took longest, each with the most memory its analysis held. Results restored from Ur's cache take no time, so clear UR_CACHE_DIR to see everything.
--min-tokens <MIN_TOKENS>Smallest block of statements to compare, in tokens. By default 25.
--min-function-tokens <MIN_FUNCTION_TOKENS>Smallest function to compare, in tokens. By default 20.
--across-projectsReport clones and duplicated data across projects too, such as two crates that are not in one Cargo workspace; otherwise code and data are compared only with those of their own project.
--trivialReport every clone the token thresholds admit, including small fragments of otherwise different code, one-line functions, and repeated steps in one block.
--profile <PROFILE>Profile to parse and analyze a language's files with, such as python-2.7; give at most one per language. Otherwise each file's project decides: a Rust file uses its Cargo.toml edition, and a Python file that the latest profile rejects is tried as Python 2.7.
--include-vendoredAlso read the vendored and generated files a search of a directory finds: those under directories of other people's code, such as vendor or third_party, and those .gitattributes marks linguist-vendored or linguist-generated.
--solver <PROGRAM>Ask this SMT solver, z3, cvc5, bitwuzla, or another program that reads SMT-LIB on its standard input, whether the path to each taint finding's sink can run: a finding on a path that cannot is left out, and the others name the values that reach the sink. It also runs decided-condition, which asks whether the tests before each test decide it. auto takes the first of the three that is installed.
--rule <RULE>Run only this rule, of any kind, one of Ur's or one a module in ur.toml states; repeat to run several. Otherwise every rule the project turns on runs, and every opportunity rule. The rules are listed in Rules.
--merges <N>Replay at most this many merges on HEAD's first-parent line, newest first, for the hot files. By default 1000.
--no-hot-filesLeave out the hot files, the files that conflicted most when the repository's merges are replayed.
<FILES>Files to report on; directories are searched for source files, skipping ignored paths and vendored and generated code. By default ..