Skip to content

Commit

Permalink
Quality of life changes
Browse files Browse the repository at this point in the history
* Stylish Haskell configuration included

* Disabled nixpkgs-fmt (currently no idea why it breaks in the hook)

* nonix pre-commit-hook (not tested myself)
  • Loading branch information
choener committed Dec 17, 2024
1 parent 67090f1 commit 14bbca9
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ haddocks/
get-protocol-parameters.sh
protocol-parameters-mainnet.json
.pre-commit-config.yaml
tags
80 changes: 80 additions & 0 deletions .pre-commit-config.yaml.nonix
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# DO NOT MODIFY
# This file was generated by git-hooks.nix
{
"default_stages": [
"pre-commit"
],
"repos": [
{
"hooks": [
{
"always_run": false,
"args": [],
"entry": "/nix/store/l85yyds9b2jzv5swfq4hpjwv21dq7ylr-cabal-fmt-exe-cabal-fmt-0.1.12/bin/cabal-fmt --inplace ",
"exclude": "^$",
"exclude_types": [],
"fail_fast": false,
"files": "\\.(cabal)$",
"id": "cabal-fmt",
"language": "system",
"name": "cabal-fmt",
"pass_filenames": true,
"require_serial": false,
"stages": [
"pre-commit"
],
"types": [
"file"
],
"types_or": [],
"verbose": false
},
{
"always_run": false,
"args": [],
"entry": " ",
"exclude": "^$",
"exclude_types": [],
"fail_fast": false,
"files": "",
"id": "nixpkgs-fmt",
"language": "system",
"name": "nixpkgs-fmt",
"pass_filenames": false,
"require_serial": false,
"stages": [
"pre-commit"
],
"types": [
"file"
],
"types_or": [],
"verbose": false
},
{
"always_run": false,
"args": [],
"entry": "/nix/store/in4rzg7z6mkblbasxxsg6dik44jkngbj-stylish-haskell-exe-stylish-haskell-0.14.6.0/bin/stylish-haskell --inplace --config .stylish-haskell.yaml ",
"exclude": "^$",
"exclude_types": [],
"fail_fast": false,
"files": "\\.(hs|lhs)$",
"id": "stylish-haskell",
"language": "system",
"name": "stylish-haskell",
"pass_filenames": true,
"require_serial": false,
"stages": [
"pre-commit"
],
"types": [
"file"
],
"types_or": [],
"verbose": false
}
],
"repo": "local"
}
]
}
32 changes: 32 additions & 0 deletions .stylish-haskell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
steps:

- simple_align:
cases: never
top_level_patterns: never
records: never
multi_way_if: never

- imports:
align: none
post_qualify: true

- language_pragmas:
remove_redundant: false

- trailing_whitespace: {}

columns: 80

newline: native

language_extensions:
- GeneralizedNewtypeDeriving
- ImportQualifiedPost
- NumericUnderscores
- OverloadedStrings
- BangPatterns ## stylish-haskell reports an error when and expression starts with `!`
- TypeOperators ## stylish-haskell reports an error when importing type operators such as `import Prelude (type (~))`

# stylish-haskell doesn't understand Cabal common-stanzas, so let's just
# disable it.
cabal: false
3 changes: 2 additions & 1 deletion nix/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ in
name = "smart-tokens-plutarch";
packages = [
pkgs.ghcid
pkgs.nixpkgs-fmt
];

env = { };
Expand All @@ -21,6 +22,6 @@ in
# This step is necessary because `.pre-commit-config.yaml` is ignored by git.
cabal-fmt.enable = true;
stylish-haskell.enable = true;
nixpkgs-fmt.enable = true;
nixpkgs-fmt.enable = false;
};
}

0 comments on commit 14bbca9

Please sign in to comment.