Skip to content

Commit

Permalink
Add make style-modified
Browse files Browse the repository at this point in the history
As it runs fourmolu only on modified files, it's a lot faster.
  • Loading branch information
phadej authored and ffaf1 committed Jun 20, 2023
1 parent c0b7338 commit 2fac3a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ Code Style

We use automated formatting with Fourmolu to enforce a unified style across the code bases. It is checked in the CI process.
After installing Fourmolu ≥ 0.12, you can automatically format the code bases with `make style` at the top level of the project.
You can also use `make style-modified` to only format modified files.

Other Conventions
-----------------
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ style: ## Run the code styler
! -path Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs \
| xargs -P $(PROCS) -I {} fourmolu -q -i {}

style-modified: ## Run the code styler on modified files
@git ls-files --modified Cabal Cabal-syntax cabal-install \
-X Cabal-syntax/src/Distribution/Fields/Lexer.hs \
-X Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs \
-X Cabal-syntax/src/Distribution/SPDX/LicenseId.hs \
-X Cabal/src/Distribution/Simple/Build/Macros/Z.hs \
-X Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs \
| grep '.hs$$' | xargs -P $(PROCS) -I {} fourmolu -q -i {}

# source generation: Lexer

LEXER_HS:=Cabal-syntax/src/Distribution/Fields/Lexer.hs
Expand Down

0 comments on commit 2fac3a1

Please sign in to comment.