mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-23 23:12:04 +03:00
build: adding nix, shell, and haskell code formatters
These need to be run through the top-level nix-shell/shell.nix
This commit is contained in:
parent
345bf2c39a
commit
48aa77a2fa
15
sh/fmt
Executable file
15
sh/fmt
Executable file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Usage: fmt
|
||||
|
||||
# Run all formatters and linters ensuring codebase consistency
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "${0%/*}"
|
||||
|
||||
./fmt-shell
|
||||
./fmt-nix
|
||||
./fmt-haskell
|
||||
|
||||
echo 'Done.'
|
18
sh/fmt-haskell
Executable file
18
sh/fmt-haskell
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Usage: fmt-haskell
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "${0%/*}/.."
|
||||
|
||||
echo "Formatting Haskell"
|
||||
|
||||
# FIXME: Avoid inplace (-i) modifications for now.
|
||||
find pkg/hs -type f -name '*.hs' \
|
||||
-exec ormolu --mode check \
|
||||
-o '-XBangPatterns' \
|
||||
-o '-XMagicHash' \
|
||||
-o '-XTypeApplications' \
|
||||
-o '-XPatternSynonyms' \
|
||||
{} \+
|
12
sh/fmt-nix
Executable file
12
sh/fmt-nix
Executable file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Usage: fmt-nix
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "${0%/*}/.."
|
||||
|
||||
echo "Formatting Nix"
|
||||
|
||||
find . -type f -name '*.nix' \
|
||||
-exec nixfmt {} \+
|
14
sh/fmt-shell
Executable file
14
sh/fmt-shell
Executable file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Usage: fmt-shell
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "${0%/*}/.."
|
||||
|
||||
echo "Formatting Shell"
|
||||
|
||||
# FIXME: Avoid inplace (-w) modifications for now.
|
||||
find sh -type f \
|
||||
-exec shfmt -s -i 2 -ln bash -l {} \+ \
|
||||
-exec shellcheck --shell=bash --format=tty {} \+
|
Loading…
Reference in New Issue
Block a user