/** * Pass #88: naming-convention (category: maintainability) * * Checks that class, interface, method, and field names follow the * established conventions for each language. Violations are purely * structural — no corpus statistics or LLM required. * * Conventions enforced: * Java / TypeScript * • Class name → PascalCase (`^[A-Z][A-Za-z0-9]*$`) * • Interface name → PascalCase; the `I`-prefix anti-pattern is * configurable (opt-in, off by default — many codebases use it * intentionally; enable via `passOptions.namingConvention.enforceIPrefix`) * • Method name → camelCase (`^[a-z][a-zA-Z0-9]*$`) * • Constant field → UPPER_SNAKE_CASE (field with final/static/const modifier) * * Python * • Class name → PascalCase (`^[A-Z][A-Za-z0-9]*$`) * • Method name → snake_case (`^[a-z_][a-z0-9_]*$`) * * Bash / Rust * • Function name → snake_case (`^[a-z_][a-z0-9_]*$`) * * Skip rules (to reduce false positives): * • Names ≤ 2 characters * • Names starting with `_` (private convention) * • Names starting with `$` (JS framework injections) * • Dunder methods: `__init__`, `__str__`, etc. * • Common single-letter generics: T, K, V, E * • Java/TS main entry: `main` * * Capped at 20 findings per file to avoid noise. */ import type { AnalysisPass, PassContext } from '../../graph/analysis-pass.js'; /** * Per-pass options for NamingConventionPass. * Pass via `AnalyzerOptions.passOptions.namingConvention`. */ export interface NamingConventionOptions { /** * When true, flag TypeScript/Java interfaces whose names begin with `I` * followed by an uppercase letter (e.g. `IUserRepository`). * Default: false — the I-prefix is used intentionally in many codebases. */ enforceIPrefix?: boolean; } export interface NamingConventionResult { violations: Array<{ entity: 'class' | 'interface' | 'method' | 'field'; name: string; line: number; expected: string; actual: string; }>; } export declare class NamingConventionPass implements AnalysisPass { readonly name = "naming-convention"; readonly category: "maintainability"; private readonly enforceIPrefix; constructor(options?: NamingConventionOptions); run(ctx: PassContext): NamingConventionResult; } //# sourceMappingURL=naming-convention-pass.d.ts.map