-
Notifications
You must be signed in to change notification settings - Fork 110
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
Print dependency cycles in error message #340
Print dependency cycles in error message #340
Conversation
38f945c
to
3b13d83
Compare
Sorry, goofed up. The PR should now pass CI as demonstrated here. |
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.
LGTM. Indeed, debugging dependency cycles is quite tricky currently.
Since DependencyLoop
has been exposed to users, this is a breaking change, but I doubt that there are many clients affected.
3b13d83
to
819e5ea
Compare
I've added a changelog entry. @Bodigrim Given that this PR has been open for two weeks and hasn't attracted any comments, I doubt it is controversial. Is there anything I can do to help this get merged? |
I think this is a valuable addition, which justifies a minor breakage. Indeed I needed such feature in the past. @andreasabel @ocharles @VictorCMiraldo @adamgundry opinions? |
I never needed this and I didn't know that
|
I did that to make self-loops non-ambiguous / more obvious to read. In my example I've got four separate dependency cycles, but they're all forming a self-loop. If we'd go with the list as you posted, I think we should do something like:
|
819e5ea
to
9295ada
Compare
@VictorCMiraldo I've implemented your suggestion. Could you re-review and/or start CI? |
9295ada
to
09d1423
Compare
Thank you @martijnbastiaan, I triggered CI. |
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.
LGTM, thanks!
core/Test/Tasty/Run.hs
Outdated
deriving (Typeable) | ||
|
||
instance Show DependencyException where | ||
show DependencyLoop = "Test dependencies form a loop." | ||
show (DependencyLoop css) = "Test dependencies have cycles:" ++ showCycles css |
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.
Yes, you're right. And showCycle
should do the -
stuff. Currently it looks like:
mod-bench: Test dependencies have cycles:All.Power.Data.Mod, All.Power.Data.Mod
- Foo, Bar, Foo
core/Test/Tasty/Run.hs
Outdated
show DependencyLoop = "Test dependencies form a loop." | ||
show (DependencyLoop css) = "Test dependencies have cycles:" ++ showCycles css | ||
where | ||
showCycles = intercalate "\n- " . map showCycle |
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 need "\n- "
before the first line as well, otherwise the output looks like
mod-bench: Test dependencies have cycles:All.Power.Data.Mod, All.Power.Data.Mod
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.
Good catch, thanks!
09d1423
to
0944186
Compare
Thanks @Bodigrim, I've added a test for it too. Should be good now! |
0944186
to
a256fad
Compare
@VictorCMiraldo feel free to merge. |
Let's merge then! :) |
While Tasty detects cycles and prints an error message, it does not print the cycles it found. This PR makes sure it does. I've tested it on another code base with cycles in it, the output looks like:
Note the double dot is an artifact of this particular test tree.