Skip to content

Align coding-standards docs + AppPrefs with the no-final-on-parameters convention (#200)#201

Merged
almothafar merged 2 commits into
masterfrom
docs/200-final-params-convention
Jul 21, 2026
Merged

Align coding-standards docs + AppPrefs with the no-final-on-parameters convention (#200)#201
almothafar merged 2 commits into
masterfrom
docs/200-final-params-convention

Conversation

@almothafar

Copy link
Copy Markdown
Owner

Closes #200.

The guideline docs said to use final on method parameters, but the actual convention is final on locals, not on parameters (new/edited code; legacy migrates incrementally). This surfaced in the two-axis review of #166 / PR #199, where AppPrefs.vibrateEnabled's final param was flagged as a hard violation the docs technically endorsed.

Changes

Docs — both kept in sync:

  • .claude/guidelines.md (AI rulebook): the Immutability line now says final on locals, not parameters; notes legacy migrates as touched.
  • CODE_REVIEW_GUIDELINES.md (human-facing): added a bad/good callout in the Variables section, dropped final from every parameter in the code examples, and updated the review-checklist item (parameters **not** marked final).

Code:

Not in scope

A codebase-wide final-param sweep. Legacy files migrate incrementally as they're touched, per the convention now documented.

Verification

  • testDebugUnitTest + lintDebug + assembleDebug green. Removing final from a parameter is a no-op modifier change — no behaviour change.

Acceptance criteria

  • Both guideline docs state "final on locals, not on parameters" and stay in sync; no example shows a final parameter (except the deliberate ❌ BAD sample).
  • AppPrefs has no final on parameters; final on locals unchanged.
  • Build + unit tests + lint green.

🤖 Generated with Claude Code

almothafar and others added 2 commits July 21, 2026 18:50
The guideline docs said "use final for all method parameters" while the
actual convention is final on locals, NOT on parameters (new/edited code;
legacy migrates incrementally). Surfaced by the #166 / PR #199 review, where
AppPrefs.vibrateEnabled's final param was a hard violation the docs endorsed.

- .claude/guidelines.md + CODE_REVIEW_GUIDELINES.md: state the convention
  (final on locals, not parameters; legacy migrates as touched), add a
  bad/good example, drop `final` from every parameter in the doc examples,
  and update the review checklist item.
- AppPrefs: drop `final` from all remaining legacy method parameters so the
  file is internally consistent (it went mixed in #199). `final` on locals
  unchanged; behaviour unchanged (final on a param is a no-op modifier).

testDebugUnitTest + lintDebug + assembleDebug green.

Closes #200

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ms-convention

# Conflicts:
#	app/src/main/java/com/almothafar/simplebatterynotifier/util/AppPrefs.java
@almothafar
almothafar merged commit d5e37bb into master Jul 21, 2026
2 checks passed
@almothafar
almothafar deleted the docs/200-final-params-convention branch July 21, 2026 16:14
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.

Align coding-standards docs + AppPrefs with the no-final-on-parameters convention

1 participant