Skip to main content

ros2inspector watch

Keep a terminal open while you work: watch re-runs policy validation, or the built-in audit with --audit, whenever a source, interface, launch, config or build file changes, or a README or test file that affects a package's health score. After the first run it prints only new and resolved findings.

Usage​

ros2inspector watch [PATH | -C PATH] [--policy FILE | --audit] [-i SECONDS] [--fail-on error|warning|info] [--once] [--verbose] [--no-cache]

PATH defaults to the current directory.

Options​

OptionDefaultDescription
-C, --path.Workspace root (same as PATH)
--policy, -p<workspace>/ros2inspector_policy.yamlPolicy file; editing it reloads it
--auditfalseUse the built-in audit rules instead of a policy file
--interval, -i3.0Polling interval in seconds (at least 0.5)
--fail-onerrorSeverity that makes the exit code 1: error, warning or info
--oncefalseRun a single validation and exit, for scripts
--verbosefalseShow tracebacks for analysis errors
--no-cachefalseRe-parse source on every change

Exit codes​

On Ctrl+C, or after --once, the exit code reflects the last run:

CodeMeaning
0Clean
1Findings at or above --fail-on
2Invalid policy
3Workspace or analysis error
130Stopped before the first run finished

Examples​

ros2inspector watch --audit
ros2inspector watch ~/robot_ws --policy my_policy.yaml --interval 5
ros2inspector watch --once --fail-on warning