Custom Patterns
🚧 Coming soon!
Custom pattern detection will allow you to define your own code waste patterns specific to your team's needs.
Planned Features
Pattern Definition
Define custom patterns using:
- Regular expressions for text matching
- AST selectors for structural matching
- Template matching for code patterns
- Semantic rules for behavior detection
Example Configuration (Coming Soon)
{
"customPatterns": [
{
"name": "console-logs",
"description": "Development console.log statements",
"severity": "warning",
"pattern": {
"type": "ast",
"selector": "CallExpression[callee.object.name='console'][callee.property.name='log']"
}
},
{
"name": "deprecated-api",
"description": "Usage of deprecated internal APIs",
"severity": "error",
"pattern": {
"type": "regex",
"match": "oldAPI\\.(\\w+)\\(",
"filePattern": "**/*.js"
}
},
{
"name": "large-functions",
"description": "Functions exceeding complexity threshold",
"severity": "warning",
"pattern": {
"type": "complexity",
"threshold": 20
}
}
]
}
Pattern Types (Planned)
Text Patterns
{
"type": "text",
"contains": ["FIXME", "HACK", "TODO: remove"],
"caseSensitive": false
}
AST Patterns
{
"type": "ast",
"selector": "IfStatement > BlockStatement:empty",
"message": "Empty if block detected"
}
Complexity Patterns
{
"type": "complexity",
"metric": "cyclomatic",
"threshold": 15,
"target": "function"
}
Pattern Sharing (Coming Soon)
Share patterns with the community:
# Export your patterns
vibesweep patterns export my-patterns.json
# Import community patterns
vibesweep patterns import @vibesweep/react-patterns
Use Cases
- Enforce coding standards specific to your team
- Detect anti-patterns in your architecture
- Find legacy code that needs modernization
- Track technical debt with custom markers
- Ensure compliance with security policies
Stay tuned for custom pattern support!
Related
- AI Pattern Detection - Built-in AI patterns
- Configuration File - Current configuration options