Skip to content
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

Can't format hidden / dotfiles #228

Open
declension opened this issue Aug 27, 2024 · 6 comments
Open

Can't format hidden / dotfiles #228

declension opened this issue Aug 27, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@declension
Copy link

Describe the bug

Can't get yamlfmt (and probably other formatters) to process "hidden" / "dotfiles", i.e. files with a leading ..

This is particularly annoying for certain CI systems, where the primary configuration is in YAML with names like .gitlab-ci.yml.

To Reproduce

  • Configure a project with treefmt-nix
  • Configure with programs.yamlfmt.enable = true
  • Add a slightly malformed YAML file, test.yaml and a copy at .test.yaml
  • nix fmt

Expected behavior

Both are formatted

But only one is...

Additional

Have tried various combinations of global and per-formatter include / exclude overrides, but no joy!

@declension declension added the bug Something isn't working label Aug 27, 2024
@declension
Copy link
Author

Can also replicate this with recent treefmt-nix on other formatters e.g. shfmt, so widening the title

@declension declension changed the title Can't get yamlfmt to format hidden / dotfiles Can't format hidden / dotfiles Sep 27, 2024
@declension
Copy link
Author

Ah, so maybe this is just a downstream effect of numtide/treefmt#153

@brianmcgee brianmcgee self-assigned this Sep 27, 2024
@brianmcgee
Copy link
Member

What version of treefmt are you using?

@declension
Copy link
Author

What version of treefmt are you using?

Yes, I started to wonder about this too. A few different versions in a few places, but generally pinning to nixpkgs 24.05, and pinning treefmt's inputs to that. So then 0.6.1 I think.

@brianmcgee
Copy link
Member

You want to use treefmt2 instead.

If you use treefmt-nix it will automatically use the latest version. treefmt is pointing to the old rust branch and is kept for posterity until version stabilises at which point we'll update it (quite soon I think). treefmt2 points to the latest version which was re-written in Go.

@jwillikers
Copy link
Contributor

jwillikers commented Oct 8, 2024

This appears to be an issue for hidden justfiles, .justfile, too. I think this is related to the just formatter in this case. I've opened #246 to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants
@brianmcgee @declension @jwillikers and others