mirror of
https://github.com/photoprism/photoprism.git
synced 2025-09-26 21:01:58 +08:00
CI: Add codespell config and fix typos (#4506)
More about codespell: https://github.com/codespell-project/codespell
This commit is contained in:

committed by
GitHub

parent
47e740fd88
commit
15668ee7b5
9
.codespellrc
Normal file
9
.codespellrc
Normal file
@@ -0,0 +1,9 @@
|
||||
[codespell]
|
||||
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
|
||||
skip = .git*,*.svg,go.sum,package-lock.json,*.css,.codespellrc,locales,stopwords.*,shortwords.*,countries.*,keywords.json,smallwords.*
|
||||
check-hidden = true
|
||||
# ACRONYMS and generally mixed case/Capitalized words
|
||||
# Also ignore some German
|
||||
ignore-regex = ^(SMethod=shal|biuld: build)$|https://\S+|\b([A-Z][a-zA-Z]+|ist auf)\b|"(datin|alis|hel)"|\bfixe == false\b
|
||||
# common variables or other tricky cases
|
||||
ignore-words-list = renderd,nd,folde,crate,ue,fo,ist,alo,mot,te,admiraal
|
@@ -6,7 +6,7 @@ serversTransport:
|
||||
# Required to proxy services with self-signed HTTPS certificates:
|
||||
insecureSkipVerify: true
|
||||
|
||||
# Open ports ond protocols (HTTP will be redirected to HTTPS):
|
||||
# Open ports and protocols (HTTP will be redirected to HTTPS):
|
||||
entryPoints:
|
||||
web:
|
||||
address: ":80"
|
||||
|
@@ -37,7 +37,7 @@ func AlbumDownloadName(c *gin.Context) customize.DownloadName {
|
||||
|
||||
// DownloadAlbum streams the album contents as zip archive.
|
||||
//
|
||||
// @Summary streams the album contents as zip archiv
|
||||
// @Summary streams the album contents as zip archive
|
||||
// @Id DownloadAlbum
|
||||
// @Tags Images, Albums
|
||||
// @Produce application/zip
|
||||
|
@@ -405,7 +405,7 @@
|
||||
"Images",
|
||||
"Albums"
|
||||
],
|
||||
"summary": "streams the album contents as zip archiv",
|
||||
"summary": "streams the album contents as zip archive",
|
||||
"operationId": "DownloadAlbum",
|
||||
"parameters": [
|
||||
{
|
||||
|
@@ -67,7 +67,7 @@ func GetVideo(router *gin.RouterGroup) {
|
||||
return
|
||||
}
|
||||
|
||||
// If file is not a video, try to find the realted video file.
|
||||
// If file is not a video, try to find the related video file.
|
||||
if !f.FileVideo {
|
||||
f, err = query.VideoByPhotoUID(f.PhotoUID)
|
||||
|
||||
|
@@ -450,7 +450,7 @@ func (c *Config) About() string {
|
||||
return c.options.About
|
||||
}
|
||||
|
||||
// Edition returns the edition nane.
|
||||
// Edition returns the edition name.
|
||||
func (c *Config) Edition() string {
|
||||
if c.options.Edition == "" {
|
||||
return "ce"
|
||||
|
@@ -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", "":
|
||||
case SQLite3, "sqlite", "sqllite", "test", "file", "": # codespell:ignore sqllite
|
||||
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", "":
|
||||
case SQLite3, "sqlite", "sqllite", "test", "file", "": # codespell:ignore sqllite
|
||||
return "SQLite"
|
||||
case "tidb":
|
||||
return "TiDB"
|
||||
|
@@ -35,7 +35,7 @@ func (m *Album) SaveAsYaml(fileName string) error {
|
||||
} else if m.AlbumUID == "" {
|
||||
return fmt.Errorf("album uid is empty")
|
||||
} else if fileName == "" {
|
||||
return fmt.Errorf("yaml filname is empty")
|
||||
return fmt.Errorf("yaml filename is empty")
|
||||
}
|
||||
|
||||
data, err := m.Yaml()
|
||||
|
@@ -692,7 +692,7 @@ func (m *Photo) AddLabels(labels classify.Labels) {
|
||||
labelEntity := FirstOrCreateLabel(NewLabel(classifyLabel.Title(), classifyLabel.Priority))
|
||||
|
||||
if labelEntity == nil {
|
||||
log.Errorf("index: label %s coud not be created (%s)", clean.Log(classifyLabel.Title()), m)
|
||||
log.Errorf("index: label %s could not be created (%s)", clean.Log(classifyLabel.Title()), m)
|
||||
continue
|
||||
}
|
||||
|
||||
|
@@ -61,7 +61,7 @@ func TestPhoto_SetTitle(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPhoto_GenerateTitle(t *testing.T) {
|
||||
t.Run("wont update title was modified", func(t *testing.T) {
|
||||
t.Run("won't update title was modified", func(t *testing.T) {
|
||||
m := PhotoFixtures.Get("Photo08")
|
||||
classifyLabels := &classify.Labels{}
|
||||
assert.Equal(t, "Black beach", m.PhotoTitle)
|
||||
|
@@ -14,7 +14,7 @@ func (m Photos) Photos() []PhotoInterface {
|
||||
return result
|
||||
}
|
||||
|
||||
// UIDs returns tbe photo UIDs as string slice.
|
||||
// UIDs returns the photo UIDs as string slice.
|
||||
func (m Photos) UIDs() []string {
|
||||
result := make([]string, len(m))
|
||||
|
||||
|
@@ -322,7 +322,7 @@ func TestPhotosFilterAlbums(t *testing.T) {
|
||||
}
|
||||
|
||||
if len(photos) != 1 {
|
||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
||||
t.Logf("exactly one result expected, but %d photos with %d files found", len(photos), count)
|
||||
t.Logf("query results: %#v", photos)
|
||||
}
|
||||
|
||||
@@ -775,7 +775,7 @@ func TestPhotosQueryAlbums(t *testing.T) {
|
||||
}
|
||||
|
||||
if len(photos) != 1 {
|
||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
||||
t.Logf("exactly one result expected, but %d photos with %d files found", len(photos), count)
|
||||
t.Logf("query results: %#v", photos)
|
||||
}
|
||||
|
||||
|
@@ -267,7 +267,7 @@ func TestPhotosFilterFilename(t *testing.T) {
|
||||
}
|
||||
|
||||
if len(photos) != 1 {
|
||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
||||
t.Logf("exactly one result expected, but %d photos with %d files found", len(photos), count)
|
||||
t.Logf("query results: %#v", photos)
|
||||
}
|
||||
|
||||
@@ -753,7 +753,7 @@ func TestPhotosQueryFilename(t *testing.T) {
|
||||
}
|
||||
|
||||
if len(photos) != 1 {
|
||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
||||
t.Logf("exactly one result expected, but %d photos with %d files found", len(photos), count)
|
||||
t.Logf("query results: %#v", photos)
|
||||
}
|
||||
|
||||
|
@@ -267,7 +267,7 @@ func TestPhotosFilterName(t *testing.T) {
|
||||
}
|
||||
|
||||
if len(photos) != 1 {
|
||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
||||
t.Logf("exactly one result expected, but %d photos with %d files found", len(photos), count)
|
||||
t.Logf("query results: %#v", photos)
|
||||
}
|
||||
|
||||
@@ -744,7 +744,7 @@ func TestPhotosQueryName(t *testing.T) {
|
||||
}
|
||||
|
||||
if len(photos) != 1 {
|
||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
||||
t.Logf("exactly one result expected, but %d photos with %d files found", len(photos), count)
|
||||
t.Logf("query results: %#v", photos)
|
||||
}
|
||||
|
||||
|
@@ -738,7 +738,7 @@ func TestPhotosGeoFilterAlbums(t *testing.T) {
|
||||
}
|
||||
|
||||
if len(photos) != 1 {
|
||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
||||
t.Logf("exactly one result expected, but %d photos with %d files found", len(photos), count)
|
||||
t.Logf("query results: %#v", photos)
|
||||
}
|
||||
|
||||
@@ -1773,7 +1773,7 @@ func TestPhotosGeoQueryAlbums(t *testing.T) {
|
||||
}
|
||||
|
||||
if len(photos) != 1 {
|
||||
t.Logf("excactly one result expected, but %d photos with %d files found", len(photos), count)
|
||||
t.Logf("exactly one result expected, but %d photos with %d files found", len(photos), count)
|
||||
t.Logf("query results: %#v", photos)
|
||||
}
|
||||
|
||||
|
@@ -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! expres", result)
|
||||
assert.Equal(t, "hanzi are logograms developed for the writing of chinese! express", result)
|
||||
assert.Equal(t, 64, len(result))
|
||||
})
|
||||
t.Run("Empty", func(t *testing.T) {
|
||||
@@ -48,6 +48,6 @@ func TestSanitizeStringType(t *testing.T) {
|
||||
|
||||
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! expres", result)
|
||||
assert.Equal(t, "hanzi are logograms developed for the writing of chinese! express", result)
|
||||
assert.Equal(t, ClipStringType, len(result))
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ func Albums(backupPath string, force bool) (count int, err error) {
|
||||
continue
|
||||
}
|
||||
|
||||
// Remember the lastest modification timestamp.
|
||||
// Remember the latest modification timestamp.
|
||||
if changed.After(latest) {
|
||||
latest = changed
|
||||
}
|
||||
|
@@ -94,7 +94,7 @@ func (w *Convert) ToImage(f *MediaFile, force bool) (result *MediaFile, err erro
|
||||
case fs.ExtJpeg:
|
||||
_, err = thumb.Jpeg(f.FileName(), imageName, f.Orientation())
|
||||
default:
|
||||
return nil, fmt.Errorf("convert: unspported target format %s (%s)", fs.LowerExt(imageName), clean.Log(f.RootRelName()))
|
||||
return nil, fmt.Errorf("convert: unsupported target format %s (%s)", fs.LowerExt(imageName), clean.Log(f.RootRelName()))
|
||||
}
|
||||
|
||||
// Check result.
|
||||
@@ -121,7 +121,7 @@ func (w *Convert) ToImage(f *MediaFile, force bool) (result *MediaFile, err erro
|
||||
cmds, useMutex, err = w.JpegConvertCmds(f, imageName, xmpName)
|
||||
expectedMime = header.ContentTypeJpeg
|
||||
default:
|
||||
return nil, fmt.Errorf("convert: unspported target format %s (%s)", fs.LowerExt(imageName), clean.Log(f.RootRelName()))
|
||||
return nil, fmt.Errorf("convert: unsupported target format %s (%s)", fs.LowerExt(imageName), clean.Log(f.RootRelName()))
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
@@ -27,7 +27,7 @@ func TestGPSBounds(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
t.Run("China", func(t *testing.T) {
|
||||
// Actual postion: Lat 39.8922, Lng 116.315
|
||||
// Actual position: Lat 39.8922, Lng 116.315
|
||||
latNorth, lngEast, latSouth, lngWest, err := GPSBounds("39.8922004699707,116.31500244140625,39.8922004699707,116.31500244140625")
|
||||
assert.InEpsilon(t, 39.8924, latNorth, 0.00001)
|
||||
assert.InEpsilon(t, 116.3152, lngEast, 0.00001)
|
||||
|
@@ -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)
|
||||
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) {
|
||||
@@ -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)
|
||||
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) {
|
||||
|
@@ -15,7 +15,7 @@ This package also provides utilities for importing data and estimating the optim
|
||||
|
||||
## About
|
||||
|
||||
This library was built out of necessity for a collection of performant cluster analysis utilities for Golang. Go, thanks to its numerous advantages (single binary distrubution, relative performance, growing community) seems to become an attractive alternative to languages commonly used in statistical computations and machine learning, yet it still lacks crucial tools and libraries. I use the [*floats* package](https://github.com/gonum/gonum/tree/master/floats) from the robust Gonum library to perform optimized vector calculations in tight loops.
|
||||
This library was built out of necessity for a collection of performant cluster analysis utilities for Golang. Go, thanks to its numerous advantages (single binary distribution, relative performance, growing community) seems to become an attractive alternative to languages commonly used in statistical computations and machine learning, yet it still lacks crucial tools and libraries. I use the [*floats* package](https://github.com/gonum/gonum/tree/master/floats) from the robust Gonum library to perform optimized vector calculations in tight loops.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -54,7 +54,7 @@ for index, number := range c.Guesses() {
|
||||
}
|
||||
```
|
||||
|
||||
Algorithms currenly supported are KMeans++, DBSCAN and OPTICS.
|
||||
Algorithms currently supported are KMeans++, DBSCAN and OPTICS.
|
||||
|
||||
Algorithms which support online learning can be trained this way using Online() function, which relies on channel communication to coordinate the process:
|
||||
|
||||
|
@@ -9,7 +9,7 @@ var UnknownStateCode = "zz"
|
||||
var UnknownCountryCode = "zz"
|
||||
var CountryWordsRegexp = regexp.MustCompile("[\\p{L}]{2,}")
|
||||
|
||||
// CountryCode tries to find a matching country code for a given string e.g. from a file oder directory name.
|
||||
// CountryCode tries to find a matching country code for a given string e.g. from a file or directory name.
|
||||
func CountryCode(s string) (code string) {
|
||||
code = UnknownCountryCode
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package txt
|
||||
|
||||
// Year tries to find a matching year for a given string e.g. from a file oder directory name.
|
||||
// Year tries to find a matching year for a given string e.g. from a file or directory name.
|
||||
func Year(s string) int {
|
||||
b := []byte(s)
|
||||
|
||||
|
@@ -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"))
|
||||
assert.True(t, IsNumeral("1ND")) # codespell:ignore
|
||||
})
|
||||
t.Run("40th", func(t *testing.T) {
|
||||
assert.True(t, IsNumeral("40th"))
|
||||
|
@@ -125,7 +125,7 @@ func (v Vector) variance(mean float64) float64 {
|
||||
// Product returns a vector of element-wise products of two input vectors.
|
||||
func Product(a, b Vector) (Vector, error) {
|
||||
if len(a) != len(b) {
|
||||
return nil, fmt.Errorf("vector dimentions do not match (%d, %d)", len(a), len(b))
|
||||
return nil, fmt.Errorf("vector dimensions do not match (%d, %d)", len(a), len(b))
|
||||
}
|
||||
|
||||
p := make(Vector, len(a))
|
||||
|
2
scripts/dist/convert/policy.xml
vendored
2
scripts/dist/convert/policy.xml
vendored
@@ -38,7 +38,7 @@
|
||||
|
||||
<policy domain="resource" name="area" value="1GP"/>
|
||||
|
||||
Use the default system font unless overwridden by the application:
|
||||
Use the default system font unless overridden by the application:
|
||||
|
||||
<policy domain="system" name="font" value="/usr/share/fonts/favorite.ttf"/>
|
||||
|
||||
|
@@ -30,7 +30,7 @@ serversTransport:
|
||||
rootCAs:
|
||||
- "/certs/ca.crt"
|
||||
|
||||
# open ports ond protocols (HTTP will be redirected to HTTPS)
|
||||
# open ports and protocols (HTTP will be redirected to HTTPS)
|
||||
entryPoints:
|
||||
web:
|
||||
address: ":80"
|
||||
|
Reference in New Issue
Block a user