Skip to content

suhteevah/styleguard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

styleguard

90+ style checks 5 languages 6 categories MIT License ClawHub Zero telemetry

Your linter checks syntax. StyleGuard checks consistency.

Website · Quick Start · Patterns · Pricing


ESLint checks if your code is valid. StyleGuard checks if it is consistent.

A file where half the variables are camelCase and the other half are snake_case. A function with 8 parameters and 6 levels of nesting. A magic number 86400 buried in a conditional. Imports scattered in random order. Three different quoting styles in the same module.

Formatters like Prettier fix whitespace. Linters like ESLint catch syntax errors. But neither catches consistency violations -- the naming convention drift, magic number creep, and structural decay that make codebases unreadable over time.

StyleGuard scans your code for 90+ style consistency patterns across 5 languages. Locally. Before you commit.

Quick Start

# Install via ClawHub (free)
clawhub install styleguard

# Scan your codebase
styleguard scan

# Scan a specific directory
styleguard scan src/

# Scan a single file
styleguard scan app/services/auth.ts

# Install pre-commit hooks (Pro)
styleguard hooks install

# Generate a style audit report (Pro)
styleguard report

# Auto-fix suggestions (Pro)
styleguard fix

# Enforce team style policies (Team)
styleguard policy

# Export SARIF for GitHub Code Scanning (Team)
styleguard sarif

# Capture style baseline (Team)
styleguard baseline

What It Catches

StyleGuard runs 90+ checks organized in 6 categories:

Naming Conventions (22 checks)

Check Description Severity
Mixed Case Styles camelCase and snake_case mixed in one file High
PascalCase Violations Classes/components not PascalCase High
UPPER_CASE Constants Constants not UPPER_SNAKE_CASE Medium
File Naming Inconsistency Mixed kebab-case/camelCase/snake_case filenames Medium
Single-Letter Variables Variables like x, d, t outside loops Medium
Misleading Booleans Booleans without is/has/should/can prefix Medium
Hungarian Notation Type prefix remnants (strName, bFlag) Low
Event Handler Names Mixed handleClick vs onClick conventions Medium
Acronym Casing URL vs Url vs url inconsistency Medium

Function Quality (18 checks)

Check Description Severity
Long Functions Functions exceeding 50 lines High
Too Many Parameters Functions with > 5 params High
Deep Nesting > 4 levels of indentation Critical
God Functions Functions with too many responsibilities Critical
Missing Early Returns Deep if/else chains Medium
Callback Hell > 3 levels of nested callbacks Critical
Arrow vs Declaration Inconsistent function declaration styles Low
Multiple Return Types Functions returning mixed types Medium

Magic Numbers & Strings (14 checks)

Check Description Severity
Magic Numbers Raw numbers in conditions (except 0, 1, -1) Medium
Repeated Strings Same string literal used > 2 times Medium
Hardcoded URLs URLs embedded in business logic High
Hardcoded Timeouts Magic delay/timeout values Medium
Magic Array Indices Accessing arr[7] without explanation Low
Hardcoded Colors Hex colors in logic files Low
Numeric Status Codes 404, 500 without named constants Medium

Import & Module Organization (16 checks)

Check Description Severity
Unsorted Imports Imports not in alphabetical order Low
Mixed Import Styles require() + import in same file High
Circular Import Hints Patterns suggesting circular deps Critical
Wildcard Imports import * from module Medium
Deep Relative Paths ../../../ depth > 3 levels Medium
Unused Imports Imported names not referenced High
Side-Effect Position Side-effect imports not at top Medium

Comment & Documentation (12 checks)

Check Description Severity
TODO/FIXME Buildup Excessive TODO/FIXME/HACK markers Medium
Commented-Out Code Large blocks of dead code in comments Medium
Dead JSDoc Docstrings with wrong parameter names High
ts-ignore Accumulation Multiple @ts-ignore suppressions High
eslint-disable Abuse Suppression without justification Medium
Empty Catch Blocks Exceptions silently swallowed High

Code Consistency (8+ checks)

Check Description Severity
Mixed Quotes Single and double quotes in same file Medium
Inconsistent Semicolons Mixed semicolon usage Medium
Mixed Equality == and === in same JS/TS file High
Mixed Async Patterns Callbacks + promises + async/await High
Inconsistent Null Checks Mixed null/undefined/falsy patterns Medium
Inconsistent Trailing Commas Mixed trailing comma usage Low

Supported Languages

Language Naming Functions Magic Numbers Imports Comments Consistency
JavaScript/TypeScript Yes Yes Yes Yes Yes Yes
Python Yes Yes Yes Yes Yes Yes
Go Yes Yes Yes Yes Yes Yes
Java Yes Yes Yes Yes Yes Yes
Ruby Yes Yes Yes Yes Yes Yes

How It Compares

Feature StyleGuard ESLint Prettier Pylint RuboCop gofmt Checkstyle
Cross-language 5 languages JS/TS only JS/TS only Python only Ruby only Go only Java only
Naming consistency Yes Partial No Partial Partial No Partial
Magic number detection Yes Plugin No Yes Yes No Yes
Function quality metrics Yes Plugin No Yes Partial No Yes
Import ordering Yes Plugin No Plugin Partial Yes Partial
Cross-file consistency Yes No No No No No No
Pre-commit hooks Yes Plugin Plugin Manual Manual Manual Manual
Zero config Yes No Partial No No Yes No
Offline license Yes OSS OSS OSS OSS OSS OSS
Setup time 30 seconds 10+ min 5+ min 5+ min 5+ min Built-in 15+ min
ClawHub integration Yes No No No No No No
Zero telemetry Yes Yes Yes Yes Yes Yes Yes

Key distinction: ESLint, Prettier, Pylint, RuboCop, gofmt, and Checkstyle are formatters and single-language linters. StyleGuard catches consistency issues they miss -- naming convention drift across a file, magic numbers in conditionals, function complexity creep, and import disorder -- across all 5 languages with one tool.

Pricing

Feature Free Pro ($19/user/mo) Team ($39/user/mo)
Style scan (90+ checks) 5 files Unlimited Unlimited
5 language support Yes Yes Yes
Style score + grade Yes Yes Yes
Detailed remediation advice Yes Yes Yes
Pre-commit hooks Yes Yes
Style audit report Yes Yes
Auto-fix suggestions Yes Yes
Team style policies Yes
SARIF export Yes
Style baseline Yes

Commands

Free Tier (no license required)

Command Description
styleguard scan [target] Style scan (up to 5 source files)
styleguard status Show license and config info
styleguard help Show help

Pro Tier ($19/user/month)

Command Description
styleguard scan [target] Unlimited source file scanning
styleguard hooks install Install pre-commit style hooks
styleguard hooks uninstall Remove StyleGuard hooks
styleguard report [dir] Generate markdown style report
styleguard fix [dir] Generate auto-fix suggestions

Team Tier ($39/user/month)

Command Description
styleguard policy [dir] Enforce team style policies
styleguard sarif [dir] Export findings in SARIF format
styleguard baseline [dir] Capture style baseline for incremental adoption

Configuration

Add to ~/.openclaw/openclaw.json:

{
  "skills": {
    "entries": {
      "styleguard": {
        "enabled": true,
        "apiKey": "YOUR_LICENSE_KEY",
        "config": {
          "severityThreshold": "medium",
          "excludePatterns": ["**/node_modules/**", "**/dist/**"],
          "reportFormat": "markdown",
          "maxFunctionLines": 50,
          "maxParameters": 5,
          "maxNestingDepth": 4
        }
      }
    }
  }
}

Or set the environment variable:

export STYLEGUARD_LICENSE_KEY="your-key-here"

Exit Codes

  • 0 -- Clean (score >= 70, no critical issues)
  • 1 -- Issues found (score < 70 or critical issues present)

Perfect for CI/CD integration.

Privacy

  • 100% local -- no code or data sent externally
  • Zero telemetry
  • Offline license validation (JWT-based)
  • Pattern matching only -- no AST parsing or code execution

Part of the ClawHub Ecosystem

StyleGuard is built for ClawHub, the marketplace for developer tools that plug into your CLI. Other skills in the ecosystem:

License

MIT

About

StyleGuard — code style & naming convention enforcer for ClawHub

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors