Skip to content

Commit fdee6ba

Browse files
authored
Switch to fourmolu formatter and reformat all sources (#1825)
* Switch to fourmolu formatter and reformat all sources Some FOURMOLU_DISABLE directives were added in problematic cases (mostly CPP conditional pragmas or foreign imports). * Second pass to reduce amount of multi-line import lists * Third pass, now with fourmolu-0.18.0.0 * Fix doctests
1 parent 55371df commit fdee6ba

File tree

206 files changed

+13018
-11339
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+13018
-11339
lines changed

.github/workflows/code-style.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Code style check
2+
3+
concurrency:
4+
group: formatting-${{ github.ref_name }}
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
pull_request:
10+
11+
jobs:
12+
formatting:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 1
19+
- name: Install Nix
20+
uses: cachix/install-nix-action@v31
21+
- name: Check code formatting
22+
run: |
23+
nix develop '#haskellFormatter' --command fourmolu --mode=check --check-idempotence servant servant-*

.stylish-haskell.yaml

Lines changed: 0 additions & 190 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ Some things we like:
3636
- Few dependencies
3737
- -Werror-compatible (7.8, 7.10 and 8.0)
3838

39-
Though we aren't sticklers for style, the `.stylish-haskell.yaml` and `HLint.hs` files in the repository provide a good baseline for consistency.
39+
Haskell code should be formatted with `fourmolu` (`>= 0.18.0.0`).
40+
Please try to avoid introducing new `hlint` warnings.
41+
For Nix files, `nixfmt-rfc-style` is preferred.
4042

4143
**Important**: please do not modify the versions of the servant packages you are sending patches for.
4244

doc/tutorial/Setup.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
import Distribution.Simple
2+
23
main = defaultMain

doc/tutorial/test/JavascriptSpec.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
module JavascriptSpec where
44

5-
import Data.List
6-
import Data.String
7-
import Data.String.Conversions
8-
import Test.Hspec
9-
import Test.Hspec.Wai
5+
import Data.List
6+
import Data.String
7+
import Data.String.Conversions
8+
import Test.Hspec
9+
import Test.Hspec.Wai
1010

11-
import Javascript
11+
import Javascript
1212

1313
spec :: Spec
1414
spec = do

doc/tutorial/test/Spec.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Main where
22

33
import qualified JavascriptSpec
44

5-
import Test.Hspec (Spec, hspec, describe)
5+
import Test.Hspec (Spec, describe, hspec)
66

77
main :: IO ()
88
main = hspec spec

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fourmolu.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
indentation: 2
2+
comma-style: leading
3+
import-export-style: leading
4+
record-brace-space: false
5+
indent-wheres: true
6+
respectful: true # don't be too opinionated about newlines etc.
7+
haddock-style: single-line
8+
newlines-between-decls: 1
9+
fixities: []
10+
function-arrows: leading
11+
single-constraint-parens: never
12+
import-grouping: by-scope
13+
sort-constraints: true
14+
sort-derived-classes: true
15+
sort-deriving-clauses: true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
import Distribution.Simple
2+
23
main = defaultMain
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module Servant.Auth.Client (Token(..), Bearer) where
1+
module Servant.Auth.Client (Token (..), Bearer) where
22

3-
import Servant.Auth.Client.Internal (Bearer, Token(..))
3+
import Servant.Auth.Client.Internal (Bearer, Token (..))

0 commit comments

Comments
 (0)