nix-community / nixpkgs-fmt

Nix code formatter for nixpkgs [maintainer=@zimbatm]
https://nix-community.github.io/nixpkgs-fmt/
Apache License 2.0
583 stars 32 forks source link

Formatting multiline comments keeps adding spaces #232

Closed SuperSandro2000 closed 3 years ago

SuperSandro2000 commented 3 years ago

Describe the bug Some multiline comments keep adding spaces when reformatting.

To Reproduce Steps to reproduce the behavior:

  1. Run nixpkgs-fmt on lib/generatos.nix in nixpkgs (https://github.com/NixOS/nixpkgs/commit/a43e629a3e1e1039973a13c7f380e4cbb2d9f3ae#diff-56d5f4426e78a9b4d1d89abbfe85a6196ea411b7eaddfc51a677e1e4e55c1e91)
  2. Repeat that and watch line 213 and 214.

Expected behavior It does not add new spaces every run.

System information

Additional context @Kiwi https://github.com/NixOS/nixpkgs/commit/a43e629a3e1e1039973a13c7f380e4cbb2d9f3ae#diff-56d5f4426e78a9b4d1d89abbfe85a6196ea411b7eaddfc51a677e1e4e55c1e91

zimbatm commented 3 years ago

not sure if it's related but this is also an issue: https://github.com/Kiwi/lol-nix-formatter/blob/master/apache.nix

Kiwi commented 3 years ago
kiwi@mvp-nixos nixpkgs [idempot-not]$ git show HEAD --name-only
commit 2cf58fb5bad385190a2ebcf293953f24ec7142f9 (HEAD -> idempot-not, origin/idempot-not)
Author: Robert Djubek <envy1988@gmail.com>
Date:   Sat Mar 6 12:52:52 2021 +0000

    find . -name "*.nix" -exec nixpkgs-fmt {} +

lib/attrsets.nix
lib/default.nix
lib/generators.nix
maintainers/scripts/eval-release.nix
nixos/modules/services/mail/roundcube.nix
nixos/modules/system/boot/systemd-nspawn.nix
pkgs/build-support/build-maven.nix
pkgs/build-support/emacs/melpa.nix
kiwi@mvp-nixos nixpkgs [idempot-not]$

https://github.com/Kiwi/nixpkgs/tree/idempot-not

happysalada commented 3 years ago

I have a regression of that bug it seems https://github.com/NixOS/nixpkgs/pull/129392/files Running nixpkgs-fmt on the files of the PR will add spaces on multiline comments

happysalada commented 3 years ago

I think @zimbatm opened a separate issue for that https://github.com/nix-community/nixpkgs-fmt/issues/254 After he took a look, it seems to be a different issue