Skip to content

Enforce naming conventions via Perl::Critic#4

Open
lmist wants to merge 1 commit into
Getty:mainfrom
lmist:readiness/naming-consistency
Open

Enforce naming conventions via Perl::Critic#4
lmist wants to merge 1 commit into
Getty:mainfrom
lmist:readiness/naming-consistency

Conversation

@lmist

@lmist lmist commented Jun 27, 2026

Copy link
Copy Markdown

Summary

Fixes the Naming Consistency agent-readiness signal by making the project's identifier conventions machine-checkable instead of review-by-eye.

What changed

  • .perlcriticrc (new): a focused Perl::Critic profile enabling only the naming policies (NamingConventions::Capitalization + NamingConventions::ProhibitAmbiguousNames) so the gate stays low-noise. It encodes the de-facto standard already used across lib/:
    • CamelCase packages (with vLLM exempted — upstream brand capitalization)
    • snake_case subroutines/methods, leading _ allowed for private/builder subs (_build_api_key, _build__json)
    • snake_case lexical variables
    • snake_case or ALL_CAPS package globals/constants ($VERSION, %ROLE_TO_CAPS)
    • Moose/MooseX lifecycle methods (BUILD, FOREIGNBUILDARGS, …) exempted by exact name
  • lib/Langertha/Role/OpenAPI.pm: renamed the only genuine deviations — the camelCase locals $operationId/$opId — to $operation_id, matching their snake_case neighbours. The OpenAPI spec key and POD term operationId are unchanged. Behaviour-preserving.
  • README.md: new Coding conventions section documenting the standard + how to run perlcritic lib/ bin/.
  • CLAUDE.md: added a naming bullet under OOP/Async/MCP/POD conventions.
  • Changes: changelog entry.

Verification

  • perlcritic --profile .perlcriticrc lib/ bin/110 files scanned, 0 violations, exit 0 (Perl::Critic 1.156).
  • Langertha::Role::OpenAPI compiles clean after the rename (verified with full runtime deps).

The profile is deliberately tuned to pass clean on the current tree, so it can be wired into CI as an enforcement gate going forward.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>

Add a focused .perlcriticrc enabling the NamingConventions::Capitalization
and ProhibitAmbiguousNames policies so identifier naming is machine-checkable
rather than review-by-eye. The config encodes the de-facto standard already
used across lib/ (CamelCase packages, snake_case subs/vars with leading _ for
private/builder subs, ALL_CAPS constants/globals) and is tuned to pass clean
on the current tree (110 files, 0 violations) so it can serve as a CI gate.

Document the conventions in README (new 'Coding conventions' section) and
CLAUDE.md. Rename the camelCase $operationId/$opId locals in
Langertha::Role::OpenAPI to snake_case to match the surrounding style; the
OpenAPI spec key and POD term 'operationId' are unchanged (behaviour-preserving).

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant