-
Notifications
You must be signed in to change notification settings - Fork 325
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 weeder (dead code elimination tool) to dev environment #4088
Conversation
nix/manual-overrides.nix
Outdated
@@ -70,4 +70,5 @@ hself: hsuper: { | |||
types-common-journal = hlib.addBuildTool hsuper.types-common-journal protobuf; | |||
wire-api = hlib.addBuildTool hsuper.wire-api mls-test-cli; | |||
wire-message-proto-lens = hlib.addBuildTool hsuper.wire-message-proto-lens protobuf; | |||
# weeder = hlib.addBuildTool hsuper.weeder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not done yet! :)
This doesn't install the pinned version of weeder, but the one from hackage (2.7). |
Since we added weeder patch to the haskell-pins.nix, it doesn't exist in the pkgs.haskelPackages package set. N.B.: This still doesn't work because some dependency of weeder doesn't compile, we should try to move it to pkgs.haskellPackages using overlay.nix and see if it works.
…kages." This reverts commit 98dc98b. (`package *` refers to all packages, but we only want local packages here.)
Makefile
Outdated
|
||
.PHONY: weeder | ||
weeder: | ||
time weeder -N || echo -e '\n\n*** make sure you have added this to your cabal.project.local and make clean before building wire-server:\n\npackage *\n ghc-options: -fwrite-ide-info\n\n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
time weeder -N || echo -e '\n\n*** make sure you have added this to your cabal.project.local and make clean before building wire-server:\n\npackage *\n ghc-options: -fwrite-ide-info\n\n' | |
weeder -N || echo -e '\n\n*** make sure you have added this to your cabal.project.local and make clean before building wire-server:\n\npackage *\n ghc-options: -fwrite-ide-info\n\n' |
Also it seems like we're gonna print this message on any failure, my guess is that it will definitely be confusing in future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are you opposed to the time
thingy? ok, fine, let's remove it.
nix/overlay.nix
Outdated
overrides = hself: hsuper: { | ||
weeder = self.haskell.lib.dontCheck (hself.callPackage ./pkgs/weeder { }); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should write the reason we're using a fork and link to a PR if we have expectation that this is temporary.
weeder.toml
Outdated
# TODO: unused-types = true | ||
# TODO: type-class-roots = false, and see how bad it gets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgotten todos?
weeder.toml
Outdated
@@ -0,0 +1,6 @@ | |||
# weeder intro and further reading: https://github.com/ocharles/weeder?tab=readme-ov-file#weeder | |||
roots = ["^Main.main$", "^Paths_.*\\..*"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just ran weeder and I think this is not complete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the purpose of this PR is not to have a perfectly calibrated weeder.toml, but for devs to be able to run weeder and calibrate it.
i'll clarify in the PR description and title. 👍
https://wearezeta.atlassian.net/browse/WPB-9667
i've run weeder from a PR locally with success (>1400 weeds, but many of them are false positives). now we only need to add that patch to our nix envs. (we should probably not run it on ci for now, until we have fine-tuned weeder.toml and eliminated all the legitimate weed.)
the purpose of this PR is:
the purpose of this PR is NOT:
Checklist
changelog.d