Skip to content

Readability: add concrete measurables (function length, nesting depth)#10

Open
mshykov wants to merge 1 commit into
mgreiler:masterfrom
mshykov:readability-concrete-measurables
Open

Readability: add concrete measurables (function length, nesting depth)#10
mshykov wants to merge 1 commit into
mgreiler:masterfrom
mshykov:readability-concrete-measurables

Conversation

@mshykov

@mshykov mshykov commented May 6, 2026

Copy link
Copy Markdown

What

Adds two checklist questions to the Readability section providing concrete numeric heuristics alongside the existing open-ended ones.

Why

The Readability section asks valuable open questions ("Can the readability be improved by smaller methods?") but provides no calibration anchor for a reviewer new to a codebase. Two widely-used heuristics fill that gap:

Addition Source / convention
Functions / methods longer than ~50 lines Code Complete (McConnell), Google style guides, SonarQube default rule
Nesting deeper than 3 levels Common cyclomatic-complexity proxy; default in many linters

Both are phrased as questions ("If so, can it be decomposed?") matching the section's existing tone — soft heuristics, not hard cutoffs.

Diff

 - [ ] Can the readability of the code be improved by
 smaller methods?
+- [ ] Are functions or methods longer than ~50 lines?
+If so, can they be decomposed into smaller, named pieces?
+- [ ] Is any block of logic nested more than 3 levels
+deep? If so, can it be flattened (early returns, guard
+clauses) or extracted into a helper?

Inserted next to the related "smaller methods" question for proximity.

Opening as draft so you can request changes before I mark it ready.

The Readability section currently asks open-ended questions
('Can the readability of the code be improved by smaller
methods?'). For reviewers calibrating on a new codebase, two
concrete numeric heuristics speed up the 'is this a smell?'
judgment:

- Functions / methods over ~50 lines: a long-standing rule of
  thumb (mentioned in Code Complete, used by Google's style
  guide, common in linters like SonarQube). Not a hard cutoff —
  the 'if so, can they be decomposed' framing keeps the question
  open-ended like the rest of the section.
- Nesting deeper than 3 levels: similarly common as a cyclomatic-
  complexity proxy. Pairs naturally with the smaller-methods
  question.

Both phrased as questions, not statements, to match the
section's existing tone. Inserted next to the related
'smaller methods' question.
@mshykov mshykov marked this pull request as ready for review May 6, 2026 14:20
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