jtojnar / nixpkgs-hammering

Beat your package expressions into a shape
MIT License
245 stars 14 forks source link

attribute-ordering: false positive when attributes are on one line #31

Closed wirew0rm closed 3 years ago

wirew0rm commented 3 years ago

When there are multiple attributes all on the same line using inherit, there are false positives:

The attribute “src” should preferably come before “version” attribute in the expression.

Near /home/wirew0rm/nixpkgs/pkgs/development/tools/scenebuilder/default.nix:78:10:
   |
78 |   inherit pname version src;
   |          ^
Near /home/wirew0rm/nixpkgs/pkgs/development/tools/scenebuilder/default.nix:78:10:
   |
78 |   inherit pname version src;
   |          ^
See: https://github.com/jtojnar/nixpkgs-hammering/blob/master/explanations/attribute-ordering.md

If i put them on separate lines with an inherit each, it resolves the problem.

Also, the attribute names seem to be swapped in the exception message, contradicting the example in the linked markdown (happens also if i put them on separate lines).

Thanks for this nice tool, especially for irregular contributers like me it saves a lot of pull request iterations just getting up to speed with the most recent packaging changes. (y)

jtojnar commented 3 years ago

Thanks for reporting, should be fixed now.