Readability: add concrete measurables (function length, nesting depth)#10
Open
mshykov wants to merge 1 commit into
Open
Readability: add concrete measurables (function length, nesting depth)#10mshykov wants to merge 1 commit into
mshykov wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Both are phrased as questions ("If so, can it be decomposed?") matching the section's existing tone — soft heuristics, not hard cutoffs.
Diff
Inserted next to the related "smaller methods" question for proximity.
Opening as draft so you can request changes before I mark it ready.