npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sumit-wayne/code-score-cli

v1.0.0

Published

Analyze JavaScript, TypeScript, and React code complexity and maintainability

Readme

🎯 code-score

Analyze JavaScript, TypeScript, and React code complexity and maintainability

npm version License: MIT Node.js

A powerful CLI tool that analyzes your codebase and provides actionable insights on code quality, complexity, and maintainability.

✨ Features

  • 📊 Cyclomatic Complexity - Measure code complexity with industry-standard metrics
  • 🔍 Maintainability Index - Microsoft's formula for code maintainability
  • 📏 Function Length Analysis - Identify overly long functions
  • 🪆 Nesting Depth Detection - Find deeply nested code blocks
  • 💡 Actionable Suggestions - Get specific improvement recommendations
  • 🎨 Beautiful CLI Output - Color-coded, table-based reports
  • 📄 JSON Export - Machine-readable output for CI/CD integration
  • Fast Analysis - Built with performance in mind

🚀 Installation

Global Installation (Recommended)

npm install -g @sumit-wayne/code-score

Local Installation

npm install --save-dev @sumit-wayne/code-score

📖 Usage

Basic Analysis

code-score analyze ./src

Export to JSON

code-score analyze ./src -f json -o report.json

Exclude Patterns

code-score analyze ./src -e "**/test/**" "**/dist/**" "**/*.spec.ts"

Include Only Specific Files

code-score analyze ./src -i "**/*.ts" "**/*.tsx"

📊 Example Output

╔════════════════════════════════════════════════╗
║         CODE SCORE ANALYSIS REPORT            ║
╚════════════════════════════════════════════════╝

📊 PROJECT SUMMARY
──────────────────
Files Analyzed          │ 36
Lines of Code           │ 1,628
Average Complexity      │ 1.2
Average Maintainability │ 54.2
Risky Files             │ 2

🎯 OVERALL SCORE
────────────────
  ✅  Good: 7.8/10

Complexity      │ 9.4/10 │ Excellent
Maintainability │ 5.4/10 │ Fair
Code Quality    │ 8.1/10 │ Good

🎨 Metrics Explained

Cyclomatic Complexity

Measures the number of independent paths through your code. Higher values indicate more complex, harder-to-test code.

  • 1-5: ✅ Simple, easy to test and maintain
  • 6-10: ⚠️ Moderate complexity
  • 11-20: ❌ High complexity, consider refactoring
  • 21+: 🔥 Very high, difficult to maintain

Maintainability Index

Microsoft's formula combining complexity, code volume, and lines of code. Ranges from 0-100.

  • 70-100: ✅ Good maintainability
  • 50-69: ⚠️ Moderate maintainability
  • 0-49: ❌ Difficult to maintain

Code Quality Score

Combines nesting depth and function length metrics to evaluate overall code structure.

🔧 Programmatic API

You can also use code-score programmatically in your Node.js projects:

import { ProjectAnalyzer } from '@sumit-wayne/code-score';

const analyzer = new ProjectAnalyzer({
  path: './src',
  exclude: ['**/node_modules/**', '**/dist/**'],
});

const result = await analyzer.analyze();

console.log(`Overall Score: ${result.score.overall}/10`);
console.log(`Files Analyzed: ${result.summary.totalFiles}`);
console.log(`Critical Issues: ${result.summary.issueCount.critical}`);

🛠️ Configuration

You can customize thresholds for different metrics:

const analyzer = new ProjectAnalyzer({
  path: './src',
  thresholds: {
    complexity: {
      low: 5,
      medium: 10,
      high: 20,
      critical: 30,
    },
    nesting: {
      max: 4,
    },
    functionLength: {
      max: 50,
    },
    maintainability: {
      good: 70,
      moderate: 50,
      poor: 0,
    },
  },
});

📝 CI/CD Integration

GitHub Actions

name: Code Quality

on: [push, pull_request]

jobs:
  analyze:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '18'
      - run: npm install -g @sumit-wayne/code-score
      - run: code-score analyze ./src -f json -o report.json
      - uses: actions/upload-artifact@v2
        with:
          name: code-quality-report
          path: report.json

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

MIT © Sumit

🔗 Links

🙏 Acknowledgments

Built with:


Made with ❤️ by Sumit for better code quality