Skip to content

Commit d1c00bc

Browse files
rscpombredanne
authored andcommitted
licensecheck: do not look for URLs in text matches
The old code was somehow finding URLs inside text matches. I'm not sure exactly what was wrong but I rewrote the loop header to be simpler.
1 parent 66c13d5 commit d1c00bc

7 files changed

Lines changed: 19 additions & 13 deletions

File tree

testdata/Apache-2.0-Header.t1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
# BUG: Why is there a URL match inside the text match?
21
100%
32
Apache-2.0-Header 100.0% 0,$
4-
Apache-2.0 100.0% 204,242 URL
53

64
Copyright [yyyy] [name of owner]
75

testdata/Apache-2.0.t1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
# BUG: URL matched in match
21
100%
32
Apache-2.0 100.0% 0,$
4-
Apache-2.0 100.0% 9904,9942 URL
53

64
Apache License Version 2.0, January 2004
75
http://www.apache.org/licenses/

testdata/CC-BY-4.0-URL.t1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
100%
2+
CC-BY-4.0 100.0% 31,$ URL
3+
4+
This package is licensed under
5+
https://creativecommons.org/licenses/by/4.0/legalcode.
6+

testdata/ECL-2.0.t1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
# BUG: Why did we find a URL inside the ECL-2.0 match?
21
100%
32
ECL-2.0 100.0% 0,$
4-
Apache-2.0 100.0% 365,403 URL
53

64
Educational Community License Version 2.0, April 2007
75

testdata/GPL-NotLater-Header.t1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# BUG: Should recognize
21
90.6%
32
GPL-NotLater-Header 100.0% 16,590
43

testdata/mixed.t1

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
94.6%
2-
MIT 100.0% 23,1079
3-
BSD-3-Clause 99.5% 1188,$
1+
94.8%
2+
MIT 100% 23,1079
3+
BSD-3-Clause 99.5% 1188,2665
4+
CC-BY-4.0 100% 2704,$ URL
45

56
The MIT License (MIT)
67

@@ -53,4 +54,11 @@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
5354
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
5455
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
5556
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
56-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58+
59+
~~~
60+
61+
This package is licensed under
62+
https://creativecommons.org/licenses/by/4.0/legalcode.
63+
64+

testdata/mixed.t2

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Make sure we detect CommonsClause addition.
2-
82.1%
2+
80.9%
33
Apache-2.0-Header 86.7% 126,648
4-
Apache-2.0 100.0% 236,274 URL
54
CommonsClause 100.0% 683,1397
65

76
Copyright 2018 Go Gopher.

0 commit comments

Comments
 (0)