Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/assets/threading-guardrails.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
rules:
- description: "Avoid raw threading.Thread; prefer ThreadPoolExecutor"
enabled: true
severity: "medium"
event_types: ["pull_request"]
parameters:
file_patterns: ["**/*.py"]
forbidden_patterns:
- "threading\\.Thread"

- description: "Warn when ThreadPoolExecutor max_workers is greater than 10"
enabled: true
severity: "medium"
event_types: ["pull_request"]
parameters:
file_patterns: ["**/*.py"]
forbidden_patterns:
- "ThreadPoolExecutor\\(max_workers\\s*=\\s*(1[1-9]|[2-9][0-9]|\\d{3,})"
36 changes: 36 additions & 0 deletions docs/getting-started/diff-rule-presets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Diff rule presets (threading guardrails)

These presets use the diff-aware validators already supported by Watchflow. Paste them directly into `.watchflow/rules.yaml` or upload to watchflow.dev as a YAML file. They avoid any unsupported sections (no `actions`, only `description`, `enabled`, `severity`, `event_types`, and `parameters` with `file_patterns`, `require_patterns`, `forbidden_patterns`).

## Preset file

The file `docs/assets/threading-guardrails.yaml` contains ready-to-use rules:

```yaml
rules:
- description: "Avoid raw threading.Thread; prefer ThreadPoolExecutor"
enabled: true
severity: "medium"
event_types: ["pull_request"]
parameters:
file_patterns: ["**/*.py"]
forbidden_patterns:
- "threading\\.Thread"

- description: "Warn when ThreadPoolExecutor max_workers is greater than 10"
enabled: true
severity: "medium"
event_types: ["pull_request"]
parameters:
file_patterns: ["**/*.py"]
forbidden_patterns:
- "ThreadPoolExecutor\\(max_workers\\s*=\\s*(1[1-9]|[2-9][0-9]|\\d{3,})"
```

## How to use on watchflow.dev

1) Click “Upload config” (or paste the YAML directly if enabled).
2) Ensure event type is `pull_request`.
3) Adjust file globs or regexes as needed for your repo.

If the form still shows “Rule not supported,” it means the UI is filtering diff-pattern rules. In that case, use the YAML upload path or apply the config directly in your repo. A follow-up change to the site can whitelist these presets so they appear without warnings.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ nav:
- Getting Started:
- Quick Start: getting-started/quick-start.md
- Configuration: getting-started/configuration.md
- Diff Rule Presets: getting-started/diff-rule-presets.md
- Features & Capabilities:
- Features: features.md
- Comparative Analysis: benchmarks.md
Expand Down