linting: fix typos, add toml validation (#7007)
- adds the `toml` plugin to the `eslint` linting → expect to have `options/setting/config.toml` by #6862 - fixes `make lint-codespell` commands - related concerning `codespell`: #3270 - info: codespell check is and was not activated in the workflows (could maybe, runs only few seconds on my system) Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7007 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: Robert Wolff <mahlzahn@posteo.de> Co-committed-by: Robert Wolff <mahlzahn@posteo.de>
This commit is contained in:
parent
e8ebb5d6e3
commit
dc5bc1fe5b
26 changed files with 94 additions and 38 deletions
|
@ -125,7 +125,7 @@ func GrepSearch(ctx context.Context, repo *Repository, search string, opts GrepO
|
|||
// (eg, global pattern = "src/**" and path = "node_modules/")
|
||||
|
||||
// FIXME: this is a bit too restrictive, and fails to consider cases where the
|
||||
// gloabally set include pattern refers to a file than a directory
|
||||
// globally set include pattern refers to a file than a directory
|
||||
// (eg, global pattern = "**.go" and path = "modules/git")
|
||||
exprMatched := false
|
||||
for _, expr := range setting.Indexer.IncludePatterns {
|
||||
|
|
|
@ -124,7 +124,7 @@ c=2
|
|||
{
|
||||
name: "test.gradle.kts",
|
||||
code: "@file:Suppress(\"UnstableApiUsage\")",
|
||||
want: lines("<span class=\"nd\">@file</span><span class=\"p\">:</span><span class=\"n\">Suppress</span><span class=\"p\">(</span><span class=\"s2\">"</span><span class=\"s2\">UnstableApiUsage</span><span class=\"s2\">"</span><span class=\"p\">)</span>"),
|
||||
want: lines("<span class=\"nd\">@file</span><span class=\"p\">:</span><span class=\"n\">Suppress</span><span class=\"p\">(</span><span class=\"s2\">"</span><span class=\"s2\">UnstableApiUsage</span><span class=\"s2\">"</span><span class=\"p\">)</span>"), // codespell:ignore
|
||||
lexerName: "Kotlin",
|
||||
},
|
||||
}
|
||||
|
|
|
@ -31,19 +31,19 @@ func (t *PathHierarchyTokenizer) Tokenize(input []byte) analysis.TokenStream {
|
|||
rv := make(analysis.TokenStream, 0, 8)
|
||||
count, off := 1, 0
|
||||
|
||||
// iterate till all directory seperators
|
||||
// iterate till all directory separators
|
||||
for i := bytes.IndexRune(input[off:], '/'); i != -1; i = bytes.IndexRune(input[off:], '/') {
|
||||
// the index is relative to input[offest...]
|
||||
// add this index to the accumlated offset to get the index of the current seperator in input[0...]
|
||||
// the index is relative to input[offset...]
|
||||
// add this index to the accumulated offset to get the index of the current separator in input[0...]
|
||||
off += i
|
||||
rv = append(rv, &analysis.Token{
|
||||
Term: input[:off], // take the slice, input[0...index of seperator]
|
||||
Term: input[:off], // take the slice, input[0...index of separator]
|
||||
Start: 0,
|
||||
End: off,
|
||||
Position: count,
|
||||
Type: analysis.AlphaNumeric,
|
||||
})
|
||||
// increment the offset after considering the seperator
|
||||
// increment the offset after considering the separator
|
||||
off++
|
||||
count++
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ import (
|
|||
// NumericEqualityQuery generates a numeric equality query for the given value and field
|
||||
func NumericEqualityQuery(value int64, field string) *query.NumericRangeQuery {
|
||||
f := float64(value)
|
||||
tru := true // codespell-ignore
|
||||
q := bleve.NewNumericRangeInclusiveQuery(&f, &f, &tru, &tru) // codespell-ignore
|
||||
tru := true // codespell:ignore
|
||||
q := bleve.NewNumericRangeInclusiveQuery(&f, &f, &tru, &tru) // codespell:ignore
|
||||
q.SetField(field)
|
||||
return q
|
||||
}
|
||||
|
|
|
@ -471,7 +471,7 @@ func TestColorPreview(t *testing.T) {
|
|||
// no backticks
|
||||
"rgb(166, 32, 64)",
|
||||
// typo
|
||||
"`hsI(0, 100%, 50%)`", // codespell-ignore
|
||||
"`hsI(0, 100%, 50%)`", // codespell:ignore
|
||||
// looks like a color but not really
|
||||
"`hsl(40, 60, 80)`",
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue