-
Notifications
You must be signed in to change notification settings - Fork 15
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
attribute-ordering: Add attribute ordering check #6
Conversation
We want to use `null` phases in tests to trigger some checks without changing the builder. Replicating unpackPhase would just be to annoying.
explanations/attribute-ordering.md
Outdated
homepage = ""; | ||
license = licenses.mit; | ||
platforms = platforms.unix; | ||
maintainers = []; |
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've noticed that a lot of expressions we've wrote have been left to right
in ordering the maintainers, but we really should do the long style no?
maintainers = []; | |
maintainers = with maintainers; [ | |
somebody | |
]; |
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.
Oh, yeah. Long style everywhere that changes more than rarely. I probably would not bother with outputs
unless there are more than five, or some of them need explanation comment.
msg = '' | ||
The ${lib.optionalString (fstInfo.group != null) "${fstInfo.group}, including the "}attribute “${fst}” should preferably come before ${lib.optionalString (sndInfo.group != null) "${sndInfo.group}’ "}“${snd}” attribute in the expression. | ||
|
||
See: https://github.com/jtojnar/nixpkgs-hammering/blob/master/explanations/attribute-ordering.md |
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.
It would be interesting if we could turn this into man
pages for offline reference.
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.
Out of scope here, though.
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.
Opened #7
The ordering documented here is exactly as what seems to be, i guess logically, the preferred order. Edit: I thing I remembered that I do is *Inputs and mesonFlags (etc.) are alphabetized. I do this with a editor plugin, but I wonder if it would be a good idea to either mention that in docs. It could be nice to do that with the tool also. |
I wanted to add
I am still not 100% on |
Based on https://discourse.nixos.org/t/document-attribute-ordering-in-package-expressions/4887.
cc @worldofpeace