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

Have make style ignore well-known build dirs #10560

Open
philderbeast opened this issue Nov 20, 2024 · 8 comments
Open

Have make style ignore well-known build dirs #10560

philderbeast opened this issue Nov 20, 2024 · 8 comments
Labels
re: code formatting Automated code formatting with Fourmolu or similar re: devx Improving the cabal developer experience (internal issue) type: enhancement

Comments

@philderbeast
Copy link
Collaborator

Can we have make style ignore well-known build directories like dist-newstyle and .stack-work?

$ make style
Cabal-syntax/.stack-work/dist/x86_64-linux/ghc-8.10.7/build/Distribution/Fields/Lexer.hs:45:1
  The GHC parser (in Haddock mode) failed:
  [GHC-58481] parse error on input `#'
make: *** [Makefile:32: style] Error 102
@ffaf1 ffaf1 added the re: devx Improving the cabal developer experience (internal issue) label Nov 20, 2024
@ffaf1
Copy link
Collaborator

ffaf1 commented Nov 20, 2024

This is a good suggestion, are you aware of style-modified? Does it output the same error?

@philderbeast
Copy link
Collaborator Author

Running make style-modified seems fine, no output and no error.

@ffaf1
Copy link
Collaborator

ffaf1 commented Nov 20, 2024

Your suggestion is still good, and I wonder if it has something to do with git ignores.

@9999years
Copy link
Collaborator

9999years commented Nov 20, 2024

@philderbeast If you don't already have one set up, you might consider a global Gitignore.

(NB: I have no clue if fourmolu actually checks the Gitignore or just does a naïve directory traversal.)

@philderbeast
Copy link
Collaborator Author

philderbeast commented Nov 21, 2024

Thanks @9999years, I tried committing an expansion of the .stack-work glob to include all such directories. This didn't change the make style behaviour, it still choked on the same file.

$ git diff HEAD~1 HEAD
diff --git a/.gitignore b/.gitignore

--- a/.gitignore
+++ b/.gitignore
 
 # stack artifacts
-/.stack-work/
+**/.stack-work/
 stack.yaml.lock

I see fourmolu-0.13.0.0 fixes this problem but we're on an earlier version.

Fourmolu 0.13.0.0

$ fourmolu --version
fourmolu 0.12.0.0
using ghc-lib-parser 9.6.6.20240701

@philderbeast
Copy link
Collaborator Author

I have another reproduction, the make check rule depends on make style so this also triggers the problem.

@9999years 9999years added the re: code formatting Automated code formatting with Fourmolu or similar label Nov 25, 2024
@9999years
Copy link
Collaborator

I've created a new label for code formatting issues: re: code formatting Automated code formatting with Fourmolu or similar

I believe there's some work happening with Fourmolu that might interfere with this; see #9424

@philderbeast
Copy link
Collaborator Author

After trying #10259, I was left with a file that messed up hlint:

$ hlint --default .
Warning: Can't find file "ghcconfig.h" in directories
	./dist-newstyle.apigen/build/x86_64-linux/ghc-9.10.1/Cabal-syntax-3.15.0.0/build/Distribution/Fields
	.
  Asked for by: ./dist-newstyle.apigen/build/x86_64-linux/ghc-9.10.1/Cabal-syntax-3.15.0.0/build/Distribution/Fields/Lexer.hs  at line 46 col 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
re: code formatting Automated code formatting with Fourmolu or similar re: devx Improving the cabal developer experience (internal issue) type: enhancement
Projects
None yet
Development

No branches or pull requests

3 participants