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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@deepan-kumar/namelint

v1.0.0

Published

Linter for function names. Catches naming issues in Ruby, JavaScript, and Python with git hooks and watch mode.

Readme

Function Naming Checker

Stop poorly named functions before they reach production.

Automatically catches naming issues in Ruby, JavaScript, and Python:

  • Pre-commit Git Hook - Blocks commits with naming issues
  • Watch Mode - Real-time suggestions as you code

No manual checking required. Just code, and get instant feedback.


🎯 The Problem

Bad function names slip through code review:

# Ruby anti-patterns
def is_admin(user)           # ❌ Should use ? suffix
def get_user_email(user)     # ❌ Not idiomatic Ruby
def updateUser(user, data)   # ❌ camelCase in Ruby

# JavaScript anti-patterns
function admin(user) { }      # ❌ Missing is prefix
function doClick() { }        # ❌ Generic "do" prefix
async function getData() { }  # ❌ Should be fetchData

# Python anti-patterns
def getUserEmail(user):       # ❌ Should be snake_case
def admin(user):              # ❌ Missing is_ prefix

Result: Inconsistent codebases, confused developers, harder maintenance.


✨ The Solution

1. Git Pre-commit Hook ⚡

Automatically checks every commit:

$ git commit -m "Add user validation"

🔍 Checking function naming...

❌ Found 2 naming issues:

1. app/models/user.rb:45
   Current:  is_admin()
   Suggested: admin?()
   Reason: Boolean check → use ? suffix (Ruby convention)

2. app/services/auth.js:12
   Current:  doLogin()
   Suggested: handleLogin()
   Reason: React handler → use handle prefix

Fix the issues or skip with: git commit --no-verify

2. Watch Mode 👀

Real-time suggestions as you code:

$ name-check watch app/

👀 Watch Mode Started
Monitoring: app/

# You save a file...

⚡ Naming Suggestion:
📁 app/services/payment.rb:23
   Current:  process()
   Better:   calculate_discount()
   Reason:   Calculation detected → use calculate verb

Apply this change? (y/n/s): y
✅ Rename in your editor: process → calculate_discount

🚀 Quick Start

Install

cd /Users/dkumar/Github/learn/function-naming-mcp
npm install
npm link

Setup Git Hook (One-time)

# In any project:
cd /path/to/your/project
name-check install-hook

Done! Now every commit is automatically checked.

Start Watch Mode (Optional)

# In your project:
name-check watch app/ lib/

Keep it running in a terminal while you code.


📋 What It Catches

Ruby/Rails (Rubocop-compliant)

| ❌ Bad | ✅ Good | Why | |--------|---------|-----| | is_admin() | admin?() | Predicates use ? suffix | | get_email() | email or @property | No get_ prefix | | updateUser() | update_user | snake_case, not camelCase | | save() | save!() | Use ! for dangerous ops |

JavaScript/React

| ❌ Bad | ✅ Good | Why | |--------|---------|-----| | admin() | isAdmin() | Booleans use is/has/can | | doClick() | handleClick() | React handlers use handle | | getData() | fetchData() | Async functions use fetch/load |

Python (PEP 8)

| ❌ Bad | ✅ Good | Why | |--------|---------|-----| | getUserEmail() | get_user_email() | snake_case, not camelCase | | admin() | is_admin() | Booleans use is_/has_ | | checkValid() | is_valid() | Predicates use is_ |


💡 Real-World Examples

Before Git Hook

# app/models/user.rb
def is_admin
  role == 'admin'
end

def get_full_name
  "#{first_name} #{last_name}"
end
$ git commit -m "Add user methods"
[main abc1234] Add user methods  ✅  # No check!

After Git Hook

$ git commit -m "Add user methods"

🔍 Checking function naming...

❌ Found 2 naming issues:

1. app/models/user.rb:12
   Current:  is_admin
   Suggested: admin?

2. app/models/user.rb:16
   Current:  get_full_name
   Suggested: full_name

Fix or skip with: git commit --no-verify

Result: You fix it before it reaches production.


🎯 Use Cases

1. Team Onboarding

Problem: New developers don't know Ruby conventions Solution: Git hook teaches them immediately

2. Legacy Codebase

Problem: Inconsistent naming everywhere Solution: Stop adding more bad names, gradually fix old ones

3. Code Review

Problem: Reviewers waste time on naming issues Solution: Automated checks free up reviewers for logic

4. Multi-language Projects

Problem: Mixing naming conventions across languages Solution: Language-specific checks for each file


🛠️ Commands

# Install git hook (one-time per project)
name-check install-hook

# Start watch mode
name-check watch app/ lib/

# Manual scan
name-check scan app/**/*.rb

# Scan staged files before commit
name-check scan $(git diff --cached --name-only)

⚙️ Configuration

Optional .naming-config.json in project root:

{
  "enabled": true,
  "languages": ["ruby", "javascript", "python"],
  "watchDirs": ["app/", "lib/", "src/"],
  "severity": "error",
  "exclude": ["node_modules/", "vendor/"]
}

🤝 Works With

  • ✅ Ruby on Rails
  • ✅ Sinatra
  • ✅ React
  • ✅ Node.js
  • ✅ Django
  • ✅ Flask
  • ✅ Any Git repository

📊 Impact

Before:

  • Manual code review catches ~60% of naming issues
  • Inconsistent names across the codebase
  • New developers repeat the same mistakes

After:

  • Automated checks catch 100% before commit
  • Consistent naming enforced automatically
  • New developers learn conventions instantly

📖 Documentation


🐛 Troubleshooting

"command not found: name-check"

cd /Users/dkumar/Github/learn/function-naming-mcp
npm link

Git hook not triggering

chmod +x .git/hooks/pre-commit

Watch mode not working

# Make sure directories exist
name-check watch app/ lib/

🎉 Get Started

# 1. Install
npm install && npm link

# 2. Setup git hook in your project
cd /path/to/your/project
name-check install-hook

# 3. Done! Try committing bad code

Start catching naming issues automatically! 🚀


📄 License

MIT © Deepan Kumar

🙏 Credits

Built with Model Context Protocol (MCP)