Pattern Guard is a powerful VS Code extension designed specifically for Dart and Flutter developers. It scans your workspace or individual files for 7 major architectural anti-patterns based on industry-standard reference literature, helping you reduce technical debt and maintain a clean, scalable codebase.
Features
Pattern Guard detects the following 7 anti-patterns:
- Copy-Paste Programming: Flags duplicate code blocks (≥ 8 lines).
- Spaghetti Code: Flags functions with deep nesting depth (> 4 levels).
- Non-Functional Requirements: Detects missing documentation/comments on public declarations.
- God Object: Flags classes with too many methods (> 20) or files that are too long (> 500 lines).
- Shotgun Surgery: Detects magic literals (URLs, tokens, etc.) scattered across 3+ files instead of being in a centralized constants file.
- Lava Flow: Detects leftover
TODO,FIXMEcomments and blocks of commented-out code. - Golden Hammer: Flags over-reliance on a single custom package or widget that dominates your project files.
How to Use
- Open your Dart/Flutter project in VS Code.
- Click the Pattern Guard shield icon in the left Activity Bar to open the dashboard.
- Click ▶ Analyze Project to scan your entire workspace, or click File to scan only the currently active
.dartfile. - Click on any of the 7 anti-pattern cards to view the detected issues.
- Click ↗ open on any issue to jump straight to the exact file and line in your code!
Extension Commands
You can also run Pattern Guard from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
Pattern Guard: Scan ProjectPattern Guard: Analyze Active FilePattern Guard: Open Dashboard
Requirements
- VS Code 1.85.0 or higher.
- A Dart or Flutter workspace.
Release Notes
0.1.0
- Initial release.
- Added all 7 core detectors.
- Beautiful, responsive dashboard with interactive file navigation.