Skip to content

Commit

Permalink
Merge pull request #59 from liquidz/dev
Browse files Browse the repository at this point in the history
0.11.1
  • Loading branch information
liquidz authored Feb 6, 2021
2 parents ffaa6ab + 3d3c413 commit 4fc3f38
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. This change

== Unreleased (dev)

== 0.11.1 (2021-02-06)
// {{{
=== Fixed

* https://github.com/liquidz/antq/issues/58[#58]: Fixed to avoid NullPointerException when POM does not contains SCM.
// }}}

== 0.11.0 (2021-02-06)

// {{{
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>antq</groupId>
<artifactId>antq</artifactId>
<version>0.11.0</version>
<version>0.11.1</version>
<name>antq</name>
<description>Point out your outdated dependencies</description>
<url>https://github.com/liquidz/antq</url>
Expand Down
16 changes: 7 additions & 9 deletions src/antq/diff/java.clj
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,13 @@
(when-let [model (some-> dep
(dep->pom-url)
(u.mvn/read-pom))]
(-> model
(u.mvn/get-scm)
(u.mvn/get-scm-url)
;; fallback
(or (u.mvn/get-url model))
;; normalize
(u.url/ensure-https)
(u.url/ensure-git-https-url)))

(let [scm-url (some-> model
(u.mvn/get-scm)
(u.mvn/get-scm-url))
project-url (u.mvn/get-url model)]
(some-> (or scm-url project-url)
(u.url/ensure-https)
(u.url/ensure-git-https-url))))
;; Skip showing diff URL when POM file is not found
(catch java.io.FileNotFoundException _ nil)))
(def get-scm-url (memoize-by get-scm-url* :name))
Expand Down
12 changes: 12 additions & 0 deletions test/antq/diff/java_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@
u.mvn/read-pom (fn [_] (throw (java.io.FileNotFoundException. "test exception")))]
(t/is (nil? (diff/get-diff-url (assoc dep :name "pom/not-found"))))))

(t/testing "POM does not have SCM"
(with-redefs [sut/get-repository-url (constantly "https://example.com")
u.mvn/read-pom (fn [url]
(println "FIXME url" url)
(when (= "https://example.com/pom/noscm/1.0/noscm-1.0.pom" url)
(doto (Model.)
(.setUrl "https://github.com/pom/no-scm"))))
u.git/tags-by-ls-remote (fn [url]
(when (= "https://github.com/pom/no-scm/" url)
["v0.0" "v1.0" "v2.0" "v3.0"]))]
(t/is (= "https://github.com/pom/no-scm/compare/v1.0...v2.0"
(diff/get-diff-url (assoc dep :name "pom/noscm"))))))

(t/testing "not supported URL"
(with-redefs [sut/get-repository-url (constantly "https://example.com")
Expand Down

0 comments on commit 4fc3f38

Please sign in to comment.