UNPKG

agentsqripts

Version:

Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems

101 lines (92 loc) 4.22 kB
/** * @file File extension and directory configuration for multi-language analysis * @description Single responsibility: Define file patterns and directory structures for code analysis * * This configuration module centralizes file extension definitions and directory patterns * used across all analysis tools. It provides categorized extension lists for different * technology stacks and common directory patterns to enable intelligent file discovery * and technology-specific analysis routing. * * Design rationale: * - Technology-specific extension groups enable targeted analysis approaches * - Common directory patterns improve out-of-box project discovery * - Centralized definitions prevent configuration drift across analyzers * - Extensible structure supports adding new languages and frameworks * - Default configurations provide good coverage for most JavaScript projects */ // File Extension Constants /** * Common index file patterns for module entry point detection * * Priority ordering rationale: * - TypeScript files first to prefer typed implementations * - JavaScript files as fallback for untyped projects * - Enables intelligent module structure analysis and barrel file detection */ const DEFAULT_INDEX_FILES = ['index.ts', 'index.js']; /** * Standard utility and library directory patterns for code organization analysis * * Directory selection criteria: * - Common utility directories across different project structures * - Framework-agnostic patterns that work with various architectures * - Hierarchical organization from general (lib) to specific (src/utils) * - Covers both frontend (app/) and backend (src/) project layouts */ const DEFAULT_TARGET_DIRS = ['src/utils', 'src/helpers', 'src/shared', 'lib', 'utils', 'helpers', 'src/lib', 'app/utils', 'app/lib']; /** * Frontend-specific file extensions for UI/UX analysis and frontend performance optimization * * Technology coverage: * - JavaScript and TypeScript: Core web technologies with type safety * - React: JSX and TSX for component-based UI analysis * - Vue and Svelte: Modern component frameworks with specific syntax patterns */ const FRONTEND_EXTENSIONS = ['.js', '.jsx', '.ts', '.tsx', '.vue', '.svelte']; /** * Backend-specific file extensions for server-side analysis and security scanning * * Multi-language support rationale: * - JavaScript/TypeScript: Node.js and modern backend development * - Python: Popular for APIs, data processing, and machine learning * - PHP: Legacy web applications and CMS platforms * - Ruby: Rails applications and automation scripts * - Go: High-performance microservices and system programming * - Java: Enterprise applications and Android development */ const BACKEND_EXTENSIONS = ['.js', '.ts', '.py', '.php', '.rb', '.go', '.java']; /** * Comprehensive extension list for general code analysis across technology stacks * * Coverage strategy: * - Web technologies: JavaScript family for frontend and backend * - Enterprise languages: Java and C# for large-scale applications * - Scripting languages: Python and PHP for automation and web development * - Balances comprehensive coverage with analysis performance */ const VALID_EXTENSIONS = ['.js', '.ts', '.jsx', '.tsx', '.py', '.java', '.cs', '.php']; /** * Default extension set optimized for modern development workflows * * Selection criteria: * - Covers 80% of modern web development projects * - Includes component frameworks (Vue) for comprehensive frontend analysis * - Prioritizes JavaScript ecosystem while including popular alternatives * - Provides reasonable analysis scope without overwhelming processing time */ const DEFAULT_EXTENSIONS = ['.js', '.ts', '.jsx', '.tsx', '.vue', '.py', '.java', '.cs', '.php']; // Configuration Constants const DEFAULT_CONFIG = { targetDirs: ['src/utils', 'src/helpers', 'src/shared', 'lib', 'utils', 'helpers', 'src/lib', 'app/utils', 'app/lib'], validExtensions: ['.ts', '.js', '.tsx', '.jsx'], indexFiles: ['index.ts', 'index.js'] }; module.exports = { DEFAULT_INDEX_FILES, DEFAULT_TARGET_DIRS, FRONTEND_EXTENSIONS, BACKEND_EXTENSIONS, VALID_EXTENSIONS, DEFAULT_EXTENSIONS, DEFAULT_CONFIG };