ndmitchell / weeder

Detect dead exports or package imports
BSD 3-Clause "New" or "Revised" License
124 stars 8 forks source link

Packages with 'extra-dep: true' should not get weeded #18

Closed chreekat closed 7 years ago

chreekat commented 7 years ago

Technically you might call this a bug in 'stack query', which lists packages as 'local' when it probably shouldn't. But 'stack query' is marked as experimental. ;)

ndmitchell commented 7 years ago

Any suggestion how I should enumerate the packages? Is there a flag to stack query? Or do I have to resort to parsing stack.yaml myself?

mitchellwrosen commented 7 years ago

The format of stack.yaml wrt extra deps is about to change according to https://fpcomplete-site-extensible-snapshots.review.gitlab.fpcomplete.com/blog/2017/07/stacks-new-extensible-snapshots. I agree that this is a stack query bug =)

mitchellwrosen commented 7 years ago

I didn't see any issues about it so I opened commercialhaskell/stack#3258

mitchellwrosen commented 7 years ago

@chreekat As a workaround, you can just ignore the extra deps foo and bar like this:

# .weeder.yaml
- package:
  - name: foo
- package:
  - name: bar
chreekat commented 7 years ago

Thanks @mitchellwrosen !

@ndmitchell I opened this merely to bring the 'stack query' bug to your attention. I think I'll close it with the assumption that it won't bite too many other weeder users.

ndmitchell commented 7 years ago

Thanks for tracking this down, reporting, and raising upstream bugs. Until it's fixed, I've added a note at the bottom of the readme.

chreekat commented 7 years ago

Happy timing - I have a suspicion that the upcoming stack changes will probably fix this (and a bunch of other, unrelated problems I was having with specifying git repos as extra-deps).

mitchellwrosen commented 7 years ago

Huh, my workaround actually doesn't seem to work, but the HEAD version of stack is more accurate about which packages are locals.

mitchellwrosen commented 7 years ago

Nevermind, it does work, I accidentally used .weeder.yml in my script instead of .weeder.yaml

ndmitchell commented 7 years ago

@mitchellwrosen An understandable mistake... Should weeder look for both?

mitchellwrosen commented 7 years ago

I wouldn't complain if it did :)

Don't think stack or travis check for both, though

ndmitchell commented 7 years ago

Given that stack and travis don't, I won't either. I did make --verbose say what is being used though, which hopefully gives a way to debug such failures.