[Style] stylua format entire codebase#7199
[Style] stylua format entire codebase#7199keithharvey wants to merge 1 commit intobeyond-all-reason:masterfrom
Conversation
Problem
Notably Solution
or Problem here is that introduced a LOT of changes. I was surprised how few changes there were the first time so that explains it.
|
There was a problem hiding this comment.
Isn't linting something we want to run on the dev's machine before they push, rather than as an action after?
There was a problem hiding this comment.
Yes. The README contains recommendations to set up a github hook. We can also add that to the setup script over in BAR-Devtools. This is more to catch people that didn't do that.
- I should probably add a recommendation for vscode setup and extensions to auto format as well
- Another option would be to auto-format when it hits the CI, that's less contrib friction but potentially surprising. I would just force the hook by catching them with the linter for now but I'm open to just doing it in the CI too. Maybe for now adding a github workflow that CAN format for us, so we can just nuke PRs from orbit as a one-off with a stylua pass wouldn't be a terrible migration strategy here.
Edit:
@WatchTheFort I did both of these things, but most relevant to you is that I added a workflow that you can run against arbitrary PRs (untested).
.stylua.toml
Outdated
| @@ -1,13 +1,11 @@ | |||
| syntax = "All" | |||
| column_width = 2000 | |||
| column_width = 120 | |||
There was a problem hiding this comment.
Where did this number come from? The solution for excessively long lines is better formatting, or better code architecture, not arbitrarily splitting across multiple lines.
There was a problem hiding this comment.
Where did this number come from?
120 is stylua's own default. Industry standard range is 80-160; 120 sits in the middle.
The solution for excessively long lines is better formatting
This is better formatting -- it's automated formatting.
or better code architecture
That's a stylistic judgment call, which is exactly what we're trying to get out of the business of making manually. A formatter with a column width handles it consistently so developers don't have to debate it in review.
Having a max line length beats not having one. Without it, lines grow unchecked, diffs get wider (more merge conflicts), and side-by-side review becomes painful. 120 gives a concrete answer to "how long is too long" so we stop relitigating it per-PR. If a specific line reads better long, -- stylua: ignore above it opts out.
Related PR Comments
@WatchTheFort @efrac -- closing thoughts on #7199 for tonight. Why we're not hand-editing this PRWe don't want to deviate from the generated output any more than we already have. Right now this branch is: CI changes, a format command, and a few targeted manual fixes (the PR comment threadsI've resolved the threads I consider addressed. If you disagree on any particular closure, please reopen the ones you think still need discussion. Otherwise I'll take silence as agreement. Migration guide for contributors with in-flight branchesHere's the playbook. I just did this with Step 1: rebase onto master (after #7199 merges) git fetch origin
git rebase origin/masterStep 2: at each conflict, take your version and re-format # for pure formatting conflicts (most of them), take yours:
git checkout --theirs <conflicted-files>
# for files your branch deletes:
git rm <file>
# then re-run stylua on everything you touched:
stylua <conflicted-files>
# or if you use BAR-Devtools:
just bar::fmt
# stage and continue:
git add -A
git rebase --continueIf you're confident all your conflicts are formatting-only (no overlapping logic changes with master), you can batch the whole thing: # ⚠️ only safe when ALL conflicts are pure formatting, not semantic
git diff --name-only --diff-filter=U | xargs git checkout --theirs --
stylua .
git add -A
git rebase --continueThat's it. The formatter is idempotent -- your logical changes survive and the formatting matches master. If you use BAR-Devtools: Caveat: the BAR-Devtools recipes ( |
|
Also added .git-blame-ignore-revs so this commit is transparent in git blame. GitHub picks it up automatically. Locally it's one config line (git config blame.ignoreRevsFile .git-blame-ignore-revs). |
2df6fa9 to
8c537e4
Compare
|
does #7229 now supercede this PR? |
Kind of. That PR is a superset of all changes. This is a generative step in the migration process. 7229 is everything. It would be easier if we roll them out together probably, but each PR represents a different step. This PR is the style base. fmt - 'stylua .' There's also transform leaf branches. Fmt > mig1 This allows you to preview each transform independent of the style changes. All of this is kicked out automatically by a script for me so it shouldn't drift and we can add more transforms easily and see previews. edit: I modified the script to kick out a topology so all of this is more clear. Also split the transform leaf PRs up into completely individual (I had put spring and the global rename together for convenience before all this was scripted) |
ac235be to
902b14a
Compare
e6440d4 to
9a78a75
Compare
4d00e94 to
87f56da
Compare
4a0b9a3 to
b8000a5
Compare
bbefc23 to
eba3aad
Compare
Part of BAR type-error cleanup. Rebuilds idempotently from
masterviajust bar::fmt-mig-generate.Branch Topology
All branches in the BAR type-error cleanup stack. Regenerated deterministically by
just bar::fmt-mig-generate. Generated 2026-04-14 18:57:51 UTC.Leaves — each targets
master, mergeable independently:masterstyluabar-lua-codemod bracket-to-dotbar-lua-codemod rename-aliasesbar-lua-codemod detach-bar-modulesbar-lua-codemod i18n-kikitobar-lua-codemod spring-splitbar-lua-codemod integration-testsbar-lua-codemod busted-typesRollups — composite branches stacking the leaves and (for
fmt-llm) the env + LLM layers:mastermig