Skip to content

ci: gate the line length of new das code - #4289

Merged
borisbat merged 1 commit into
masterfrom
aleksisch/line-length-gate
Oct 13, 2026
Merged

borisbat merged 1 commit into
masterfrom
aleksisch/line-length-gate

Conversation

@aleksisch

@aleksisch aleksisch commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Adds check_line_length, a CI gate on the width of new .das code, wired into run_extended_core (the per-PR extended-checks lane).

  • Any added .das line over 100 columns fails.
  • Any added comment over 70 columns fails, measured from its // / /* marker to the end of the line (indentation does not count; block-comment continuation lines are measured from their first non-blank column).
  • Tabs count as 4 columns; a multi-byte UTF-8 character counts as 1.

Only lines the branch adds are measured: the diff runs from the merge-base with origin/<base-ref> (--base-ref, default master) to the working tree, limited to *.das. The comment scanner understands string literals, {...} interpolation holding strings, character literals, and nested /* */ comments. Files whose header says they are generated are skipped.

Locally: cmake --build build --target check_line_length.

This gate is temporary: it exists only until the whole codebase is moved to these limits; then the limits belong in a whole-tree check and this changed-lines gate goes away.

Files

  • utils/internal/line-length/line_length.das - comment scanner, width measurement, diff parsing
  • utils/internal/line-length/main.das - CLI (--base-ref, default master)
  • utils/internal/line-length/test_line_length.das - 20 arms, registered in run_utils_tests

Testing

  • test_line_length.das: 20/20 pass; negative controls (interpolation, nested block comments, quote character literal, block-continuation handling) each turn an arm red.
  • Lint and das-fmt --verify clean on the new files; CMake configures and check_line_length sits under run_extended_core.
  • The gate passes on this branch, and fails with main.das:66: comment is 83 columns, limit 70 when a long comment is appended.

@aleksisch
aleksisch force-pushed the aleksisch/line-length-gate branch from a15e219 to 18046d1 Compare October 12, 2026 10:55
check_line_length (run_extended_core) fails a branch that adds a .das
line wider than 100 columns, or a comment wider than 70 columns measured
from its marker. Only lines the branch adds are measured - the diff runs
from the merge-base with origin/<base-ref> (--base-ref, default master).
Files that announce themselves as generated are skipped.

This script is temporary: it exists only until the whole codebase is
moved to these limits, after which the limits belong in a whole-tree
check and this changed-lines gate is removed.
@aleksisch
aleksisch force-pushed the aleksisch/line-length-gate branch from 18046d1 to 63b8400 Compare October 12, 2026 23:04
@aleksisch aleksisch changed the title ci: gate the line length of new code ci: gate the line length of new das code Oct 12, 2026
@borisbat
borisbat merged commit 0e812ce into master Oct 13, 2026
37 checks passed
@borisbat
borisbat deleted the aleksisch/line-length-gate branch October 13, 2026 12:58
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.

2 participants