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 checkur format: Format files as each language's usual formatter does, such as black, prettier, and rustfmtur init: Set a project up for Ur: run ur check as each coding agent's stop hookur lint: Report duplicated code and data, expressions that do nothing, tests that cannot fail, and other mistakesur report: Report opportunities to make the code smaller: code of one shape written out by hand in many places
ur check
Lint a directory, reporting findings in files changed since the last clean check.
ur check [OPTIONS] [DIRECTORY]--fix | Write 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". |
--all | Report findings in every file, not only in files changed since the last clean check. |
<DIRECTORY> | Directory to check; defaults to the current directory. |
ur format
Format files as each language's usual formatter does, such as black, prettier, and rustfmt.
ur format [OPTIONS] <FILES...>--check | Write nothing; list the files that would change and fail if any would. |
--fix | Write the formatting, as ur format does without --check; accepted so that --fix writes fixes in ur format, ur lint, and ur check alike. |
--verify | Verify 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. |
<FILES> | Files to format; directories are searched for source files, skipping ignored paths. |
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. |
--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-projects | Report 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. |
--trivial | Report 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-vendored | Also 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. |
--explain | Print 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. |
--fix | Apply 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. |
--undo | Put back the files the last --fix or --suppress in this project changed, except those changed since, instead of linting. |
--suppress | Accept every finding left: write an ur-allow comment above each of its locations instead of reporting it. |
--suppressions | List 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; repeat to run several. Otherwise every rule runs. The rules are listed in Rules. |
--rules | List 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 opportunities to make the code smaller: code of one shape written out by hand in many places.
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. |
--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-projects | Report 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. |
--trivial | Report 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-vendored | Also 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. |
--rule <RULE> | Run only this opportunity rule; repeat to run several. Otherwise every one runs. The rules are listed in Rules. |
<FILES> | Files to report on; directories are searched for source files, skipping ignored paths and vendored and generated code. By default .. |