Skip to content

Conversation

@sellout
Copy link
Contributor

@sellout sellout commented Sep 30, 2025

Overview

This (re?)enables Weeder, which does whole-program dead-code analysis. No Haskell code is touched by this PR.

There are at least three different areas of the code base where I’ve discovered myself fixing code that isn’t referenced anywhere. While I fixed those areas upon encountering them, having dead code around adds noise and introduces confusion like I’ve run into (especially with there being some more-or-less duplicated subsystems, with the old being incrementally replaced by the new)

There was a Weeder config in the repo, but it used the older Dhall format instead of the newer TOML, and has a minimal-enough config that I’m not sure whether it was ever used, and certainly not recently.

Weeder is now also included in the Nix environment and run in CI.

Implementation notes

This is mostly the first few commits from #5392, which was rightly closed.

Loose ends

This PR doesn’t delete any code. All existing weeds are grandfathered in. #5392 attempted to do too much at once, and so nothing got in. This intends to stop the accumulation of weeds first, with removal of existing weeds to come later.

`allow-import-from-derivation` is true by default in Nix, but if a user
has turned it off (as I have recently), our flake will fail without this.
Added Weeder to the default Nix shell.

Weeder no longer uses Dhall for its config, replaced it with an
equivalent TOML one.
This is temporary so that weeds can be tracked going forward without
having to fix all the existing ones first.
Also ones with debugging functions.

I don’t know why, but this caused some additional weeds to be discovered.
To make it more explicit what isn’t being checked.
This doesn’t yet turn off `type-class-roots`, because whitelisting all
of those is a pain, but it pre-populates `root-instances` with instances
that we would want to keep, even if unused.
@sellout sellout marked this pull request as ready for review October 1, 2025 02:28
@sellout sellout requested a review from a team as a code owner October 1, 2025 02:28
Copy link
Contributor

@aryairani aryairani left a comment

Choose a reason for hiding this comment

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

I'm thinking it should go into check.sh too if it's going into CI?

This script also gets run as part of `scripts/check.sh`.

Since `check-weeds` has to do much of the same work as
`check-formatting`, I extracted the common code to a separate Bash file.

Also made it so the scripts don’t have to be run from the repo root
directory.
@aryairani aryairani merged commit 99e02d5 into unisonweb:trunk Oct 1, 2025
17 checks passed
@sellout sellout deleted the minimal-weeding branch October 6, 2025 04:54
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.

2 participants