summaryrefslogtreecommitdiff
path: root/vendor/github.com/go-openapi/inflect
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-11-03 13:55:04 +0100
committerLibravatar tobi <tobi.smethurst@protonmail.com>2025-11-17 14:12:09 +0100
commit81e3cdda44a2aed1ad0805fa738429c891b6209d (patch)
treed9c3c95eb721e1dc1c613ee7370eaad9ec8796f7 /vendor/github.com/go-openapi/inflect
parent[chore] add a 'nos3' build tag to support compiling without S3 storage suppor... (diff)
downloadgotosocial-81e3cdda44a2aed1ad0805fa738429c891b6209d.tar.xz
[chore] update dependencies (#4539)
- github.com/KimMachineGun/automemlimit: v0.7.4 -> v0.7.5 - github.com/tdewolff/minify/v2: v2.24.4 -> v2.24.5 - modernc.org/sqlite: v1.39.1 -> v1.40.0 w/ concurrency workaround - github.com/go-swagger/go-swagger: v0.32.3 -> v0.33.1 (and drops use of our custom fork now the fix is available upstream) Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4539 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/github.com/go-openapi/inflect')
-rw-r--r--vendor/github.com/go-openapi/inflect/.golangci.yml109
-rw-r--r--vendor/github.com/go-openapi/inflect/inflect.go100
2 files changed, 107 insertions, 102 deletions
diff --git a/vendor/github.com/go-openapi/inflect/.golangci.yml b/vendor/github.com/go-openapi/inflect/.golangci.yml
index 22f8d21cc..b4ded785e 100644
--- a/vendor/github.com/go-openapi/inflect/.golangci.yml
+++ b/vendor/github.com/go-openapi/inflect/.golangci.yml
@@ -1,61 +1,64 @@
-linters-settings:
- govet:
- check-shadowing: true
- golint:
- min-confidence: 0
- gocyclo:
- min-complexity: 45
- maligned:
- suggest-new: true
- dupl:
- threshold: 200
- goconst:
- min-len: 2
- min-occurrences: 3
-
+version: "2"
linters:
- enable-all: true
+ default: all
disable:
- - maligned
- - unparam
- - lll
- - gochecknoinits
- - gochecknoglobals
+ - cyclop
+ - depguard
+ - errchkjson
+ - errorlint
+ - exhaustruct
+ - forcetypeassert
- funlen
- - godox
+ - gochecknoglobals
+ - gochecknoinits
- gocognit
- - whitespace
- - wsl
- - wrapcheck
- - testpackage
- - nlreturn
- - gomnd
- - exhaustivestruct
- - goerr113
- - errorlint
- - nestif
- godot
- - gofumpt
+ - godox
+ - gosmopolitan
+ - inamedparam
+ - ireturn
+ - lll
+ - musttag
+ - nestif
+ - nlreturn
+ - noinlineerr
+ - nonamedreturns
- paralleltest
- - tparallel
+ - testpackage
- thelper
- - ifshort
- - exhaustruct
+ - tparallel
+ - unparam
- varnamelen
- - gci
- - depguard
- - errchkjson
- - inamedparam
- - nonamedreturns
- - musttag
- - ireturn
- - forcetypeassert
- - cyclop
- # deprecated linters
- - deadcode
- - interfacer
- - scopelint
- - varcheck
- - structcheck
- - golint
- - nosnakecase
+ - whitespace
+ - wrapcheck
+ - wsl
+ - wsl_v5
+ settings:
+ dupl:
+ threshold: 200
+ goconst:
+ min-len: 2
+ min-occurrences: 3
+ gocyclo:
+ min-complexity: 45
+ exclusions:
+ generated: lax
+ presets:
+ - comments
+ - common-false-positives
+ - legacy
+ - std-error-handling
+ paths:
+ - third_party$
+ - builtin$
+ - examples$
+formatters:
+ enable:
+ - gofmt
+ - goimports
+ exclusions:
+ generated: lax
+ paths:
+ - third_party$
+ - builtin$
+ - examples$
diff --git a/vendor/github.com/go-openapi/inflect/inflect.go b/vendor/github.com/go-openapi/inflect/inflect.go
index 9d8ca6dbd..2a421c06b 100644
--- a/vendor/github.com/go-openapi/inflect/inflect.go
+++ b/vendor/github.com/go-openapi/inflect/inflect.go
@@ -307,15 +307,6 @@ func (rs *Ruleset) AddUncountable(word string) {
rs.uncountables[strings.ToLower(word)] = true
}
-func (rs *Ruleset) isUncountable(word string) bool {
- // handle multiple words by using the last one
- words := strings.Split(word, " ")
- if _, exists := rs.uncountables[strings.ToLower(words[len(words)-1])]; exists {
- return true
- }
- return false
-}
-
// returns the plural form of a singular word
func (rs *Ruleset) Pluralize(word string) string {
if len(word) == 0 {
@@ -383,20 +374,6 @@ func (rs *Ruleset) Titleize(word string) string {
return strings.Join(words, " ")
}
-func (rs *Ruleset) safeCaseAcronyms(word string) string {
- // convert an acroymn like HTML into Html
- for _, rule := range rs.acronyms {
- word = strings.ReplaceAll(word, rule.suffix, rule.replacement)
- }
- return word
-}
-
-func (rs *Ruleset) seperatedWords(word, sep string) string {
- word = rs.safeCaseAcronyms(word)
- words := splitAtCaseChange(word)
- return strings.Join(words, sep)
-}
-
// lowercase underscore version "BigBen" -> "big_ben"
func (rs *Ruleset) Underscore(word string) string {
return rs.seperatedWords(word, "_")
@@ -452,32 +429,6 @@ func (rs *Ruleset) ParameterizeJoin(word, sep string) string {
return word
}
-var lookalikes = map[string]*regexp.Regexp{
- "A": regexp.MustCompile(`À|Á|Â|Ã|Ä|Å`),
- "AE": regexp.MustCompile(`Æ`),
- "C": regexp.MustCompile(`Ç`),
- "E": regexp.MustCompile(`È|É|Ê|Ë`),
- "G": regexp.MustCompile(`Ğ`),
- "I": regexp.MustCompile(`Ì|Í|Î|Ï|İ`),
- "N": regexp.MustCompile(`Ñ`),
- "O": regexp.MustCompile(`Ò|Ó|Ô|Õ|Ö|Ø`),
- "S": regexp.MustCompile(`Ş`),
- "U": regexp.MustCompile(`Ù|Ú|Û|Ü`),
- "Y": regexp.MustCompile(`Ý`),
- "ss": regexp.MustCompile(`ß`),
- "a": regexp.MustCompile(`à|á|â|ã|ä|å`),
- "ae": regexp.MustCompile(`æ`),
- "c": regexp.MustCompile(`ç`),
- "e": regexp.MustCompile(`è|é|ê|ë`),
- "g": regexp.MustCompile(`ğ`),
- "i": regexp.MustCompile(`ì|í|î|ï|ı`),
- "n": regexp.MustCompile(`ñ`),
- "o": regexp.MustCompile(`ò|ó|ô|õ|ö|ø`),
- "s": regexp.MustCompile(`ş`),
- "u": regexp.MustCompile(`ù|ú|û|ü|ũ|ū|ŭ|ů|ű|ų`),
- "y": regexp.MustCompile(`ý|ÿ`),
-}
-
// transforms latin characters like é -> e
func (rs *Ruleset) Asciify(word string) string {
for repl, regex := range lookalikes {
@@ -500,6 +451,8 @@ func (rs *Ruleset) Dasherize(word string) string {
}
// "1031" -> "1031st"
+//
+//nolint:mnd
func (rs *Ruleset) Ordinalize(str string) string {
number, err := strconv.Atoi(str)
if err != nil {
@@ -521,6 +474,55 @@ func (rs *Ruleset) Ordinalize(str string) string {
return fmt.Sprintf("%dth", number)
}
+func (rs *Ruleset) isUncountable(word string) bool {
+ // handle multiple words by using the last one
+ words := strings.Split(word, " ")
+ if _, exists := rs.uncountables[strings.ToLower(words[len(words)-1])]; exists {
+ return true
+ }
+ return false
+}
+
+func (rs *Ruleset) safeCaseAcronyms(word string) string {
+ // convert an acroymn like HTML into Html
+ for _, rule := range rs.acronyms {
+ word = strings.ReplaceAll(word, rule.suffix, rule.replacement)
+ }
+ return word
+}
+
+func (rs *Ruleset) seperatedWords(word, sep string) string {
+ word = rs.safeCaseAcronyms(word)
+ words := splitAtCaseChange(word)
+ return strings.Join(words, sep)
+}
+
+var lookalikes = map[string]*regexp.Regexp{
+ "A": regexp.MustCompile(`À|Á|Â|Ã|Ä|Å`),
+ "AE": regexp.MustCompile(`Æ`),
+ "C": regexp.MustCompile(`Ç`),
+ "E": regexp.MustCompile(`È|É|Ê|Ë`),
+ "G": regexp.MustCompile(`Ğ`),
+ "I": regexp.MustCompile(`Ì|Í|Î|Ï|İ`),
+ "N": regexp.MustCompile(`Ñ`),
+ "O": regexp.MustCompile(`Ò|Ó|Ô|Õ|Ö|Ø`),
+ "S": regexp.MustCompile(`Ş`),
+ "U": regexp.MustCompile(`Ù|Ú|Û|Ü`),
+ "Y": regexp.MustCompile(`Ý`),
+ "ss": regexp.MustCompile(`ß`),
+ "a": regexp.MustCompile(`à|á|â|ã|ä|å`),
+ "ae": regexp.MustCompile(`æ`),
+ "c": regexp.MustCompile(`ç`),
+ "e": regexp.MustCompile(`è|é|ê|ë`),
+ "g": regexp.MustCompile(`ğ`),
+ "i": regexp.MustCompile(`ì|í|î|ï|ı`),
+ "n": regexp.MustCompile(`ñ`),
+ "o": regexp.MustCompile(`ò|ó|ô|õ|ö|ø`),
+ "s": regexp.MustCompile(`ş`),
+ "u": regexp.MustCompile(`ù|ú|û|ü|ũ|ū|ŭ|ů|ű|ų`),
+ "y": regexp.MustCompile(`ý|ÿ`),
+}
+
/////////////////////////////////////////
// the default global ruleset
//////////////////////////////////////////