* Fix ./fmt.sh check
We accidentally introduced hlint lints when we added the compatibility
workspace. The hlint code in ./fmt.sh correctly detects that there is
a hint but then exits with 0 since it uses the exit code from `echo`
rather than the one from `hlint`. The info that we printed with
`echo` didn’t actually make any sense so I added a new comment as to
why we run hlint here. This requires some setup changes so that the
compatibility workspace gets the same Haskell flags since otherwise
using the same hlint rules obviously does not make sense.
Fixes#5701
changelog_begin
changelog_end
* Update fmt.sh
Co-Authored-By: Samir Talwar <samir.talwar@digitalasset.com>
Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
This PR adds new behaviour to the existing --scalafmt-diff flag to also
use a diff-based approach for hlint. Consequently, the flag is renamed
to the simpler and more generic `--diff`, in a backwards-compatible way.
CHANGELOG_BEGIN
CHANGELOG_END
The current behaviour of our scalafmt checks compares for changes with
origin/master, which means it is dependent on the state of the local git
repository. This makes it non-reproducible.
Added to the fact that the master branch is not currently green as per
our scalafmt rules, this makes it impossible to rebuild older commits,
which in turn could interfere with our release process.
This PR does two things:
1. Fix our codebase to agree with our formatting rules.
2. Add a flag to `fmt.sh` to enable scalafmt's diff behaviour, and
change the default to a full scan.
CHANGELOG_BEGIN
CHANGELOG_END
* Move files in daml-foundations/daml-ghc to compiler/damlc
There is also a bit of refactoring going on to actually split things
apart into sensible targets. What is still missing is a cleanup of the
module hierarchy and a cleanup of the test targets but I’ll leave
those for separate PRs.
As a nice bonus, this also reduces dependencies between targets so it
will speed up compiles.
* Update .hie-bios
Seems like an array that is only declared but never assigned to cannot
be dereferenced with `arr[@]` under `set -u`. We can easily work around
this by using an empty string as default value like `:-`.
* Add buildifier targets.
The tool allows to check and format BUILD files in the repo.
To check if files are well formatted, run:
bazel run //:buildifier
To fix badly-formatted files run:
bazel run //:buildifier-fix
* Cleanup dade-copyright-headers formatting.
* Fix dade-copyright-headers on files with just the copyright.
* Run buildifier automatically on CI via 'fmt.sh'.
* Reformat all BUILD files with buildifier.
Excludes autogenerated Bazel files.