Skip to content

Vertical alignment support#117

Open
robhanlon22 wants to merge 1 commit intogreglook:mainfrom
robhanlon22:vertical-alignment
Open

Vertical alignment support#117
robhanlon22 wants to merge 1 commit intogreglook:mainfrom
robhanlon22:vertical-alignment

Conversation

@robhanlon22
Copy link
Copy Markdown
Contributor

@robhanlon22 robhanlon22 commented Mar 3, 2026

Fixes #47.

This introduces a new :align formatting rule for projects that prefer vertical column alignment in associative forms. The rule is disabled by default, so existing formatting behavior is unchanged unless a project opts in.

The implementation lives under src/cljstyle/format/align/* and follows a structured pipeline: walk blank-line groups, build an alignment model, plan column targets, and apply spacing edits. The rule covers maps, let-like binding vectors, clause-style forms, and reader conditionals. Projects can tune behavior with :targets, :extra-binding-forms, :extra-clause-forms, and :exclude-forms.

Comment and continuation handling received focused treatment so alignment stays predictable in real code. Standalone comments are not treated as alignment columns, opener-line comments keep their spacing, and :indent-comments? (default true) controls whether standalone comments follow the next substantive line in multiline groups.

reformat-form now runs alignment as an explicit opt-in pass after indentation, followed by trailing-whitespace cleanup, which keeps target-column planning stable across repeated runs.

Configuration support was extended in src/cljstyle/config.clj, and docs were updated in doc/configuration.md and README.md to show defaults and opt-in usage.

Test coverage was expanded in test/cljstyle/format/align_test.clj, with additional integration and config validation in test/cljstyle/format/core_test.clj and test/cljstyle/config_test.clj, including cases for custom forms, reader conditionals, continuation/comment placement, blank-line boundaries, and idempotence.

Also add common macOS artifacts to .gitignore.

@robhanlon22
Copy link
Copy Markdown
Contributor Author

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 3, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 98.88268% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.98%. Comparing base (d40540a) to head (5895b7a).

Files with missing lines Patch % Lines
src/cljstyle/format/align/continuation.clj 96.77% 0 Missing and 4 partials ⚠️
src/cljstyle/config.clj 90.47% 0 Missing and 2 partials ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #117      +/-   ##
==========================================
+ Coverage   89.94%   91.98%   +2.04%     
==========================================
  Files          20       28       +8     
  Lines        1929     2459     +530     
  Branches       59       64       +5     
==========================================
+ Hits         1735     2262     +527     
+ Misses        135      133       -2     
- Partials       59       64       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@robhanlon22 robhanlon22 force-pushed the vertical-alignment branch 2 times, most recently from 9ba794c to dcded9a Compare March 8, 2026 06:31
This introduces a new `:align` formatting rule for projects that prefer
vertical column alignment in associative forms. The rule is disabled by default,
so existing formatting behavior is unchanged unless a project opts in.

The implementation lives under `src/cljstyle/format/align/*` and follows a
structured pipeline: walk blank-line groups, build an alignment model, plan
column targets, and apply spacing edits. The rule covers maps, let-like binding
vectors, clause-style forms, and reader conditionals. Projects can tune behavior
with `:targets`, `:extra-binding-forms`, `:extra-clause-forms`, and
`:exclude-forms`.

Comment and continuation handling received focused treatment so alignment stays
predictable in real code. Standalone comments are not treated as alignment
columns, opener-line comments keep their spacing, and `:indent-comments?`
(default `true`) controls whether standalone comments follow the next
substantive line in multiline groups.

`reformat-form` now runs alignment as an explicit opt-in pass after indentation,
followed by trailing-whitespace cleanup, which keeps target-column planning
stable across repeated runs.

Configuration support was extended in `src/cljstyle/config.clj`, and docs were
updated in `doc/configuration.md` and `README.md` to show defaults and opt-in
usage.

Test coverage was expanded in `test/cljstyle/format/align_test.clj`, with
additional integration and config validation in
`test/cljstyle/format/core_test.clj` and `test/cljstyle/config_test.clj`,
including cases for custom forms, reader conditionals, continuation/comment
placement, blank-line boundaries, and idempotence.

Also add common macOS artifacts to `.gitignore`.
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.

Support for vertical alignment?

2 participants