Skip to content

Commit

Permalink
🚧 Ongoing work on issue #3
Browse files Browse the repository at this point in the history
  • Loading branch information
pmonks committed Sep 6, 2023
1 parent 645ed1c commit 086a85c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lice_comb/impl/regex_matching.clj
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
:pad-ver? true
:latest-ver "1.0"}
{:id "BSD"
:regex #"(?i)\b(?<clausecount1>\p{Alnum}+)?[\s,-]*(C(lause)?|Type)?\s*\bBSD[\s-]*\(?(Type|C(lause)?)?[\s-]*(?<clausecount2>\p{Alnum}+)?([\s-]+Clause)?(?<suffix>\s+(Patent|Views|Attribution|Clear|LBNL|Modification|No\s+Military\s+Licen[cs]e|No\s+Nuclear\s+Licen[cs]e([\s-]+2014)?|No\s+Nuclear\s+Warranty|Open\s+MPI|Shortened|UC))?"
:regex #"(?i)\b(?<clausecount1>\p{Alnum}+)?[\s,-]*(C(lause)?|Type)?\s*\bBSD[\s-]*\(?(Licen[cs]e|Type|C(lause)?)?[\s-]*(?<clausecount2>\p{Alnum}+)?([\s-]+Clause)?(?<suffix>\s+(Patent|Views|Attribution|Clear|LBNL|Modification|No\s+Military\s+Licen[cs]e|No\s+Nuclear\s+Licen[cs]e([\s-]+2014)?|No\s+Nuclear\s+Warranty|Open\s+MPI|Shortened|UC))?"
:fn bsd-id-constructor}
{:id "CC0"
:regex #"(?i)\bCC\s*0"
Expand Down
6 changes: 4 additions & 2 deletions test/lice_comb/deps_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,16 @@
(is (valid= #{"EPL-1.0"} (dep->expressions ['slipset/deps-deploy {:deps/manifest :mvn :mvn/version "0.2.0"}])))
(is (valid= #{"EPL-1.0"} (dep->expressions ['borkdude/sci.impl.reflector {:deps/manifest :mvn :mvn/version "0.0.1"}]))))
(testing "Valid deps - multi license"
(is (valid= #{"EPL-1.0" "LGPL-2.1-only"} (dep->expressions ['ch.qos.logback/logback-classic {:deps/manifest :mvn :mvn/version "1.2.7"}])))
(is (valid= #{"EPL-1.0" "LGPL-2.1-only"} (dep->expressions ['ch.qos.logback/logback-core {:deps/manifest :mvn :mvn/version "1.2.7"}])))
(is (valid= #{"EPL-1.0" "LGPL-3.0-only"} (dep->expressions ['ch.qos.logback/logback-classic {:deps/manifest :mvn :mvn/version "1.2.7"}])))
(is (valid= #{"EPL-1.0" "LGPL-3.0-only"} (dep->expressions ['ch.qos.logback/logback-core {:deps/manifest :mvn :mvn/version "1.2.7"}])))
(is (valid= #{"CDDL-1.1" "GPL-2.0-only WITH Classpath-exception-2.0"} (dep->expressions ['javax.mail/mail {:deps/manifest :mvn :mvn/version "1.4.7"}])))
(is (valid= #{"Apache-2.0" "LGPL-2.1-or-later"} (dep->expressions ['net.java.dev.jna/jna-platform {:deps/manifest :mvn :mvn/version "5.10.0"}])))
(is (valid= #{"GPL-2.0-only WITH Classpath-exception-2.0" "MIT"} (dep->expressions ['org.checkerframework/checker-compat-qual {:deps/manifest :mvn :mvn/version "2.5.5"}]))))
(testing "Valid deps - Maven classifiers"
; (is (= #{"Apache-2.0" "LGPL-3.0-or-later"} (dep->expressions ['com.github.jnr/jffi$native {:deps/manifest :mvn :mvn/version "1.3.11"}]))))) ; Blocked on https://github.com/jnr/jffi/issues/141
(is (valid= #{"Apache-2.0"} (dep->expressions ['com.github.jnr/jffi$native {:deps/manifest :mvn :mvn/version "1.3.11"}])))))

(comment
(deftest deps-expressions-test
(testing "Nil and empty deps"
(is (nil? (deps-expressions nil)))
Expand Down Expand Up @@ -202,3 +203,4 @@
'camel-snake-kebab/camel-snake-kebab {:deps/manifest :mvn :mvn/version "0.4.2"}
'tolitius/xml-in {:deps/manifest :mvn :mvn/version "0.1.1"}
'com.github.athos/clj-check {:deps/manifest :deps :deps/root (str gitlib-dir "/com.github.athos/clj-check")}})))))
)
1 change: 1 addition & 0 deletions test/lice_comb/matching_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
(is (valid= #{"BSD-3-Clause"} (name->expressions "3-Clause BSD License")))
(is (valid= #{"BSD-3-Clause"} (name->expressions "BSD 3-Clause License")))
(is (valid= #{"BSD-3-Clause"} (name->expressions "The BSD 3-Clause License (BSD3)")))
(is (valid= #{"BSD-3-Clause"} (name->expressions "BSD License 3")))
(is (valid= #{"BSD-3-Clause-Attribution"} (name->expressions "BSD 3-Clause Attribution")))
(is (valid= #{"BSD-4-Clause"} (name->expressions "BSD")))
(is (valid= #{"CC-BY-3.0"} (name->expressions "Attribution 3.0 Unported")))
Expand Down

0 comments on commit 086a85c

Please sign in to comment.