Static Code Analysis
Find suspicious units and uncertainty patterns in Python
unit-uncertainty-audit is an offline AST audit for units and uncertainty patterns in Python source.
overview
What unit-uncertainty-audit does
Statically audit Python source for silent unit and measurement-uncertainty mistakes (stripped units, offset temperatures, population vs sample standard deviation, broken propagation, hard-coded CODATA constants) with K-Dense's audit_units. JSON findings; code is parsed, never run.
Parse Python source without importing or running it. Return JSON findings with rule, severity, line, column, message and remedy, plus file and suppression counts. Heuristics cover stripped units, offset-temperature arithmetic, uncertainty propagation, numpy.std defaults and hardcoded scientific constants.
Recursively scan 1 to 50 Python files of at most 4 MiB each. In-file audit-units:ignore suppressions are honored and counted. Findings remain successful data through --fail-on none; a syntax error in any file fails without output. No numerical experiment or network lookup is performed.
Packaged version: 065b734. Upstream license: MIT.
use cases
Where unit-uncertainty-audit fits
Review standard-deviation assumptions
Flag numpy.std patterns that need a deliberate degrees-of-freedom choice.
Locate hardcoded constants
Find scientific constants that may belong in a maintained constants library.
Triage scientific-code heuristics
Receive rule locations and suggested remedies for manual review.
reference
unit-uncertainty-audit inputs and flags
| Name | Type | Flag | Description |
|---|---|---|---|
| source | FOLDER | --source | Folder with 1–50 Python files (searched recursively), each at most 4 MiB. |
Showing key inputs. unit-uncertainty-audit exposes 1 inputs in total.
example
Run unit-uncertainty-audit
python3 /app/run.py --source ./source ./outputguidance
Choosing unit-uncertainty-audit
Use unit-uncertainty-audit to flag scientific-code patterns for review. It does not prove physical correctness, validate a model or replace numerical tests. General type checkers and linters do not establish unit or uncertainty correctness either.
faq
unit-uncertainty-audit questions
related
More Static Code Analysis tools
bandit
Python source in, JSON security findings out.
gitleaks
Detect hardcoded secrets in git repos and plain directories.
gosec
Go AST security scanner for credentials, crypto, and injection.
guarddog
A package coordinate in, indicator hits out.
malcontent-scan
A package coordinate in, behavior findings out.
osv-malicious
A package coordinate in, malware advisory rows out.
Run unit-uncertainty-audit yourself
The saved fixture verifier confirmed two files scanned, four findings, including UNC002 on line 4 and CONST001 on line 5, with no findings in clean.py. Saved counts were one medium and three low findings. The complete native report was not retained. The command shows the container entrypoint with example paths.
Facts on this page come from the live Trickest tool library.