aboutsummaryrefslogtreecommitdiffstats
path: root/skate
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-04-15 00:41:01 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-04-19 20:29:17 +0200
commit1f7d8a8d1e2349a6ccd9383b1382f4b56eecc81f (patch)
tree49f593b758c05fa6bb818321c1b72d3a9601006f /skate
parent5b5e96cffc6d1c904974b16dd1cfd51b28a31016 (diff)
downloadrefcat-1f7d8a8d1e2349a6ccd9383b1382f4b56eecc81f.tar.gz
refcat-1f7d8a8d1e2349a6ccd9383b1382f4b56eecc81f.zip
simplify verify signature
Diffstat (limited to 'skate')
-rw-r--r--skate/verify.go15
-rw-r--r--skate/verify_test.go2
2 files changed, 11 insertions, 6 deletions
diff --git a/skate/verify.go b/skate/verify.go
index 40ee4e2..5eccbab 100644
--- a/skate/verify.go
+++ b/skate/verify.go
@@ -158,7 +158,7 @@ func ClusterVerifyMaxSize(p []byte, maxClusterSize int) ([]byte, error) {
matchPair := &MatchPair{
A: a.Ident,
B: b.Ident,
- Result: Verify(a, b, 5),
+ Result: Verify(a, b),
}
if _, err := io.WriteString(&buf, matchPair.AsLine()); err != nil {
return nil, err
@@ -196,7 +196,7 @@ func RefClusterVerify(p []byte) ([]byte, error) {
matchPair := &MatchPair{
A: pivot.Ident,
B: re.Ident,
- Result: Verify(pivot, re, 5),
+ Result: Verify(pivot, re),
}
if _, err := io.WriteString(&buf, matchPair.AsLine()); err != nil {
return nil, err
@@ -223,7 +223,7 @@ func RefClusterToBiblioRef(p []byte) ([]byte, error) {
if re.Extra.Skate.Status != "ref" {
continue
}
- result := Verify(pivot, re, 5)
+ result := Verify(pivot, re)
switch result.Status {
case StatusExact, StatusStrong:
if result.Reason == ReasonDOI {
@@ -372,7 +372,7 @@ func ZipVerifyRefs(releases, refs io.Reader, w io.Writer) error {
if err != nil {
return err
}
- result := Verify(pivot, re, 5)
+ result := Verify(pivot, re)
switch result.Status {
case StatusExact, StatusStrong:
if result.Reason == ReasonDOI {
@@ -417,10 +417,15 @@ func stringToWiki(s string) (r *MinimalCitations, err error) {
return
}
+// Verify verifies two releases and will ignore short titles.
+func Verify(a, b *Release) MatchResult {
+ return VerifyMinTitleLength(a, b, 5)
+}
+
// Verify follows the fuzzycat (Python) implementation of this function: it
// compares two release entities. The Go version can be used for large batch
// processing (where the Python version might take two or more days).
-func Verify(a, b *Release, minTitleLength int) MatchResult {
+func VerifyMinTitleLength(a, b *Release, minTitleLength int) MatchResult {
if a.ExtIDs.DOI != "" && a.ExtIDs.DOI == b.ExtIDs.DOI {
return MatchResult{StatusExact, ReasonDOI}
}
diff --git a/skate/verify_test.go b/skate/verify_test.go
index 519fcb5..350a0cc 100644
--- a/skate/verify_test.go
+++ b/skate/verify_test.go
@@ -67,7 +67,7 @@ func TestVerify(t *testing.T) {
if err != nil {
t.Errorf("could not load release: %s", a)
}
- result := Verify(ar, br, 5)
+ result := Verify(ar, br)
if !statusEquals(result.Status.String(), status) {
t.Errorf("%s %s: got %s (%s), want %s (%s) ", a, b, result.Status, result.Reason, status, reason)
}