A CLI tool that detects magic numbers (unnamed numerical constants) in JavaScript code to improve maintainability.
Buddy.js is a command-line tool that detects magic numbers—unnamed numerical constants—in JavaScript code. It helps developers identify hard-coded numbers that should be replaced with named variables to improve code readability and reduce maintenance issues. The tool scans files recursively and reports findings with configurable options.
JavaScript developers and teams who want to enforce code quality standards and eliminate magic numbers from their codebases, especially those integrating static analysis into their build processes.
Buddy.js provides a simple, focused tool for magic number detection with flexible configuration, multiple reporters, and easy CI integration, helping teams maintain cleaner, more understandable JavaScript code.
Magic number detection for JavaScript
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Specifically targets unnamed numerical constants in JavaScript files, helping identify hard-coded numbers that reduce readability and maintainability, as shown in the README's examples.
Supports ignoring numbers via command-line flags, inline comments, or block directives, with a .buddyrc file for project-wide settings, allowing tailored enforcement.
Can be integrated into build pipelines like Travis CI to fail builds when magic numbers are found, automating code quality checks as detailed in the Integration section.
Offers simple, detailed, and JSON reporters for different outputs, enabling easy integration into logging systems or human-readable reviews, per the Reporters section.
Only scans .js files and ignores node_modules, so it doesn't natively support TypeScript or other languages without additional compilation steps.
Overlaps with tools like ESLint that can handle magic numbers via plugins, potentially adding unnecessary complexity to toolchains for teams already using such linters.
Defaults to ignoring 0 and 1 and has optional const enforcement, which might not align with modern JavaScript best practices where const is preferred and all magic numbers could be flagged.