Codespell: Fix invalid inline comments and broken test assertions #4506

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-03-27 16:57:56 +01:00
parent 15668ee7b5
commit ca708c3f56
5 changed files with 42 additions and 43 deletions

67
NOTICE
View File

@@ -9,7 +9,7 @@ The following 3rd-party software packages may be used by or distributed with
PhotoPrism. Any information relevant to third-party vendors listed below are
collected using common, reasonable means.
Date generated: 2025-03-26
Date generated: 2025-03-27
================================================================================
@@ -4194,8 +4194,8 @@ SOFTWARE.
--------------------------------------------------------------------------------
Package: github.com/mattn/go-sqlite3
Version: v1.14.22
License: MIT (https://github.com/mattn/go-sqlite3/blob/v1.14.22/LICENSE)
Version: v1.14.24
License: MIT (https://github.com/mattn/go-sqlite3/blob/v1.14.24/LICENSE)
The MIT License (MIT)
@@ -5954,6 +5954,34 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
Package: github.com/ugjka/go-tz/v2
Version: v2.2.6
License: MIT (https://github.com/ugjka/go-tz/blob/v2.2.6/LICENSE)
MIT License
Copyright (c) 2017 ugjka <esesmu@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
--------------------------------------------------------------------------------
Package: github.com/ugorji/go/codec
Version: v1.2.12
License: MIT (https://github.com/ugorji/go/blob/codec/v1.2.12/codec/LICENSE)
@@ -7895,8 +7923,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
Package: google.golang.org/protobuf
Version: v1.36.5
License: BSD-3-Clause (https://github.com/protocolbuffers/protobuf-go/blob/v1.36.5/LICENSE)
Version: v1.36.6
License: BSD-3-Clause (https://github.com/protocolbuffers/protobuf-go/blob/v1.36.6/LICENSE)
Copyright (c) 2018 The Go Authors. All rights reserved.
@@ -7928,35 +7956,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
Package: gopkg.in/photoprism/go-tz.v2/tz
Version: v2.2.0
License: MIT (https://github.com/photoprism/go-tz/blob/v2.2.0/tz/LICENSE)
MIT License
Copyright (c) 2017 ugjka <esesmu@protonmail.com>
Copyright (c) 2021-2023 Michael Mayer <michael@photoprism.app>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
--------------------------------------------------------------------------------
Package: gopkg.in/yaml.v2
Version: v2.4.0
License: Apache-2.0 (https://github.com/go-yaml/yaml/blob/v2.4.0/LICENSE)

View File

@@ -41,7 +41,7 @@ func (c *Config) DatabaseDriver() string {
switch strings.ToLower(c.options.DatabaseDriver) {
case MySQL, MariaDB:
c.options.DatabaseDriver = MySQL
case SQLite3, "sqlite", "sqllite", "test", "file", "": # codespell:ignore sqllite
case SQLite3, "sqlite", "test", "file", "":
c.options.DatabaseDriver = SQLite3
case "tidb":
log.Warnf("config: database driver 'tidb' is deprecated, using sqlite")
@@ -61,7 +61,7 @@ func (c *Config) DatabaseDriverName() string {
switch c.DatabaseDriver() {
case MySQL, MariaDB:
return "MariaDB"
case SQLite3, "sqlite", "sqllite", "test", "file", "": # codespell:ignore sqllite
case SQLite3, "sqlite", "test", "file", "":
return "SQLite"
case "tidb":
return "TiDB"

View File

@@ -30,7 +30,7 @@ func TestClip(t *testing.T) {
})
t.Run("ToASCII", func(t *testing.T) {
result := Clip(ToASCII(strings.ToLower(" 幸福 Hanzi are logograms developed for the writing of Chinese! Expressions in an index may not ...!")), ClipStringType)
assert.Equal(t, "hanzi are logograms developed for the writing of chinese! express", result)
assert.Equal(t, "hanzi are logograms developed for the writing of chinese! expres", result)
assert.Equal(t, 64, len(result))
})
t.Run("Empty", func(t *testing.T) {
@@ -42,12 +42,12 @@ func TestClip(t *testing.T) {
func TestSanitizeStringType(t *testing.T) {
result := SanitizeStringType(" 幸福 Hanzi are logograms developed for the writing of Chinese! Expressions in an index may not ...!")
assert.Equal(t, "Hanzi are logograms developed for the writing of Chinese! Expres", result)
assert.Equal(t, "Hanzi are logograms developed for the writing of Chinese! Expres", result) // codespell:ignore
assert.Equal(t, ClipStringType, len(result))
}
func TestSanitizeStringTypeLower(t *testing.T) {
result := SanitizeStringTypeLower(" 幸福 Hanzi are logograms developed for the writing of Chinese! Expressions in an index may not ...!")
assert.Equal(t, "hanzi are logograms developed for the writing of chinese! express", result)
assert.Equal(t, "hanzi are logograms developed for the writing of chinese! expres", result) // codespell:ignore
assert.Equal(t, ClipStringType, len(result))
}

View File

@@ -32,7 +32,7 @@ func TestClip(t *testing.T) {
})
t.Run("ToASCII", func(t *testing.T) {
result := clip.Chars(ASCII(strings.ToLower(" 幸福 Hanzi are logograms developed for the writing of Chinese! Expressions in an index may not ...!")), LengthType)
assert.Equal(t, "hanzi are logograms developed for the writing of chinese! expres", result) # codespell:ignore
assert.Equal(t, "hanzi are logograms developed for the writing of chinese! expres", result) // codespell:ignore
assert.Equal(t, 64, len(result))
})
t.Run("Empty", func(t *testing.T) {
@@ -45,7 +45,7 @@ func TestClip(t *testing.T) {
func TestType(t *testing.T) {
t.Run("Clip", func(t *testing.T) {
result := Type(" 幸福 Hanzi are logograms developed for the writing of Chinese! Expressions in an index may not ...!")
assert.Equal(t, "Hanzi are logograms developed for the writing of Chinese! Expres", result)
assert.Equal(t, "Hanzi are logograms developed for the writing of Chinese! Expres", result) // codespell:ignore
assert.Equal(t, LengthType, len(result))
})
t.Run("Empty", func(t *testing.T) {
@@ -56,7 +56,7 @@ func TestType(t *testing.T) {
func TestTypeLower(t *testing.T) {
t.Run("Clip", func(t *testing.T) {
result := TypeLower(" 幸福 Hanzi are logograms developed for the writing of Chinese! Expressions in an index may not ...!")
assert.Equal(t, "hanzi are logograms developed for the writing of chinese! expres", result) # codespell:ignore
assert.Equal(t, "hanzi are logograms developed for the writing of chinese! expres", result) // codespell:ignore
assert.Equal(t, LengthType, len(result))
})
t.Run("Empty", func(t *testing.T) {

View File

@@ -133,7 +133,7 @@ func TestIsNumeral(t *testing.T) {
assert.True(t, IsNumeral("1st"))
})
t.Run("2ND", func(t *testing.T) {
assert.True(t, IsNumeral("1ND")) # codespell:ignore
assert.True(t, IsNumeral("1ND")) // codespell:ignore
})
t.Run("40th", func(t *testing.T) {
assert.True(t, IsNumeral("40th"))