Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fourmolu to nix flake as a convenient script #3245

Merged
merged 6 commits into from
Sep 13, 2022

Conversation

goodlyrottenapple
Copy link
Contributor

Partially addresses #3236

@github-actions
Copy link

github-actions bot commented Sep 8, 2022

name diff_allocated_bytes diff_max_live_bytes
test/regression-evm/test-addu48u48.sh -0.000002 0.000001
test/regression-evm/test-lemmas.sh 0.000006 0.001377
test/regression-evm/test-sum-to-n.sh -0.000005 0.001221
test/regression-evm/test-dsvalue-peek-pass-rough.sh 0.000016 0.000138
test/regression-evm/test-totalSupply.sh 0.000002 -0.016118
test/regression-evm/test-storagevar03.sh 0.000002 0.001011
test/regression-wasm/test-wrc20.sh -0.000007 -0.000091
test/regression-wasm/test-loops.sh 0.000006 0
test/regression-wasm/test-locals.sh 0 0
test/regression-wasm/test-simple-arithmetic.sh -0.000028 -0.000087
test/regression-wasm/test-memory.sh -0.000018 0

@jberthold
Copy link
Member

Great, this can be very handy.
However, somehow it fails on my machine, possibly due to missing/wrong locale. I am getting around 25 errors like this:

jost@freshcode-1:~/work/RV/code/haskell-backend$ nix run .#format ./kore/src/Kore/Attribute/Smtlib/Smtlib.hs
warning: Git tree '/home/jost/work/RV/code/haskell-backend' is dirty
Loaded config from: /home/jost/work/RV/code/haskell-backend/fourmolu.yaml
fourmolu: ./kore/src/Kore/Attribute/Smtlib/Smtlib.hs: hGetContents: invalid argument (invalid byte sequence)

Quite possibly this is because of unicode characters in the comments. Smtlib.hs has a comment containing ≪S-expression≫, for instance.

Another kind of error is this, I am getting it 7 times:

warning: Git tree '/home/jost/work/RV/code/haskell-backend' is dirty
Loaded config from: /home/jost/work/RV/code/haskell-backend/fourmolu.yaml
AST of input and AST of formatted code differ.
  at kore/src/Debug.hs:(418,5)-(419,71)
Please, consider reporting the bug.

No idea about this one.

@goodlyrottenapple
Copy link
Contributor Author

@jberthold can you try now? I've seen this unicode error before and it is to do with locales indeed.. Tried adding a fix to the script. As to the second error, that should be gone with formolu 0.4, which i switched to now

Comment on lines 44 to 45
- name: Run unit tests
run: nix-build -A project.kore.checks
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still cannot get rid of this old nix-build because running the unit tests via nix flake segfaults randomly :/

Comment on lines +38 to 41
nixpkgs22_05For = system:
import nixpkgs22_05 {
inherit system;
overlays = [ z3-overlay ];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switched to the stable 22.05 branch for all the utilities like fourmolu, eventlog2html, etc. as well as cabal/stack in the dev shell

Comment on lines +3 to +6
# https://github.com/tweag/ormolu/issues/38
# https://gitlab.haskell.org/ghc/ghc/-/issues/17755
export LOCALE_ARCHIVE=
export LC_ALL=
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should hopefully address the unicode issue @jberthold

Copy link
Member

@jberthold jberthold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 works like a charm now, thx for fixing the locale!

@goodlyrottenapple goodlyrottenapple merged commit 6b37a7d into master Sep 13, 2022
@goodlyrottenapple goodlyrottenapple deleted the sam/nix-fourmolu branch September 13, 2022 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants