From 0ded9c86537917af2ff89bc9c78de6bd58477894 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 22 Feb 2019 14:05:28 -0500 Subject: [PATCH 1/3] update CI settings --- .gitignore | 51 ++++++++++++++++++++++++++++++++ .travis.yml | 83 ++++++++++++----------------------------------------- README.md | 2 +- test.sh | 10 +++++++ 4 files changed, 81 insertions(+), 65 deletions(-) mode change 100644 => 100755 .gitignore create mode 100755 test.sh diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index 404365f..4473da1 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,53 @@ +# Ignore docs files +_gh_pages +_site + +# Ignore temporary files README.html coverage.out +.tmp + +# Numerous always-ignore extensions +*.diff +*.err +*.log +*.orig +*.rej +*.swo +*.swp +*.vi +*.zip +*~ + +# OS or Editor folders +._* +.cache +.DS_Store +.idea +.project +.settings +.tmproj +*.esproj +*.sublime-project +*.sublime-workspace +nbproject +Thumbs.db + +# Komodo +.komodotools +*.komodoproject + +# SCSS-Lint +scss-lint-report.xml + +# grunt-contrib-sass cache +.sass-cache + +# Jekyll metadata +docs/.jekyll-metadata + +# Folders to ignore +.build +.test +bower_components +node_modules diff --git a/.travis.yml b/.travis.yml index 95be94a..a51a144 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,70 +1,25 @@ language: go sudo: false -go: - - 1.8 - - 1.7.5 - - 1.7.4 - - 1.7.3 - - 1.7.2 - - 1.7.1 - - 1.7 - - tip - - 1.6.4 - - 1.6.3 - - 1.6.2 - - 1.6.1 - - 1.6 - - 1.5.4 - - 1.5.3 - - 1.5.2 - - 1.5.1 - - 1.5 - - 1.4.3 - - 1.4.2 - - 1.4.1 - - 1.4 - - 1.3.3 - - 1.3.2 - - 1.3.1 - - 1.3 - - 1.2.2 - - 1.2.1 - - 1.2 - - 1.1.2 - - 1.1.1 - - 1.1 -before_install: - - go get github.com/mattn/goveralls -script: - - $HOME/gopath/bin/goveralls -service=travis-ci -notifications: - email: - on_success: never matrix: fast_finish: true + include: + - go: 1.11.x + env: TEST_METHOD=goveralls + - go: 1.10.x + - go: tip + - go: 1.9.x + - go: 1.8.x + - go: 1.7.x + - go: 1.6.x + - go: 1.5.x allow_failures: - go: tip - - go: 1.6.4 - - go: 1.6.3 - - go: 1.6.2 - - go: 1.6.1 - - go: 1.6 - - go: 1.5.4 - - go: 1.5.3 - - go: 1.5.2 - - go: 1.5.1 - - go: 1.5 - - go: 1.4.3 - - go: 1.4.2 - - go: 1.4.1 - - go: 1.4 - - go: 1.3.3 - - go: 1.3.2 - - go: 1.3.1 - - go: 1.3 - - go: 1.2.2 - - go: 1.2.1 - - go: 1.2 - - go: 1.1.2 - - go: 1.1.1 - - go: 1.1 + - go: 1.9.x + - go: 1.8.x + - go: 1.7.x + - go: 1.6.x + - go: 1.5.x +script: ./test.sh $TEST_METHOD +notifications: + email: + on_success: never diff --git a/README.md b/README.md index 90509c2..9e42558 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This package implements distance and similarity metrics for strings, based on th ## Project Status -v1.2.1 Stable: Guaranteed no breaking changes to the API in future v1.x releases. Probably safe to use in production, though provided on "AS IS" basis. +v1.2.2 Stable: Guaranteed no breaking changes to the API in future v1.x releases. Probably safe to use in production, though provided on "AS IS" basis. This package is being actively maintained. If you encounter any problems or have any suggestions for improvement, please [open an issue](https://github.com/agext/levenshtein/issues). Pull requests are welcome. diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..c5ed724 --- /dev/null +++ b/test.sh @@ -0,0 +1,10 @@ +set -ev + +if [[ "$1" == "goveralls" ]]; then + echo "Testing with goveralls..." + go get github.com/mattn/goveralls + $HOME/gopath/bin/goveralls -service=travis-ci +else + echo "Testing with go test..." + go test -v ./... +fi From 5d192579c10bf1e3d17dd5682a98601480190f5d Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 17 Jul 2019 15:12:19 -0400 Subject: [PATCH 2/3] Fix for issue #3 (index out of range panic) --- levenshtein.go | 2 +- levenshtein_test.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/levenshtein.go b/levenshtein.go index df69ce7..56d719b 100644 --- a/levenshtein.go +++ b/levenshtein.go @@ -108,7 +108,7 @@ func Calculate(str1, str2 []rune, maxCost, insCost, subCost, delCost int) (dist, for x := 0; x < l2; x++ { dy, d[doff] = d[doff], d[doff]+insCost - for d[doff] > maxCost && dlen > 0 { + for doff < l1 && d[doff] > maxCost && dlen > 0 { if str1[doff] != str2[x] { dy += subCost } diff --git a/levenshtein_test.go b/levenshtein_test.go index 7a16548..bc6bf73 100644 --- a/levenshtein_test.go +++ b/levenshtein_test.go @@ -141,6 +141,8 @@ func Test_Metrics(t *testing.T) { {"password", "pass1", "(minScore=0.6)", NewParams().MinScore(.6), e{4, 4, 0, 0, 0}}, {"password", "pass1wor", "(minScore=0.9)", NewParams().MinScore(.9), e{2, 4, 0, 0, 0}}, {"password", "password", "(minScore=1.1)", NewParams().MinScore(1.1), e{0, 8, 0, 0, 0}}, + {"NetworkManager-glib-0.8.1-5.el6_0.1.i686.rpm", "NetworkManager-glib-0.9.3-15.el6_0.1.i686.rpm", "(minScore=0.92)", NewParams().MinScore(0.92), e{3, 22, 18, 42. / 45, 43.2 / 45}}, + {"NetworkManager-glib-0.8.1-5.el6_0.1.i686.rpm", "gdm-plugin-fingerprint-2.30.4-39.el6.i686.rpm", "(minScore=0.92)", NewParams().MinScore(0.92), e{28, 0, 9, 0, 0}}, // The rest of these are miscellaneous examples. They will // be illustrated using the following key: From 52c14c47d03211d8ac1834e94601635e07c5a6ef Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 12 Mar 2020 17:09:59 -0400 Subject: [PATCH 3/3] update CI settings; update version in README.md --- .travis.yml | 7 ++++++- README.md | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a51a144..68d3881 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,11 @@ sudo: false matrix: fast_finish: true include: - - go: 1.11.x + - go: 1.14.x env: TEST_METHOD=goveralls + - go: 1.13.x + - go: 1.12.x + - go: 1.11.x - go: 1.10.x - go: tip - go: 1.9.x @@ -14,6 +17,8 @@ matrix: - go: 1.5.x allow_failures: - go: tip + - go: 1.11.x + - go: 1.10.x - go: 1.9.x - go: 1.8.x - go: 1.7.x diff --git a/README.md b/README.md index 9e42558..d9a8ce1 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This package implements distance and similarity metrics for strings, based on th ## Project Status -v1.2.2 Stable: Guaranteed no breaking changes to the API in future v1.x releases. Probably safe to use in production, though provided on "AS IS" basis. +v1.2.3 Stable: Guaranteed no breaking changes to the API in future v1.x releases. Probably safe to use in production, though provided on "AS IS" basis. This package is being actively maintained. If you encounter any problems or have any suggestions for improvement, please [open an issue](https://github.com/agext/levenshtein/issues). Pull requests are welcome.