agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
42 lines (40 loc) • 2.35 kB
JavaScript
/**
* @file SRP keyword cluster configuration for Single Responsibility Principle violation analysis
* @description Single responsibility: Define keyword clusters that identify different code responsibilities
*
* This configuration module provides curated keyword clusters used by the SRP analyzer to
* detect when files handle multiple responsibilities. Each cluster represents a distinct
* functional concern, and files containing keywords from multiple clusters are flagged
* as potential SRP violations requiring architectural review and possible refactoring.
*
* Design rationale:
* - Keyword clustering enables automated detection of mixed responsibilities in code files
* - Semantic grouping reflects common software architecture patterns and separation concerns
* - Technology-agnostic clusters apply broadly across different frameworks and libraries
* - Conservative cluster design minimizes false positives while catching genuine violations
* - Extensible structure allows easy addition of new responsibility categories as needed
*
* Cluster methodology:
* - API/Network cluster identifies files handling external communication and data fetching
* - UI/Rendering cluster detects presentation layer responsibilities and component logic
* - Data/Persistence cluster flags files managing data validation, storage, and persistence
* - Routing/Middleware cluster identifies request handling and application flow control
* - Testing cluster detects test utilities mixed with business logic
* - Configuration cluster identifies environment and settings management responsibilities
* - Logging cluster flags monitoring and debugging concerns mixed with business logic
* - Security cluster identifies cryptographic and authentication responsibilities
*/
// Keyword Clusters for SRP Analysis
const DEFAULT_KEYWORD_CLUSTERS = [
['fetch', 'axios', 'request', 'http', 'api'],
['render', 'component', 'jsx', 'return (', 'createElement'],
['validate', 'update', 'write', 'save', 'persist'],
['connect', 'router', 'route', 'middleware', 'express'],
['test', 'describe', 'expect', 'assert', 'mock'],
['config', 'settings', 'env', 'process.env', 'dotenv'],
['logger', 'log', 'console', 'debug', 'error'],
['crypto', 'hash', 'encrypt', 'decrypt', 'bcrypt']
];
module.exports = {
DEFAULT_KEYWORD_CLUSTERS
};