tweag / pirouette

Language-generic workbench for building static analysis
MIT License
47 stars 2 forks source link

Add ormolu, remove hlint. #119

Closed VictorCMiraldo closed 2 years ago

VictorCMiraldo commented 2 years ago

This PR brings in a lot of changes that were produced by ormolu; the important changes are w.r.t. hooking up ormolu to our CI:

Closes #105

I advise people to set up a commit hook to run ormolu for you; you can do so by creating an executable file named .git/hooks/pre-commit with the following contents:

#!/usr/bin/env bash
set -e

# command adapted from https://github.com/JLLeitschuh/ktlint-gradle  task addKtlintFormatGitPreCommitHook
filesToFormat="$(git --no-pager diff --name-status --no-color --cached | \
  awk '($1 == "M" || $1 == "A") && $2 ~ /\.hs/ { print $2} $1 ~ /R/ && $3 ~ /\.hs/ { print $3 } ')"

echo "files to format $filesToFormat"
for sourceFilePath in $filesToFormat
do
  ormolu --mode inplace "$(pwd)/$sourceFilePath"
  git add $sourceFilePath
done;

I'll add that to the readme and to the repo on a separate PR used to update the readmes.

VictorCMiraldo commented 2 years ago

I'll merge this unreviewed since it's just cosmetic changes on the code; I'll use some of my time to solve the merge conflicts that this will cause.