Static analysis and edge case review for code in Open WebUI.
Designed as a companion to SuperPowersWUI or as a standalone tool.
CodeGuard runs language-appropriate linters against code passed to it and returns structured findings. When a linter is not installed, it falls back to LLM-based analysis. A second LLM pass reviews edge cases that static analysis misses.
| Language | Linter | Fallback |
|---|---|---|
| bash / sh | shellcheck | LLM |
| python | ruff | LLM |
| unknown | — | LLM |
- Open WebUI — tool runs inside the OWUI tool execution environment
- shellcheck — optional, for bash/sh analysis (
dnf install ShellCheck,apt install shellcheck,brew install shellcheck) - ruff — optional, for Python analysis (
pip install ruff)
Neither linter is required. If missing and ENABLE_LLM_FALLBACK is True, CodeGuard uses the active model instead.
- Copy
codeguard_tool.pyinto your Open WebUI tools directory, or paste it via the Tools editor in the OWUI admin panel. - Enable the tool in your workspace or model configuration.
Ask the model to call the tool directly:
Analyze this bash script for issues:
<paste code>
Or explicitly:
Use CodeGuard to analyze this Python function. Language: python.
CodeGuard is designed to be called from SuperPowersWUI pipelines. The [SUPERPOWERS:AUTO-CONTINUE] marker at the end of every response signals the pipeline to proceed automatically after analysis.
| Valve | Type | Default | Description |
|---|---|---|---|
ENABLE_SHELLCHECK |
bool | True |
Enable shellcheck for bash/sh |
ENABLE_RUFF |
bool | True |
Enable ruff for Python |
ENABLE_LLM_FALLBACK |
bool | True |
Fall back to LLM when linter is unavailable |
SHELLCHECK_SEVERITY |
str | style |
Minimum shellcheck severity: error, warning, info, style |
ENABLE_EDGE_CASE_REVIEW |
bool | True |
Run a second LLM pass for edge cases, race conditions, silent failures |
## CodeGuard Analysis
**Language:** python
**Linter:** ruff
### Static Analysis Findings
1. WARNING L12 [E501] Line too long (92 > 88 characters)
### Edge Case Review
1. ERROR — No timeout on the HTTP request; will hang indefinitely on unresponsive hosts.
### Summary
1 static finding(s). 1 edge case finding line(s).
**Verdict: APPROVED**
[SUPERPOWERS:AUTO-CONTINUE]
Verdict is BLOCKED if any ERROR-severity static findings are present, otherwise APPROVED.
MIT — see LICENSE.