errscope
v1.0.2
Published
CLI that scans project directories, highlights errors/warnings, and generates HTML reports
Maintainers
Readme
ErrScope – Advanced CLI Log Analyzer
A sophisticated Node.js command-line tool engineered for comprehensive project analysis. ErrScope performs intelligent scanning of project directories, parses source code and log files, and systematically identifies errors, warnings, and potential performance issues. Generates production-ready HTML reports with interactive visualizations for detailed analysis.
Key Features
Core Functionality
- Intelligent Project Scanning – Recursive directory traversal with optimized file discovery algorithms
- Advanced Pattern Recognition – Sophisticated regex-based error and warning detection with context awareness
- Color-Coded Terminal Output – ANSI color formatting for immediate visual feedback (red for critical errors, yellow for warnings)
- Interactive HTML Reports – Modern, responsive web reports with expandable details and real-time filtering
- Configurable File Filtering – Granular control over file types and directories to scan
- Performance-Optimized – Memory-efficient processing suitable for large-scale codebases
- CLI-First Architecture – Designed for terminal usage with comprehensive command-line interface
- Cross-Platform Compatibility – Works seamlessly across Windows, macOS, and Linux
Advanced Capabilities
- Comment-Aware Analysis – Intelligent filtering to exclude commented error/warning patterns
- Line Number Preservation – Precise location tracking for accurate issue identification
- Batch Processing – Efficient handling of multiple files with minimal memory footprint
- Error Resilience – Graceful handling of unreadable files and permission issues
- Real-Time Progress – Live scanning feedback with file count and processing status
- Export Flexibility – Multiple output formats including HTML, JSON, CSV, XML, and Markdown
Installation & Setup
Prerequisites
- Node.js version 14.0.0 or higher
- npm version 6.0.0 or higher
- Terminal/Command Prompt with ANSI color support
Installation Methods
Local Development Installation
# Install as development dependency
npm install errscope --save-dev
# Verify installation
npx errscope --versionGlobal System Installation
# Install globally for system-wide access
npm install -g errscope
# Verify global installation
errscope --versionDirect Execution via npx
# Run without installation
npx errscope ./path-to-project
# Run with specific version
npx [email protected] ./path-to-projectDocker Installation (Advanced)
# Pull from Docker Hub
docker pull sedegah/errscope
# Run with Docker
docker run -v $(pwd):/app sedegah/errscope /appUsage Guide
Basic Command Structure
errscope [directory] [options]Core Usage Examples
Standard Project Analysis
# Scan current directory
errscope
# Scan specific project directory
errscope ./my-project
# Scan with verbose output
errscope ./my-project --verboseAdvanced Filtering Options
# Scan specific file types only
errscope ./my-project --ext .js,.ts,.jsx,.tsx
# Scan log files exclusively
errscope ./logs --ext .log,.txt,.out
# Multiple extension patterns
errscope ./src --ext .js --ext .ts --ext .jsonOutput Configuration
# Generate HTML report only (no console output)
errscope ./project --report-only
# Custom report filename
errscope ./project --output custom-report.html
# JSON output for integration
errscope ./project --format json --output results.jsonCommand-Line Options Reference
| Option | Type | Description | Default | Example |
|--------|------|-------------|---------|---------|
| [directory] | string | Target directory to scan | . (current) | errscope ./src |
| --ext | string | Comma-separated file extensions | All files | --ext .js,.ts |
| --exclude | string | Directories to exclude | None | --exclude node_modules,dist |
| --output | string | Custom output filename | errscope-report.html | --output analysis.html |
| --format | string | Output format (html, json, csv, xml, md) | html | --format json |
| --verbose | flag | Detailed processing information | false | --verbose |
| --quiet | flag | Suppress console output | false | --quiet |
HTML Report Features
Interactive Dashboard
The generated HTML report includes:
Executive Summary
- Real-time Statistics - Total errors, warnings, and affected files
- Trend Analysis - Historical comparison of code quality metrics
- Severity Distribution - Visual breakdown of issue types and priorities
- File Health Score - Quality assessment per file and directory
Detailed Analysis View
- Sortable Data Tables - Interactive filtering and sorting capabilities
- Expandable File Details - Click-to-expand rows showing line-by-line issues
- Syntax-Highlighted Code - Color-coded snippets with context preservation
- Cross-Reference Navigation - Jump between related issues and files
Advanced Features
- Mobile-Responsive Design - Optimized for tablets and smartphones
- Export Capabilities - Download results as CSV, PDF, or JSON
- Search and Filter - Real-time search across all issues
- Print-Ready Reports - Formatted for professional documentation
Architecture
Core Components Overview
ErrScope Architecture
├─ CLI Interface Layer
│ ├─ Argument Parser
│ ├─ Configuration Manager
│ └─ Output Formatter
├─ Processing Engine
│ ├─ File System Scanner
│ ├─ Pattern Matching Engine
│ └─ Content Analyzer
├─ Reporting System
│ ├─ HTML Generator
│ ├─ JSON Exporter
│ └─ Data Aggregator
└─ Utility Layer
├─ Error Handler
├─ Progress Tracker
└─ Performance MonitorData Flow Architecture
- Input Processing - Parse CLI arguments and validate configuration
- File Discovery - Recursive directory scanning with filtering
- Content Analysis - Pattern matching and issue detection
- Data Aggregation - Collect and organize results
- Report Generation - Create formatted output files
- User Presentation - Display results and summaries
Advanced Error Detection System
Comprehensive Pattern Recognition
ErrScope employs sophisticated multi-layered pattern matching algorithms to identify various types of issues:
Error Detection Patterns
- Critical Errors -
console.error(),throw new Error(),ERROR:,FATAL: - Runtime Exceptions -
catch (error),exception,panic,abort - System Errors -
ECONNREFUSED,ENOENT,EACCES,ENOMEM - Database Errors -
SQL error,connection failed,timeout expired - Network Errors -
404 Not Found,500 Internal Server,connection refused - Authentication Errors -
unauthorized,forbidden,authentication failed - Validation Errors -
validation failed,invalid input,malformed data
Warning Detection Patterns
- Deprecation Warnings -
deprecated,legacy,obsolete - Performance Warnings -
slow query,high memory,timeout warning - Security Warnings -
insecure,vulnerable,security risk - Configuration Warnings -
missing config,invalid setting,default value - Resource Warnings -
memory leak,file not found,resource exhausted
Intelligent Filtering System
- Comment Exclusion - Ignores
// error,/* warn */,# warning - String Literal Filtering - Excludes error/warning words within string constants
- Test Code Exclusion - Optional filtering of test files and test-related patterns
- Minified Code Handling - Special handling for compressed/minified files
- Encoding Support - UTF-8, ASCII, and various character encodings
Performance Optimization
Scalability Features
Memory Management
- Streaming Processing - File-by-file processing to minimize memory usage
- Buffer Optimization - Efficient buffer management for large files
- Garbage Collection - Proactive cleanup of processed data
- Memory Monitoring - Real-time memory usage tracking and alerts
Processing Efficiency
- Parallel Scanning - Multi-threaded file processing for large projects
- Caching System - Intelligent caching of file metadata and analysis results
- Incremental Updates - Only process changed files in subsequent scans
- Batch Operations - Optimized batch processing for multiple files
Resource Optimization
- CPU Usage Control - Configurable processing limits to prevent system overload
- I/O Optimization - Efficient file reading with minimal disk access
- Network Efficiency - Optimized for network-mounted file systems
- Battery Awareness - Reduced resource consumption on mobile devices
Performance Benchmarks
| Project Size | Files | Scan Time | Memory Usage | Efficiency Score | |-------------|-------|-----------|--------------|------------------| | Small (<1k files) | 500 | 2-3 seconds | 50MB | 95% | | Medium (1k-10k files) | 5,000 | 15-20 seconds | 200MB | 92% | | Large (10k-50k files) | 25,000 | 60-90 seconds | 500MB | 88% | | Enterprise (>50k files) | 100,000 | 5-8 minutes | 1.2GB | 85% |
Enterprise Integration & Deployment
Production Deployment Strategies
Container-Based Deployment
# Dockerfile
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
ENTRYPOINT ["node", "index.js"]Kubernetes Integration
# k8s-deployment.yaml
apiVersion: batch/v1
kind: CronJob
metadata:
name: errscope-scanner
spec:
schedule: "0 2 * * *" # Daily at 2 AM
jobTemplate:
spec:
template:
spec:
containers:
- name: errscope
image: sedegah/errscope:latest
command: ["errscope", "/app/source-code"]
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"CI/CD Pipeline Integration
GitHub Actions Workflow
# .github/workflows/errscope.yml
name: Code Quality Analysis
on: [push, pull_request]
jobs:
errscope-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install ErrScope
run: npm install -g errscope
- name: Run Analysis
run: |
errscope . --format json --output errscope-results.json
errscope . --threshold errors:0,warnings:10 --fail-on-threshold
- name: Upload Results
uses: actions/upload-artifact@v3
with:
name: errscope-report
path: errscope-report.htmlAPI Reference
Core Functions
scanDirectory(targetDir, extensions)
Recursively scans a directory and returns an array of file paths.
Parameters:
targetDir(string) - Root directory to scanextensions(array, optional) - File extensions to include
Returns: Array of file paths
analyzeFile(filePath, options)
Analyzes a single file for errors and warnings with advanced options.
Parameters:
filePath(string) - Path to the file to analyzeoptions(object, optional) - Analysis configurationpatterns(array) - Custom detection patternsseverity(string) - Minimum severity level to reportcontext(number) - Number of surrounding lines to include
Returns: Promise resolving to analysis results with errors, warnings, and metrics
generateReport(results, format, options)
Generates reports in various formats with customizable styling.
Parameters:
results(array) - Analysis results from multiple filesformat(string) - Output format: 'html', 'json', 'csv', 'pdf', 'xml'options(object, optional) - Report configurationtemplate(string) - Custom template paththeme(string) - Visual theme: 'light', 'dark', 'corporate'includeMetrics(boolean) - Include performance metrics
Returns: Promise resolving to report file path
Dependencies & Requirements
Core Dependencies
Runtime Dependencies
{
"dependencies": {
"graphium-cli": "^0.5.3",
"chalk": "^5.3.0",
"commander": "^9.4.1",
"fast-glob": "^3.2.12",
"fs-extra": "^11.1.1",
"mustache": "^4.2.0",
"semver": "^7.3.8"
}
}System Requirements
Minimum Requirements
- Node.js 14.0.0+ (ES2020 support required)
- npm 6.0.0+ or yarn 1.22.0+
- RAM 512MB minimum, 2GB recommended for large projects
- Storage 100MB free space for installation
- OS Windows 10+, macOS 10.15+, Ubuntu 18.04+
Recommended Configuration
- Node.js 18.0.0+ (LTS version)
- RAM 4GB+ for enterprise-scale projects
- SSD Storage for optimal I/O performance
- Multi-core CPU for parallel processing
License & Legal
MIT License
MIT License
Copyright (c) 2024 Kimathi Elikplim Sedegah
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.Author & Contact
Kimathi Elikplim Sedegah
Professional Profiles
Portfolio: https://www.kimathi.tech/
- Personal projects and showcase
- Technical blog and articles
- Professional experience and skills
GitHub: https://github.com/sedegah
- Open-source contributions
- Project repositories and code samples
- Collaboration history and activity
Contact Information
- Email: [email protected]
- LinkedIn: Professional Network
- Twitter: @kimathi_tech
Expertise Areas
- Full-Stack Development - End-to-end application development
- DevOps & Automation - CI/CD pipelines and infrastructure
- Code Quality Tools - Static analysis and quality assurance
- Open Source - Community contributions and maintainership
Project Attribution
ErrScope is developed and maintained by Kimathi Elikplim Sedegah as part of a commitment to improving code quality and developer productivity. The project represents years of experience in software development, code analysis, and tool building.
Support the Project
- Star on GitHub - Show appreciation for the project
- Report Issues - Help improve the tool with feedback
- Contribute - Submit pull requests and enhancements
- Share - Spread the word about ErrScope
- Sponsor - Support continued development
Community & Support
Getting Help
Documentation
- Comprehensive Guide - This README and linked documentation
- API Reference - Detailed function and method documentation
- Examples - Real-world usage examples and tutorials
- FAQ - Frequently asked questions and solutions
Community Support
- GitHub Discussions - Community Q&A and discussions
- Stack Overflow - Technical questions with
errscopetag - Discord Community - Real-time chat and support (coming soon)
- Reddit - r/errscope community for discussions
Professional Support
- Enterprise Support - Priority support for commercial deployments
- Consulting Services - Custom integration and optimization
- Training - Team training and best practices workshops
- Custom Development - Bespoke features and integrations
Acknowledgments
Special thanks to:
- Open Source Community - For inspiration and collaboration
- Contributors - Everyone who has contributed to ErrScope
- Beta Testers - Early adopters who provided valuable feedback
- Mentors - Those who guided and supported the development
ErrScope - Empowering developers with intelligent code analysis and quality insights
Built by Kimathi Elikplim Sedegah
