Skip to content

Add amber-lsp check with library lint rules - #54

Open
crimson-knight wants to merge 3 commits into
mainfrom
feat/library-lint-rules
Open

crimson-knight wants to merge 3 commits into
mainfrom
feat/library-lint-rules

Conversation

@crimson-knight

Copy link
Copy Markdown
Member

What this adds

amber-lsp check, a repository linter for Crystal libraries, with 15 library/* rules. It keeps findings on lines changed since a git ref, marks vendored code with --carried-in, and can run in advisory mode. These rules run only through check, so editor diagnostics in Amber apps are unchanged.

A changed method with a branch, loop, rescue, or raise needs a spec with a golden case, an at the boundary context, and a just past the boundary context. A private, protected, or :nodoc: method is reached through its public callers in the same type.

Verification

  • crystal-alpha spec spec/amber_lsp: 468 examples, 0 failures, 0 errors, 0 pending
  • crystal-alpha build src/amber_lsp.cr: zero warnings
  • Run against four earlier pull requests with 22 known Crystal defects: 5 flagged at the defect line, 10 more blocked until a collared test exists, 7 not reached.

shard.yml and shard.lock are unchanged.

Fifteen library/* rules, run through a new check command scoped to changed
lines, with carried-in code handling and advisory mode. A changed private,
protected, or :nodoc: method is reached through its public callers, which must
carry a golden, at-the-boundary, and just-past-the-boundary describe.
The check runner applied every rule to every file, so source-only rules
reported on specs. It now honors applies_to, anchored to the project root.

Collar matching compared only the selector, so one collared #perform
cleared every changed perform. A describe now has to name the method's
owner, or name no type at all.

Changed-line selection went silently empty for a root below the git top
level, quoted file names, and diff.noprefix. A malformed exclude_patterns
crashed the check and now exits 2.
A describe naming Sample::Widget was credited to a changed
Other::Sample::Widget method, because the name matched as a suffix of the
owner. Only an unqualified name now matches as a suffix.
crimson-knight added a commit to amberframework/micrate that referenced this pull request Nov 10, 2026
--advisory keeps findings non-blocking, so job-level continue-on-error only
hid a failed amber-lsp build or a checker exit 2. amber-lsp now builds from
amberframework/amber_cli#54 at its reviewed head.
crimson-knight added a commit to crimson-knight/grant that referenced this pull request Nov 10, 2026
--advisory keeps findings non-blocking, so job-level continue-on-error only
hid a failed amber-lsp build or a checker exit 2. amber-lsp now builds from
amberframework/amber_cli#54 at its reviewed head.

This branch has not been deployed

No deployments
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