-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add default nix formatter and its corresponding Github action #190
Conversation
5ed2f6d
to
8ec55db
Compare
8ec55db
to
49d51e9
Compare
@jtojnar WDYT about this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this in principle and Alejandra feels closest to the ideal but there are still some cases where I feel like the formatting style hinders reading style where one is quickly scanning the code top-down (without moving much focus to the right).
I have wanted to play with it some more and argue for style changes where necessary upstream but have not found the time yet.
nixpkgs, | ||
utils, | ||
}: | ||
# For each supported platform, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misaligned. Edit: Reported in kamadorueda/alejandra#372 (comment)
}: | ||
# For each supported platform, | ||
utils.lib.eachDefaultSystem ( | ||
system: let |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving let
to the same line as parameters is IMO inconsistent with indenting function bodies and makes visually scanning code harder (especially when the parameter list is long).
pkgs: | ||
|
||
# Overlay to be passed as packageOverrides to Nixpkgs’s generic PHP builder: | ||
|
||
final: | ||
prev: | ||
|
||
let | ||
final: prev: let |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also weird, some arguments on single line and other not. Edit: reported in kamadorueda/alejandra#375
callPackage = | ||
cpFn: | ||
cpArgs: | ||
|
||
callPackage = cpFn: cpArgs: | ||
prev.callPackage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here again the arguments are moved away from the function body’s level, making it harder to notice it is a function body when scanning the code.
prev.callPackage | ||
cpFn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function
argument1
arg2
to me looks too much like a list of equal items so I have started indenting the arguments:
function
argument1
argument2
Will need to do more testing to see how it plays out in practice.
49d51e9
to
9e67dfb
Compare
What we could do, is to use I saw many controversial things about IMHO, I like |
9e67dfb
to
7b6a610
Compare
Closing the PR until further notice. |
This PR:
alejandra
--dry-run
hasn't been implemented yet, seenix fmt
should have a--dry-run
option or similar NixOS/nix#6918)