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

police-of-code

v1.0.0

Published

Professional static code analysis with authority

Readme


Introduction

Police of Code is a modern static analysis tool built with a clear philosophy: prevent problems, not incidents.

The project is inspired by internal security tooling used in large engineering organizations and is designed to look, feel and behave like a real-world product rather than a demo or toy project.

It serves three purposes simultaneously:

  • A serious security-oriented static analyzer
  • An educational reference for advanced JavaScript tooling
  • A high-quality portfolio project showcasing architecture, UX and engineering discipline

Features

  • Security-focused static analysis
  • Modular and extensible rule engine
  • Clean, deterministic analysis results
  • CI/CD friendly exit codes
  • Minimalistic yet expressive CLI interface
  • Human-readable and machine-readable outputs
  • Educational, auditable codebase

Installation

Clone the repository and install dependencies:

git clone https://github.com/0xlayout/police-of-code.git
cd police-of-code
npm install

The CLI can be executed locally via:

npx police-of-code

Quick Start

Analyze a directory:

police-of-code scan ./src

Run system diagnostics:

police-of-code doctor

List all available rules:

police-of-code rules

Generate a default configuration file:

police-of-code init

CLI Overview

police-of-code <command> [options]

Available Commands

| Command | Description | |-------|------------| | scan | Analyze a file or directory | | doctor | Run environment diagnostics | | rules | List available analysis rules | | init | Create a default configuration file |


Scan Command Options


Architecture

police-of-code/
├── src/
│   ├── cli.js
│   ├── analyzer.js
│   ├── parser.js
│   ├── ruleEngine.js
│   ├── rules/
│   ├── reporter.js
│   └── personality.js
├── examples/
├── tests/
├── README.md
└── SECURITY.md

The architecture is intentionally layered and modular. Each component has a single responsibility and can evolve independently.


Built-in Rules

| Rule | Category | Severity | |----|--------|----------| | hardcodedSecrets | Security | Critical | | sqlInjection | Injection | Critical | | emptyCatch | Reliability | Medium | | longFunctions | Maintainability | Low |


Example: Hardcoded Secret

const apiKey = "sk_test_1234567890";

Result:

CRITICAL  Hardcoded secret detected
Location: badCode.js:1

Example: SQL Injection

db.query("SELECT * FROM users WHERE id = " + userId);

Result:

CRITICAL  Possible SQL injection detected

Output Model

Police of Code produces deterministic results suitable for both humans and automation.

Scan completed
2 Critical violations
1 Medium violation
Exit code: 2

This makes the tool ideal for CI/CD pipelines.


Configuration

Create a configuration file:

police-of-code init

Example configuration:

{
  "mode": "serious",
  "format": "console",
  "severity": "low",
  "failOn": "critical"
}

Educational Scope

Police of Code demonstrates real-world concepts such as:

  • AST parsing and traversal
  • Rule engines and policy enforcement
  • Severity classification models
  • CLI UX and ergonomics
  • Deterministic analysis design
  • Secure-by-design development philosophy

Disclaimer

Police of Code is not a replacement for professional security audits, penetration testing or runtime protection systems. It is intended as a static analysis and educational tool.


Credits

Crafted by 0xlayout