mirror of
https://github.com/samiyev/puaros.git
synced 2025-12-27 23:06:54 +05:00
fix: reduce false positives in Repository Pattern detection
- Added 11 new valid DDD repository method patterns - Support for has*(), is*(), exists*(), clear*(), store*() methods - Support for lifecycle methods: initialize(), close(), connect(), disconnect() - Fixes issue where valid DDD patterns were flagged as violations - Better alignment with real-world Domain-Driven Design practices This reduces false positives in projects using cache repositories, connection management, and domain-specific query methods. Version: 0.6.3
This commit is contained in:
@@ -5,6 +5,37 @@ All notable changes to @samiyev/guardian will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.6.3] - 2025-11-24
|
||||
|
||||
### Fixed
|
||||
|
||||
**🐛 Repository Pattern Detection - Reduced False Positives**
|
||||
|
||||
Fixed overly strict repository method name validation that was flagging valid DDD patterns as violations.
|
||||
|
||||
- ✅ **Added support for common DDD repository patterns:**
|
||||
- `has*()` methods - e.g., `hasProject()`, `hasPermission()`
|
||||
- `is*()` methods - e.g., `isCached()`, `isActive()`
|
||||
- `exists*()` methods - e.g., `existsById()`, `existsByEmail()`
|
||||
- `clear*()` methods - e.g., `clearCache()`, `clearAll()`
|
||||
- `store*()` methods - e.g., `storeMetadata()`, `storeFile()`
|
||||
- Lifecycle methods: `initialize()`, `close()`, `connect()`, `disconnect()`
|
||||
|
||||
- 🎯 **Impact:**
|
||||
- Reduced false positives in real-world DDD projects
|
||||
- Better alignment with Domain-Driven Design best practices
|
||||
- More practical for cache repositories, connection management, and business queries
|
||||
|
||||
- 📚 **Why these patterns are valid:**
|
||||
- Martin Fowler's Repository Pattern allows domain-specific query methods
|
||||
- DDD recommends using ubiquitous language in method names
|
||||
- Lifecycle methods are standard for resource management in repositories
|
||||
|
||||
### Technical
|
||||
|
||||
- Updated `domainMethodPatterns` in `RepositoryPatternDetector.ts` with 11 additional valid patterns
|
||||
- All existing functionality remains unchanged
|
||||
|
||||
## [0.6.2] - 2025-11-24
|
||||
|
||||
### Added
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@samiyev/guardian",
|
||||
"version": "0.6.2",
|
||||
"version": "0.6.3",
|
||||
"description": "Research-backed code quality guardian for AI-assisted development. Detects hardcodes, circular deps, framework leaks, entity exposure, and 8 architecture violations. Enforces Clean Architecture/DDD principles. Works with GitHub Copilot, Cursor, Windsurf, Claude, ChatGPT, Cline, and any AI coding tool.",
|
||||
"keywords": [
|
||||
"puaros",
|
||||
|
||||
@@ -78,6 +78,17 @@ export class RepositoryPatternDetector implements IRepositoryPatternDetector {
|
||||
/^get[A-Z]/,
|
||||
/^search/,
|
||||
/^list/,
|
||||
/^has[A-Z]/,
|
||||
/^is[A-Z]/,
|
||||
/^exists[A-Z]/,
|
||||
/^existsBy[A-Z]/,
|
||||
/^clear[A-Z]/,
|
||||
/^clearAll$/,
|
||||
/^store[A-Z]/,
|
||||
/^initialize$/,
|
||||
/^close$/,
|
||||
/^connect$/,
|
||||
/^disconnect$/,
|
||||
]
|
||||
|
||||
private readonly concreteRepositoryPatterns = [
|
||||
|
||||
Reference in New Issue
Block a user