Files
snippet-pastebin/docs
johndoe6345789 7170733e6d test: Add comprehensive Scoring Engine test suite with 74 passing tests
Implements complete test coverage for src/lib/quality-validator/scoring/scoringEngine.ts
with thorough validation of:

- Score calculation: base scores, weighting, normalization to 0-100
- Coverage scoring: line/branch/statement/function coverage with effectiveness bonus
- Complexity scoring: penalties for critical functions, bonuses for low complexity
- Duplication scoring: tiered penalties from <3% (excellent) to >10% (critical)
- Linting scoring: errors weighted 15pts, warnings weighted 2pts above threshold
- Architecture scoring: component sizing, circular dependencies, pattern compliance
- Security scoring: vulnerabilities (critical/high weighted), code patterns, performance
- Grade assignment: A-F based on thresholds (90, 80, 70, 60, 0)
- Pass/fail status: threshold at 80
- Edge cases: null metrics, boundary values, empty projects, perfect metrics, extreme values
- Recommendations: generation, prioritization, top 5 limit
- Performance: <100ms per calculation, efficient handling of large datasets
- Consistency: deterministic results, mathematical invariants maintained
- Weighting system: custom weight support with proper distribution

Test Organization:
- 20 distinct test areas covering all requirements
- 74 total tests, all passing
- Realistic metric combinations from test factories
- Performance benchmarks included
- Mathematical property validation

Mock Strategy:
- Jest mocks for trendStorage (file I/O avoidance)
- Jest mocks for trendAnalyzer (side effect isolation)
- Realistic mock return values

Documentation:
- Comprehensive test report in docs/2025_01_21/SCORING_ENGINE_COMPREHENSIVE_TESTS.md
- Design notes on scoring weights and thresholds
- Future enhancement suggestions

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-21 01:36:07 +00:00
..

CodeSnippet - Code Snippet Manager

A powerful code snippet management application with flexible storage backends and an integrated component library showcase.

🚀 Quick Start

Choose the setup that works best for you:

docker-compose up -d

Access at: http://localhost:3000 (auto-configured with Flask backend)

Option 2: Local Development

# Start backend
docker-compose -f docker-compose.backend-only.yml up -d

# Configure frontend
echo "VITE_FLASK_BACKEND_URL=http://localhost:5000" > .env

# Start frontend
npm install
npm run dev

Access at: http://localhost:5173

Option 3: Frontend Only (No Backend)

npm install
npm run dev

Access at: http://localhost:5173 (uses local IndexedDB storage)

📖 See detailed setup instructions →

🔑 Key Features

  • 📝 Snippet Management - Create, edit, and organize code snippets with syntax highlighting
  • 🔍 Smart Search - Real-time search across title, description, language, and code
  • 👁️ Live Preview - Split-screen editor with live React component preview
  • 💾 Flexible Storage - Choose between local IndexedDB or Flask backend
  • 🔄 Auto-Configuration - Automatically use Flask backend via environment variable
  • 🗂️ Component Library - Showcase organized by atomic design principles
  • 📤 Export/Import - Backup and restore your entire database
  • 🎨 Beautiful UI - Modern dark theme with purple and cyan accents

🎯 Storage Backends

CodeSnippet supports two storage backends:

IndexedDB (Default)

  • Local browser storage
  • No server required
  • Perfect for personal use

Flask Backend (Optional)

  • Remote server storage
  • Multi-device sync
  • Requires Flask backend

🔧 Auto-Configuration:
Set VITE_FLASK_BACKEND_URL environment variable to automatically use Flask backend:

# .env file
VITE_FLASK_BACKEND_URL=http://localhost:5000

When set, the app automatically connects to Flask backend and disables manual configuration.

📖 Complete backend configuration guide →

📚 Documentation

Getting Started

Backend & Storage

Production Deployment

🛠️ Technology Stack

  • React 19 + TypeScript
  • SQL.js (SQLite in WebAssembly)
  • Flask (Python backend)
  • Monaco Editor (VS Code editor)
  • Framer Motion (animations)
  • Shadcn UI (component library)
  • Tailwind CSS (styling)

📄 License

The Spark Template files and resources from GitHub are licensed under the terms of the MIT license, Copyright GitHub, Inc.