fix(benchmarks): strip block comments before counting LOC#232
Open
Lakshya77089 wants to merge 1 commit into
Open
fix(benchmarks): strip block comments before counting LOC#232Lakshya77089 wants to merge 1 commit into
Lakshya77089 wants to merge 1 commit into
Conversation
loc.js filtered comments line by line, so /* ... */ block comments whose continuation lines are not *-aligned had their inner lines counted as code. A plain indented block comment scored higher than the same code written JSDoc-style. Strip /* ... */ before the line count so both are equal, and add loc.test.js to lock the behavior. Fixes DietrichGebert#231
BruhClient
approved these changes
Jun 21, 2026
BruhClient
approved these changes
Jun 21, 2026
BruhClient
approved these changes
Jun 21, 2026
BruhClient
approved these changes
Jun 21, 2026
BruhClient
approved these changes
Jun 21, 2026
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.
Fixes #231.
loc.jsfiltered comments line by line, so/* ... */block comments whose continuation lines are not*-aligned had their inner lines counted as code. A plain indented block comment scored higher than the same code written JSDoc-style:This strips
/* ... */before the line count so both forms agree, and addsbenchmarks/loc.test.jsto lock it.Why it matters: the over-count lands on whichever arm writes more block comments, which is the verbose baseline more often than ponytail, so it nudged the headline "less code" number in ponytail's favor. Small, but worth keeping honest.
Verified:
/* */,//, and#line comments still handlednode benchmarks/loc.test.jspasses (5/5); the main test suite is unaffected.