[minor][engg]: exclude comments and blank lines from PR size line count#2978
[minor][engg]: exclude comments and blank lines from PR size line count#2978Copilot wants to merge 2 commits into
Conversation
Agent-Logs-Url: https://github.com/AzureAD/microsoft-authentication-library-for-objc/sessions/85706625-253c-4ae9-af49-a3f987297ee7 Co-authored-by: ameyapat <6675470+ameyapat@users.noreply.github.com>
| @@ -254,6 +254,64 @@ jobs: | |||
|
|
|||
There was a problem hiding this comment.
This pull request does not update CHANGELOG.md.
Please consider if this change would be noticeable to a partner or user and either update CHANGELOG.md or resolve this conversation.
There was a problem hiding this comment.
Pull request overview
Updates the PR Size Check reusable workflow to count only “real code” lines changed (excluding blank lines and // / /* */ comment-only lines) when enforcing the max-lines threshold, so cosmetic changes don’t inflate PR size.
Changes:
- Added a
countCodeLines(patch, rawLines)helper to scan GitHub unified diff patches and count only non-comment, non-blank added/removed lines. - Switched the overall line-limit calculation from
additions + deletionsto the helper-derived “code lines” count (with fallback to raw counts whenpatchis missing). - Updated the summary table and status/failure messages to reflect “code lines changed” semantics.
| @@ -306,7 +364,7 @@ jobs: | |||
| (a, b) => (b.additions + b.deletions) - (a.additions + a.deletions) | |||
| ); | |||
There was a problem hiding this comment.
The summary table is now labeled in code lines, but sortedIncluded is still ordered by raw additions + deletions. Impact: the “top N files by changes” table may be misleading (files with many comment/blank-line edits can sort to the top even if they have few counted code lines). Recommendation: sort by the same countCodeLines(...) (or a cached codeLinesChanged) value that you display in the table.
There was a problem hiding this comment.
Fixed in 205fdc5. countCodeLines is now called once per file and the result cached as f.codeLinesChanged. Both the totalLines reduction and the table rows read from that cached value. The summary table sort also now uses codeLinesChanged so the ranking is consistent with what's displayed.
Agent-Logs-Url: https://github.com/AzureAD/microsoft-authentication-library-for-objc/sessions/589e14bd-d0b9-483b-bb0f-408b492b1e14 Co-authored-by: ameyapat <6675470+ameyapat@users.noreply.github.com>
countCodeLines(patch, fallback)helper to.github/workflows/pr-size-check-reusable.ymlthat parses a unified-diff patch and skips blank lines,//single-line comments, and/* … */multi-line block commentsf.additions + f.deletionswithcountCodeLinesin thetotalLinessum+additions / -deletionscodeLinesChangedonce per included file to avoid re-scanning the same patch multiple timescodeLinesChanged(code lines) instead of rawadditions + deletions