Skip to main content

Analyzers Overview

Revet's domain analyzers scan files line-by-line for patterns that signal bugs, security issues, or anti-patterns. They run in parallel via rayon and don't require AST parsing.

Enable / disable

All analyzers are toggled in .revet.toml:

[modules]
security = true # default on
ml = true # default on
cycles = true # default on
infra = false
react = false
async_patterns = false
dependency = false
error_handling = false
complexity = false
complexity_threshold = 10 # warn above N, error above 2×N
dead_imports = false
dead_code = false
toolchain = false
hardcoded_endpoints = false
magic_numbers = false
test_coverage = false
duplication = false
duplication_min_lines = 6 # minimum block size for duplicate detection

Built-in analyzers

AnalyzerPrefixDefaultWhat it catches
SecuritySEC-, SQL-, CMD-, DESER-, SSRF-, PATH-, LOG-onHardcoded secrets, SQL injection, command injection, insecure deserialization, SSRF, path traversal, sensitive data in logs
ML PipelineML-onData leakage, pickle, hardcoded paths
InfrastructureINFRA-offTerraform, K8s, Docker misconfigs
React HooksHOOKS-offRules of Hooks violations
Async PatternsASYNC-offAsync/await anti-patterns
DependencyDEP-offWildcard imports, unpinned versions
Error HandlingERR-offEmpty catches, bare except:
ToolchainTOOL-offCI tools not declared in manifests
Hardcoded EndpointsENDPT-offHardcoded IPs and production/staging URLs
Magic NumbersMAGIC-offUnnamed numeric literals that should be named constants
DuplicationDUP-offCopy-paste code blocks across files (sliding-window hash)
Custom RulesCUSTOM-Your own regex rules

Graph analyzers

Graph analyzers query the code dependency graph and run after file parsing:

AnalyzerPrefixDefaultWhat it catches
Circular ImportsCYCLE-onImport cycles between files
ComplexityCMPLX-offOverly long/complex functions (length, params, cyclomatic, nesting)
Dead ImportsDIMPORT-offImports never used within the file
Unused ExportsDEAD-offExported symbols never imported elsewhere
Test Coverage GapsCOV-offPublic functions/classes with no mention in any test file

Suppression

Silence a finding inline with a revet-ignore comment:

password = "test-fixture"  # revet-ignore SEC
api_key = get_key() # revet-ignore SEC SQL

Or suppress by ID in .revet.toml:

[ignore]
findings = ["SEC-003", "DEP-001"]