Skip to content

lint: warn on long comment blocks; trim three that landed this week - #494

Open
pcarleton wants to merge 4 commits into
mainfrom
paulc/comment-length-lint
Open

lint: warn on long comment blocks; trim three that landed this week#494
pcarleton wants to merge 4 commits into
mainfrom
paulc/comment-length-lint

Conversation

@pcarleton

Copy link
Copy Markdown
Member

Motivation and Context

Review bandwidth. A growing share of PRs here are AI-assisted, and they tend to arrive with 20 to 30 line comment blocks that narrate spec history, process and review context: material that belongs in the PR description, not in source we maintain forever. Recent examples: the fixture header and tools.ts block in #380 (trimmed before merge) and three blocks that landed with #476 and #483 (trimmed here). A lint warning with an actionable message lets the author's tooling fix this before a maintainer has to ask, and stating the norm in AGENTS.md reaches agents before they write the code.

What

  • local/comment-length, an inline rule in eslint.config.mjs (no new dependency): warns when a block comment or a run of // lines exceeds 15 lines (25 for a file's header comment). The message says what to do: keep the rule and the non-obvious "why", move history and process notes to the PR description. Vendored src/spec-types/** is exempt; nine pre-existing long comments that are genuine API or scenario contracts carry a targeted disable with a reason.
  • AGENTS.md and CONTRIBUTING.md state the norm: comments are short and standalone, never reference review-time or PR-time context, and a local/comment-length warning means "move this to the PR description", not "add a disable".
  • Comment trims in http-base.ts, issuer-parameter.ts and resource-mismatch.ts (from fix(http-base): return valid empty results for unhandled list methods #476 and fix(client/auth): bind negative-check verdicts to an observed prerequisite #483) down to the standalone why. Comment-only, no behaviour change.
  • Severity is warn: npm run lint and CI stay green (exit 0), and actions/setup-node's ESLint problem matcher shows the warnings as inline annotations on the PR diff.

Not included: an optional follow-up that posts one sticky PR comment listing the warnings (two-workflow workflow_run pattern, since fork PR tokens are read-only). Happy to add it if we want a commenting bot; the annotation path may be enough.

How Has This Been Tested?

npm run check clean with zero warnings on the branch; client auth and http-base tests pass (85). On main the rule finds 18 body / 8 header sites at these thresholds (all handled here); run against #380's original head it flags exactly the two blocks that were trimmed by hand.

Breaking Changes

None. Lint warnings only.

Types of changes

  • Documentation update
  • Tooling / lint

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added or updated documentation as needed

pcarleton and others added 3 commits September 6, 2026 19:56
…e norm in AGENTS.md

Comment blocks over 15 lines (25 for a file header) get a warning whose
text tells the author — human or agent — to keep the rule and the
non-obvious why in the comment and move history/process notes to the PR
description. Implemented as an inline local rule in eslint.config.mjs (no
new dependency); vendored src/spec-types are exempt; the ten pre-existing
long comments that are genuine API/scenario contracts carry a targeted
disable with a reason. Warnings do not fail npm run lint / CI; setup-node's
eslint-stylish problem matcher turns them into PR annotations.

Co-Authored-By: Claude <noreply@anthropic.com>
… why

Comment-only change. Drops review-time narration (which sites had drifted,
what the pre-fix behaviour was) and keeps the rule plus the non-obvious
reason, per AGENTS.md.

Co-Authored-By: Claude <noreply@anthropic.com>
@pkg-pr-new

pkg-pr-new Bot commented Sep 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

npx https://pkg.pr.new/@modelcontextprotocol/conformance@494

commit: 721e850

@pcarleton
pcarleton marked this pull request as ready for review September 6, 2026 20:16
@pcarleton
pcarleton enabled auto-merge (squash) September 6, 2026 20:17
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