This is the only way forward once you pass certain lines of code threshold, and it’s a good idea from an architectural and cognitive overhead point of view
I migrated a big codebase in the past. My two cents is that the best approach is putting lines of code directly in the general public hands, i.e. on Nix’s master, no feature flags, and it’s more valuable to have 1 line of code migrated this way than to have 1000 “migrated” under a feature flag (i.e. duplicated), or separated from the general public hands (i.e. a fork)
I believe a refactor like this needs an RFC and getting the approval from the code owners. If we could get that, I would personally put time into migrating code
Looking at the code, this doesn’t pull comments up before the previous line, but actually just keeps comments inline if they already were inline (which was a frequently requested feature; I do this a lot too when writing nix for some reason; maybe because lists are so common and tall?).
I imagine the diffs are for formatting before and after the 7.0 release, rather than directly on nix code, but that could be stated more clearly
Wow this has come such a long way! It’s amazing what not even 2 months of actually listening to constructive feedback can bring. Great job @kamadorueda and thanks for your work on this! And everyone who helped in some way or another, of course.
Some improvements to the CLI have landed the main branch in order to make it more pleasant to use:
In particular, the elements that people identified as less useful were removed, the elements people identified as useful were polished, the screen is not cleared anymore, the output is more minimalistic by default, and Vim users can now use :%!alejandra -qq (double q) to format the current buffer, even if it contains syntax errors
Also, now certain sponsor tiers allow companies to advertise their offerings to active Nix users by placing a small ad at the end of Alejandra’s terminal output, and also some thank you messages were included for the sponsors and contributors of the project.
Congratulations! Your code complies with the Alejandra style.
👉 [Sponsored] Advertise your company here, reach lots of active Nix users!
More information at: https://github.com/sponsors/kamadorueda
It would be nice if you help me test these changes before cutting a 3.0 release,
While I understand the sponsorship advertisement on Github, being shown one on CLI is bit tough to swallow. Even then, it would be acceptable for Alejandra the standalone tool. If Alejandra gets accepted as de-jure formatter via RFC I would not like an advertisement in default Nix behavior.