Skip to content
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

Fix crash in lein-monolith graph when root and cluster name are equal #31

Merged
merged 2 commits into from
Aug 18, 2017

Conversation

MatthewDarling
Copy link
Contributor

@MatthewDarling MatthewDarling commented Aug 17, 2017

Running lein monolith graph on our project currently produces java.lang.StringIndexOutOfBoundsException: String index out of range: -1. This only happens when the name of a cluster (the % in the anonymous function) is equal to the root of the project.

The end result after this PR is that clusters at the root of the project have no label, while those that aren't get a label.

Copy link
Collaborator

@greglook greglook left a comment

Choose a reason for hiding this comment

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

Thanks for submitting a fix for this! The graph task has been needing a little polish before I documented the behavior. 😅

@@ -9,6 +9,11 @@

(def image-name "project-hierarchy.png")

(defn cluster->descriptor
[monolith-root subdirectory]
(when-not (= monolith-root subdirectory)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Style: I have a minor preference for (when (not= ... here. Please preserve the two-line spacing between top-level vars as well.

Copy link
Contributor Author

@MatthewDarling MatthewDarling Aug 18, 2017

Choose a reason for hiding this comment

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

While I was writing it, I debated whether to use not= - seems I picked wrong, haha.

I've corrected the spacing, as well.

@greglook greglook self-assigned this Aug 18, 2017
@greglook greglook added the bug label Aug 18, 2017
@greglook greglook merged commit 1347002 into amperity:master Aug 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants