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

orchard.classpath: don't fail on directories ending on .jar #116

Merged
merged 1 commit into from
Apr 16, 2021

Conversation

vemv
Copy link
Member

@vemv vemv commented Apr 16, 2021

I recently hit the corner case of a directory named foo.jar which caused orchard to choke on it.

This PR proposes a fix.

  • The commits are consistent with our contribution guidelines
  • You've added tests to cover your change(s)
  • All tests are passing
  • The new code is not generating reflection warnings
  • You've updated the changelog (if adding/changing user-visible functionality)

@@ -22,22 +22,29 @@
(deftest classpath-test
(testing "Classpath"
(testing "URLs are absolute file paths"
(is (every? #(.isAbsolute (File. (.getPath %)))
Copy link
Member Author

Choose a reason for hiding this comment

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

Changed all instances of is every? to is inside a doseq.

This way:

  • the precise thing that failed is reported
  • we avoid huge failure reports, especially now that we added the "unzipped-jdk-source" resource path

Copy link
Member

Choose a reason for hiding this comment

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

Agreed!

Copy link
Member

Choose a reason for hiding this comment

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

Btw, I'd even suggest adding this as a guideline to the Clojure Style Guide under "Testing".

(some (fn [ext]
(.endsWith (.. file getName toLowerCase) ext))
exts)))
(and (some (fn [ext]
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't it make more sense to swap the order of changes - check first that something is not a folder? That reads better to me, and probably won't have much impact on performance.

@bbatsov
Copy link
Member

bbatsov commented Apr 16, 2021

This needs a changelog entry and we're good to go.

@bbatsov bbatsov closed this Apr 16, 2021
@bbatsov bbatsov reopened this Apr 16, 2021
@bbatsov
Copy link
Member

bbatsov commented Apr 16, 2021

I pressed "Close" instead of "Comment". Sorry!

@vemv
Copy link
Member Author

vemv commented Apr 16, 2021

Btw, I'd even suggest adding this as a guideline to the Clojure Style Guide under "Testing".

:) yeah it's something that pops up often in code review. Might contribute at some point.

Feedback applied as a git amend

@bbatsov bbatsov merged commit d536e67 into clojure-emacs:master Apr 16, 2021
@bbatsov
Copy link
Member

bbatsov commented Apr 16, 2021

Thanks!

@vemv
Copy link
Member Author

vemv commented Apr 16, 2021

🍻!

Would appreciate a release if possible - this was a nuisance while hacking on refactor-nrepl (I had that .jar dir auto-generated for some unrelated reason, causing an error in refactor-nrepl code)

@bbatsov
Copy link
Member

bbatsov commented Apr 16, 2021

Sure, I'll cut 0.7.1 as soon as I can.

@bbatsov
Copy link
Member

bbatsov commented Apr 18, 2021

The new release is out.

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