Skip to content

CLAUDE.md: adopt five coding rules from the #1132 review; add the Copilot mirror - #1144

Merged
fanchercm merged 1 commit into
nextfrom
docs/claude-md-coding-rules
Nov 24, 2026
Merged

fanchercm merged 1 commit into
nextfrom
docs/claude-md-coding-rules

Conversation

@fanchercm

Copy link
Copy Markdown
Collaborator

Summary

Adopts the five coding rules proposed in the review of #1132 into CLAUDE.md, and creates .github/copilot-instructions.md, the mirror CLAUDE.md has always referred to but which did not exist.

The rules

Added as top-level sections after Code Quality Standards:

  1. None must name a value, not a gap. No Optional[T] = None default where absence is a bug; "count the fillers".
  2. Keyword-only arguments. More than 3 arguments, or any default: only the first one or two stay positional.
  3. Import placement. All imports at the top of the file; a deferred import only for a real cycle, an optional dependency or an expensive load, with a comment saying which.
  4. Private names do not cross module boundaries. A test may import a private name from the module it tests, and a package's own private modules may use each other's names.
  5. Named states are literals, not free text. One str-valued Enum or Literal, imported everywhere it is used.

They apply to code that is written or touched, with no retroactive sweep.

Changes from the proposed text

  • Rule 5:

    • the example CalibrationSource has no UNKNOWN member;
    • a stored string that is not a member is rejected, not mapped to a fallback member;
    • a value that cannot be stated is refused rather than made into a state.

    This follows the maintainer's decisions for calibrations in Calibration content hash: a calibration identifies itself and owns the "same calibration?" check #1141.

  • Rule 4: the list of NXstress private files names only files that exist on next. _runs.py, _workspace_key.py, _validation.py, _append.py and _read.py arrive with the NXstress phase-3 work.

  • Corrections from a review pass:

    • many existing functions already cross the keyword-only threshold (e.g. mask_util.save_mantid_mask);
    • _peaks.py has three uncommented deferred imports, not two;
    • there is one record.get("source", "none") default, in HidraSetup, not several;
    • "Three things this does not forbid", not two;
    • the example signatures gained return type hints, per Code Quality Standards.

Copilot mirror

.github/copilot-instructions.md has the same text as CLAUDE.md, with its links rewritten relative to .github/ and a note that tool names such as TodoWrite and Agent are Claude Code's. Keep the two in sync, as CLAUDE.md says.

Testing

Documentation only. I checked every cited path, function and line against next, and every relative link in the mirror resolves.

Refs #1132

🤖 Generated with Claude Code

…ilot mirror

Adds five rules after "Code Quality Standards", proposed in the review of
#1132 and adopted by the maintainer:
- `None` must name a value, not a gap
- Keyword-only arguments
- Import placement
- Private names do not cross module boundaries
- Named states are literals, not free text

Adapted from the proposal: rule 5 has no UNKNOWN member, and a stored
string that is not a member is rejected, not mapped to a fallback (the
maintainer's decision for calibrations, #1141). Rule 4's NXstress file list
names only files on `next`. A review pass corrected factual claims (existing
functions already cross the keyword-only threshold; three deferred imports
in _peaks.py; one source default, in HidraSetup), "Three things", and the
examples' return type hints.

Adds .github/copilot-instructions.md, which CLAUDE.md has always named as
its mirror but which did not exist: the same text, with links relative to
.github/.

Refs #1132

Assisted-by: Claude Code
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.12%. Comparing base (642f293) to head (b583287).

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #1144   +/-   ##
=======================================
  Coverage   87.12%   87.12%           
=======================================
  Files         106      106           
  Lines       16655    16655           
=======================================
  Hits        14510    14510           
  Misses       2145     2145           
Flag Coverage Δ
gui 69.51% <ø> (ø)
integration 57.50% <ø> (ø)
ring-calibration 32.41% <ø> (ø)
unit 55.79% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fanchercm
fanchercm merged commit 82a9eba into next Nov 24, 2026
16 checks passed
@fanchercm
fanchercm deleted the docs/claude-md-coding-rules branch November 24, 2026 21:58
fanchercm added a commit that referenced this pull request Nov 25, 2026
fanchercm added a commit that referenced this pull request Nov 25, 2026
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