Strider report
Strider corpus: gitea
Showing 1000 of 43613 detailed findings. The summary includes all 43613 findings.
build/generate-gitignores.go1
94:125add-constant
build/generate-gitignores.go:94:125
fmt.Printf("Found symlink %s -> %s\n", hdr.Name, hdr.Linkname) filesToCopy[strings.TrimSuffix(filepath.Base(hdr.Name), ".gitignore")] = strings.TrimSuffix(filepath.Base(hdr.Linkname), ".gitignore") continuemodules/util/path.go1
96:18append-to-sized-slice
modules/util/path.go:96:18
if isOSWindows { elems = append(elems, filepath.Clean(filepathSeparator+s)) } else {models/db/driver_sqlite_mattn.go1
13:2blank-imports
models/db/driver_sqlite_mattn.go:13:2
_ "github.com/mattn/go-sqlite3")modelmigration/v1_24/v320.go1
50:6boolean-literal-comparison
modelmigration/v1_24/v320.go:50:6
if cfg["SkipLocalTwoFA"] == true { _, err = x.Exec("UPDATE login_source SET two_factor_policy = 'skip' WHERE id = ?", source.ID)modules/pprof/pprof.go1
22:2call-to-gc
modules/pprof/pprof.go:22:2
defer f.Close() runtime.GC() // get up-to-date statistics return pprof.WriteHeapProfile(f)build/generate-emoji.go1
83:6cognitive-complexity
build/generate-emoji.go:83:6
func generate() ([]byte, error) { // load gemoji datamodelmigration/migrationtest/tests.go1
123:6confusing-naming
modelmigration/migrationtest/tests.go:123:6
func MainTest(m *testing.M) { os.Exit(mainTest(m))models/actions/utils.go1
21:37confusing-results
models/actions/utils.go:21:37
func generateSaltedToken() (string, string, string, string) { salt := util.CryptoRandomString(10)models/unittest/fixtures_loader.go1
209:6constructor-interface-return
models/unittest/fixtures_loader.go:209:6
func NewFixturesLoader(x *xorm.Engine, opts FixturesOptions) (FixturesLoader, error) { fixtureItems, err := FixturesFileFullPaths(opts.Dir, opts.Files)modules/templates/page.go1
39:64context-as-argument
modules/templates/page.go:39:64
func (r *pageRenderer) TemplateLookup(tmpl string, templateCtx context.Context) (TemplateExecutor, error) { //nolint:revive // we don't use ctx, only pass it to the template executor tmpls := r.tmplRenderer.Templates()cmd/cmdtest/cmd_test.go1
217:52context-key-type
cmd/cmdtest/cmd_test.go:217:52
func TestCliCmdBefore(t *testing.T) { ctxNew := context.WithValue(context.Background(), any("key"), "value") configValues := map[string]string{}models/dbfs/dbfile.go1
29:2context-stored-in-struct
models/dbfs/dbfile.go:29:2
type file struct { ctx context.Context metaID int64build/generate-emoji.go1
83:6cyclomatic-complexity
build/generate-emoji.go:83:6
func generate() ([]byte, error) { // load gemoji databuild/generate-go-licenses.go1
70:3deep-exit
build/generate-go-licenses.go:70:3
fmt.Fprintf(os.Stderr, "failed to run 'go list -deps': %v\n", err) os.Exit(1) }modules/markup/markdown/markdown_math_test.go1
261:2deferred-return-function-not-called
modules/markup/markdown/markdown_math_test.go:261:2
setting.Markdown.MathCodeBlockOptions = setting.MarkdownMathCodeBlockOptions{} defer test.MockVariableValue(&setting.Markdown.MathCodeBlockOptions) test := func(t *testing.T, expected, input string) {models/asymkey/ssh_key_parse.go1
229:7deprecated-api-usage
models/asymkey/ssh_key_parse.go:229:7
switch pkey.Type() { case ssh.KeyAlgoDSA: //nolint:staticcheck // it's deprecated rawPub := struct {modules/cache/context_test.go1
45:2discarded-deferred-result
modules/cache/context_test.go:45:2
defer test.MockVariableValue(&timeNow, func() time.Time { return time.Now().Add(5 * time.Minute)cmd/actions.go1
52:9discarded-error-result
cmd/actions.go:52:9
} _, _ = fmt.Printf("%s\n", respText.Text) return nilbuild/generate-emoji.go1
45:1doc-comment-period
build/generate-emoji.go:45:1
// Don't include some fields in JSONfunc (e Emoji) MarshalJSON() ([]byte, error) {tests/integration/api_team_test.go1
21:2duplicated-imports
tests/integration/api_team_test.go:21:2
"gitea.dev/modules/structs" api "gitea.dev/modules/structs" "gitea.dev/services/convert"cmd/hook.go1
511:3early-return
cmd/hook.go:511:3
if index < 0 { if len(rs.Data) == 10 && rs.Data[9] == '\n' { index = 9routers/web/admin/repos.go1
143:19empty-conditional-block
routers/web/admin/repos.go:143:19
} if has || !exist { // Fallthrough to failure modemodules/git/gitcmd/error.go1
128:38error-last-result
modules/git/gitcmd/error.go:128:38
func UnwrapPipelineError(err error) (error, bool) { //nolint:revive // this is for error unwrapping if pe, ok := errors.AsType[pipelineError](err); ok {services/auth/sspi.go1
38:2error-naming
services/auth/sspi.go:38:2
sspiAuthOnce sync.Once sspiAuthErrInit errorcmd/admin.go1
123:22error-strings
cmd/admin.go:123:22
if err != nil { return fmt.Errorf("SearchRepositoryByName: %w", err) }cmd/main.go1
158:6error-type-naming
cmd/main.go:158:6
// usageErr marks a usage error already reported by cliOnUsageError, so RunMainApp does not print it again.type usageErr struct{ err error }cmd/hook_test.go1
50:2excessive-blank-identifiers
cmd/hook_test.go:50:2
_, _, _, ok = parseGitHookCommitRefLine("a\tb\tc") assert.False(t, ok)build/generate-go-licenses.go1
46:6exported-declaration-comment
build/generate-go-licenses.go:46:6
type ModuleInfo struct { Path stringcmd/admin_auth_ldap_test.go1
1:1file-length-limit
cmd/admin_auth_ldap_test.go:1:1
// Copyright 2019 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MITcmd/embedded.go1
231:42flag-parameter
cmd/embedded.go:231:42
func extractAsset(d string, a assetFile, overwrite, rename bool) error { dest := filepath.Join(d, filepath.FromSlash(a.path))build/generate-emoji.go2
1:1format
build/generate-emoji.go:1:1
// Copyright 2020 The Gitea Authors. All rights reserved.// Copyright 2015 Kenneth Shaw- Fix (safe): run `strider fmt build/generate-emoji.go`
83:6function-length
build/generate-emoji.go:83:6
func generate() ([]byte, error) { // load gemoji datacmd/hook.go1
163:6function-result-limit
cmd/hook.go:163:6
func parseGitHookCommitRefLine(line string) (oldCommitID, newCommitID string, refFullName git.RefName, ok bool) { fields := strings.Split(line, " ")modules/web/router.go1
188:18get-function-return-value
modules/web/router.go:188:18
// Get delegate get methodfunc (r *Router) Get(pattern string, h ...any) { r.Methods("GET", pattern, h...)models/repo/attachment.go1
164:17identical-if-chain-branches
models/repo/attachment.go:164:17
return nil, err } else if !has { return nil, errcmd/cert.go1
84:2identical-switch-branches
cmd/cert.go:84:2
return &k.PublicKey case *ecdsa.PrivateKey: return &k.PublicKeycmd/admin.go1
12:2import-alias-naming
cmd/admin.go:12:2
"gitea.dev/models/db" repo_model "gitea.dev/models/repo" "gitea.dev/modules/git"cmd/cmdtest/cmd_test.go1
80:3import-shadowing
cmd/cmdtest/cmd_test.go:80:3
env map[string]string cmd string exp stringmodelmigration/v1_11/v111.go1
289:6inefficient-map-lookup
modelmigration/v1_11/v111.go:289:6
if _, ok := perm.UnitsMode[u.Type]; !ok { perm.UnitsMode[u.Type] = AccessModeRead }models/auth/oauth2.go1
74:26insecure-url-scheme
models/auth/oauth2.go:74:26
DisplayName: "git-credential-oauth", RedirectURIs: []string{"http://127.0.0.1", "https://127.0.0.1"}, }models/db/engine.go1
32:17interface-method-limit
models/db/engine.go:32:17
// SQLSession represents a common interface for engine and session to execute SQLstype SQLSession interface { Count(...any) (int64, error)modules/log/flags.go1
116:7marshal-receiver
modules/log/flags.go:116:7
func (f Flags) MarshalJSON() ([]byte, error) { return []byte(`"` + f.String() + `"`), nilmodelmigration/v1_9/v82.go1
68:13max-control-nesting
modelmigration/v1_9/v82.go:68:13
return err } else if !has { return fmt.Errorf("Repository %d is not exist", release.RepoID)services/actions/commit_status.go1
191:6max-parameters
services/actions/commit_status.go:191:6
// Currently, a `push` event must keep the repo-wide union since its future pull request base branch is unknown.func CreateSkippedCommitStatusForFilteredWorkflow(ctx context.Context, repo *repo_model.Repository, event webhook_module.HookEventType, triggerEvent, workflowID string, content []byte, payload api.Payloader, scopedPrefix string, requiredGlobs []glob.Glob) error { if len(requiredGlobs) == 0 {modelmigration/v1_11/v111.go1
88:7max-public-structs
modelmigration/v1_11/v111.go:88:7
// RepoUnit describes all units of a repository type RepoUnit struct { ID int64build/openapi3gen/convert.go1
249:3modifies-parameter
build/openapi3gen/convert.go:249:3
doc.Components.Schemas[enumName] = &openapi3.SchemaRef{ Value: &openapi3.Schema{models/repo/language_stats.go1
41:3modifies-value-receiver
models/repo/language_stats.go:41:3
for i := range stats { stats[i].Color = enry.GetColor(stats[i].Language) }cmd/admin_auth_ldap_test.go1
23:13nested-structs
cmd/admin_auth_ldap_test.go:23:13
// Test cases cases := []struct { args []stringcmd/doctor.go1
119:3nil-error-return
cmd/doctor.go:119:3
fmt.Println("Check if you are using the right config file. You can use a --config directive to specify one.") return nil }cmd/admin_auth_ldap_test.go1
236:5nil-value-with-nil-error
cmd/admin_auth_ldap_test.go:236:5
assert.FailNow(t, "getAuthSourceByID called", "case %d: should not call getAuthSourceByID", n) return nil, nil //nolint:nilnil // mock function covering improper behavior },build/generate-gitignores.go1
103:3no-defer-in-loop
build/generate-gitignores.go:103:3
defer out.Close()cmd/dump_repo.go1
173:4no-else-after-return
cmd/dump_repo.go:173:4
return fmt.Errorf("unable to stat repo_dir %q: %w", repoDir, err) } else if exists { if isDir, _ := util.IsDir(repoDir); !isDir {cmd/main.go1
21:6no-init
cmd/main.go:21:6
func init() { cli.HelpPrinter = cliHelpPrinterNewbuild/generate-emoji.go1
31:5no-package-var
build/generate-emoji.go:31:5
var flagOut = flag.String("o", "modules/emoji/emoji_data.go", "out")models/unittest/fixtures.go1
114:4overwritten-before-use
models/unittest/fixtures.go:114:4
if util.AsciiEqualFold(cmdPart, "INTO") { cmdPart, cmdRemaining, _ = cutSpaceForSQL(cmdRemaining) }build/generate-bindata.go1
6:9package-comments
build/generate-bindata.go:6:9
package mainmodelmigration/v1_10/v100.go2
4:9package-directory-mismatch
modelmigration/v1_10/v100.go:4:9
package v1_104:9package-naming
modelmigration/v1_10/v100.go:4:9
package v1_10services/oauth2_provider/access_token.go1
32:2partially-typed-constant-group
services/oauth2_provider/access_token.go:32:2
// AccessTokenErrorCodeInvalidRequest represents an error code specified in RFC 6749 AccessTokenErrorCodeInvalidRequest AccessTokenErrorCode = "invalid_request" // AccessTokenErrorCodeInvalidClient represents an error code specified in RFC 6749cmd/admin_auth_ldap_test.go1
222:14range-value-address
cmd/admin_auth_ldap_test.go:222:14
var createdAuthSource *auth.Source service := &authService{ initDB: func(context.Context) error {modules/git/log_name_status_nogogit.go1
81:2redefines-builtin-id
modules/git/log_name_status_nogogit.go:81:2
rd *bufio.Reader close func()}cmd/admin_auth.go1
78:13redundant-conversion
cmd/admin_auth.go:78:13
padChar := byte('\t') if len(c.String("pad-char")) > 0 {models/auth/oauth2.go1
24:2redundant-import-alias
models/auth/oauth2.go:24:2
uuid "github.com/google/uuid" "golang.org/x/crypto/bcrypt"routers/web/repo/middlewares.go1
61:3redundant-switch-break
routers/web/repo/middlewares.go:61:3
case "", "ignore-all", "ignore-eol", "ignore-change": break default:- Fix (safe): remove the redundant break
modules/git/attribute/checker.go1
85:15separate-byte-string-map-key
modules/git/attribute/checker.go:85:15
for i := 0; i < (len(fields) / 3); i++ { filename := string(fields[3*i]) attribute := string(fields[3*i+1])modules/actions/workflows.go1
765:4single-case-switch
modules/actions/workflows.go:765:4
action := payload.Action switch action { case api.HookReleaseUpdated:models/actions/run_job.go1
362:2slice-preallocation
models/actions/run_job.go:362:2
} out := make([]*ActionRunJob, 0) for _, j := range allJobs {cmd/admin_user_create.go1
138:3task-comment
cmd/admin_user_create.go:138:3
if !setting.IsInTesting { // FIXME: need to refactor the "initDB" related code later // it doesn't make sense to call it in (almost) every command action functionbuild/generate-emoji.go1
71:1top-level-declaration-order
build/generate-emoji.go:71:1
var replacer = strings.NewReplacer( "main.Gemoji", "Gemoji",models/unittest/unit_tests.go1
174:6unchecked-rows-error
models/unittest/unit_tests.go:174:6
idx := 0 for rows.Next() { row := make([]any, len(columns))cmd/admin_auth_ldap.go1
393:45unchecked-type-assertion
cmd/admin_auth_ldap.go:393:45
parseAuthSourceLdap(c, authSource) if err := parseLdapConfig(c, authSource.Cfg.(*ldap.Source)); err != nil { return errrouters/web/auth/oauth.go1
331:2unclosed-http-response-body
routers/web/auth/oauth.go:331:2
resp, err := oauth2AvatarHTTPClient().Do(req) if err != nil {models/git/branch_test.go1
158:2unexported-naming
models/git/branch_test.go:158:2
repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}) _isDefault := falsemodules/issue/template/template.go1
409:33unexported-return
modules/issue/template/template.go:409:33
func (f *valuedField) Options() []*valuedOption { if options, ok := f.Attributes["options"].([]any); ok {cmd/generate.go1
112:3unnecessary-format
cmd/generate.go:112:3
if isatty.IsTerminal(os.Stdout.Fd()) { fmt.Printf("\n") }cmd/doctor_convert.go1
41:4unreachable-code
cmd/doctor_convert.go:41:4
log.Fatal("Failed to convert database & table: %v", err) return err }tests/integration/repo_test.go1
216:24unsafe-formatted-url-host-port
tests/integration/repo_test.go:216:24
assert.True(t, exists, "The template has changed") sshURL := fmt.Sprintf("ssh://%s@%s:%d/user2/repo1.git", setting.SSH.User, setting.SSH.Domain, setting.SSH.Port) assert.Equal(t, sshURL, link)cmd/doctor_convert.go1
26:44unused-parameter
cmd/doctor_convert.go:26:44
func runDoctorConvert(ctx context.Context, cmd *cli.Command) error { if err := initDB(ctx); err != nil {modelmigration/v1_14/v164.go1
28:7unused-receiver
modelmigration/v1_14/v164.go:28:7
// autogenerated table name for this struct is "o_auth2_grant".func (grant *OAuth2Grant) TableName() string { return "oauth2_grant"cmd/serv.go1
142:3use-fmt-print
cmd/serv.go:142:3
if setting.SSH.Disabled { println("Gitea: SSH has been disabled") return nilbuild/generate-emoji.go1
123:2use-slices-sort
build/generate-emoji.go:123:2
sort.Slice(data, func(i, j int) bool { return data[i].Aliases[0] < data[j].Aliases[0]models/git/branch_test.go1
158:2var-naming
models/git/branch_test.go:158:2
repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}) _isDefault := falsemodelmigration/v1_10/v88.go1
14:27weak-cryptography
modelmigration/v1_10/v88.go:14:27
func hashContext(context string) string { return fmt.Sprintf("%x", sha1.Sum([]byte(context)))}build/generate-go-licenses.go1
166:30add-constant
build/generate-go-licenses.go:166:30
entryName = modulePath + "/" + relSlash entryPath = modulePath + "/" + relSlash + "/" + name }services/mailer/mail_issue.go1
50:21append-to-sized-slice
services/mailer/mail_issue.go:50:21
} unfiltered = append(unfiltered, ids...)modules/migration/schemas_bindata.go1
17:2blank-imports
modules/migration/schemas_bindata.go:17:2
_ "embed"models/unittest/fixtures_loader.go1
157:6boolean-literal-comparison
models/unittest/fixtures_loader.go:157:6
synced, existing := f.tableSyncMap.Load(fixture.tableName) if synced == true || !existing { continuebuild/generate-gitignores.go1
24:6cognitive-complexity
build/generate-gitignores.go:24:6
func main() { var (models/actions/run_job_summary.go1
137:6confusing-naming
models/actions/run_job_summary.go:137:6
func upsertActionRunJobSummary(ctx context.Context, summary *ActionRunJobSummary) error { engine := db.GetEngine(ctx)models/actions/utils.go1
21:45confusing-results
models/actions/utils.go:21:45
func generateSaltedToken() (string, string, string, string) { salt := util.CryptoRandomString(10)modules/cache/string_cache.go1
47:6constructor-interface-return
modules/cache/string_cache.go:47:6
func NewStringCache(cacheConfig setting.Cache) (StringCache, error) { adapter := util.IfZero(cacheConfig.Adapter, "memory")modules/templates/page.go1
47:93context-as-argument
modules/templates/page.go:47:93
func (r *pageRenderer) HTML(w io.Writer, status int, tplName TplName, data any, templateCtx context.Context) error { //nolint:revive // we don't use ctx, only pass it to the template executor name := string(tplName)models/renderhelper/commit_checker.go1
16:2context-stored-in-struct
models/renderhelper/commit_checker.go:16:2
type commitChecker struct { ctx context.Context commitCache map[string]boolbuild/generate-gitignores.go1
24:6cyclomatic-complexity
build/generate-gitignores.go:24:6
func main() { var (cmd/cert.go1
98:4deep-exit
cmd/cert.go:98:4
if err != nil { log.Fatalf("Unable to marshal ECDSA private key: %v", err) }modules/repository/fork_test.go1
16:2deferred-return-function-not-called
modules/repository/fork_test.go:16:2
func TestCanUserForkBetweenOwners(t *testing.T) { defer test.MockVariableValue(&setting.Repository.AllowForkIntoSameOwner)modules/markup/common/footnote.go1
200:13deprecated-api-usage
modules/markup/common/footnote.go:200:13
open := pos + 1 closure := util.FindClosure(line[pos+1:], '[', ']', false, false) //nolint:staticcheck // deprecated function closes := pos + 1 + closurerouters/web/auth/auth_test.go1
74:3discarded-deferred-result
routers/web/auth/auth_test.go:74:3
t.Run("OAuth2MissingField", func(t *testing.T) { defer test.MockVariableValue(&gothic.CompleteUserAuth, func(res http.ResponseWriter, req *http.Request) (goth.User, error) { return goth.User{Provider: "dummy+auth's source", UserID: "dummy-user"}, nilcmd/admin.go1
145:5discarded-error-result
cmd/admin.go:145:5
log.Warn(" SyncReleasesWithTags: %v", err) gitRepo.Close() continuecmd/web.go1
34:1doc-comment-period
cmd/web.go:34:1
// PIDFile could be set from build tagvar PIDFile = "/run/gitea.pid"cmd/manager_logging.go1
241:2early-return
cmd/manager_logging.go:241:2
mode := "file" if c.IsSet("filename") { vals["filename"] = c.String("filename")routers/web/user/setting/adopt.go1
41:19empty-conditional-block
routers/web/user/setting/adopt.go:41:19
} if has || !exist { // Fallthrough to failure modecmd/admin_auth_smtp.go1
103:22error-strings
cmd/admin_auth_smtp.go:103:22
if !util.SliceContainsString(validAuthTypes, strings.ToUpper(c.String("auth-type"))) { return errors.New("Auth must be one of PLAIN/LOGIN/CRAM-MD5") }models/admin/task.go1
154:6error-type-naming
models/admin/task.go:154:6
// ErrTaskDoesNotExist represents a "TaskDoesNotExist" kind of error.type ErrTaskDoesNotExist struct { ID int64cmd/hook_test.go1
53:2excessive-blank-identifiers
cmd/hook_test.go:53:2
_, _, _, ok = parseGitHookCommitRefLine("a b") assert.False(t, ok)build/generate-go-licenses.go1
52:6exported-declaration-comment
build/generate-go-licenses.go:52:6
type LicenseEntry struct { Name string `json:"name"`cmd/hook.go1
1:1file-length-limit
cmd/hook.go:1:1
// Copyright 2017 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MITcmd/embedded.go1
231:53flag-parameter
cmd/embedded.go:231:53
func extractAsset(d string, a assetFile, overwrite, rename bool) error { dest := filepath.Join(d, filepath.FromSlash(a.path))build/generate-go-licenses.go1
1:1format
build/generate-go-licenses.go:1:1
// Copyright 2022 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MIT- Fix (safe): run `strider fmt build/generate-go-licenses.go`
build/generate-gitignores.go1
24:6function-length
build/generate-gitignores.go:24:6
func main() { var (models/actions/utils.go1
21:6function-result-limit
models/actions/utils.go:21:6
func generateSaltedToken() (string, string, string, string) { salt := util.CryptoRandomString(10)routers/api/actions/artifacts.go1
209:26get-function-return-value
routers/api/actions/artifacts.go:209:26
// getUploadArtifactURL generates a URL for uploading an artifactfunc (ar artifactRoutes) getUploadArtifactURL(ctx *ArtifactContext) { _, runID, ok := validateRunID(ctx)modules/storage/azureblob.go1
81:23identical-if-chain-branches
modules/storage/azureblob.go:81:23
return 0, errors.New("Seek: invalid offset") } else if offset < 0 { return 0, errors.New("Seek: invalid offset")modelmigration/base/db.go1
179:2identical-switch-branches
modelmigration/base/db.go:179:2
} case setting.Database.Type.IsMySQL(): // MySQL will drop all the constraints on the old tablecmd/admin.go1
15:2import-alias-naming
cmd/admin.go:15:2
"gitea.dev/modules/log" repo_module "gitea.dev/modules/repository"cmd/cmdtest/cmd_test.go1
166:39import-shadowing
cmd/cmdtest/cmd_test.go:166:39
app := newTestApp(cli.Command{ Action: func(ctx context.Context, cmd *cli.Command) error { _, _ = fmt.Fprint(cmd.Root().Writer, makePathOutput(setting.AppWorkPath, setting.CustomPath, setting.CustomConf))modelmigration/v1_6/v70.go1
101:4inefficient-map-lookup
modelmigration/v1_6/v70.go:101:4
if _, ok := unit.Config["EnableDependencies"]; !ok { unit.Config["EnableDependencies"] = setting.Service.DefaultEnableDependencies }models/auth/oauth2.go1
79:26insecure-url-scheme
models/auth/oauth2.go:79:26
DisplayName: "Git Credential Manager", RedirectURIs: []string{"http://127.0.0.1", "https://127.0.0.1"}, }models/db/engine.go1
69:13interface-method-limit
models/db/engine.go:69:13
// Engine represents a xorm enginetype Engine interface { SQLSessionmodules/log/level.go1
92:7marshal-receiver
modules/log/level.go:92:7
// UnmarshalJSON takes text and turns it into a Levelfunc (l *Level) UnmarshalJSON(b []byte) error { var tmp anymodelmigration/v1_9/v82.go1
81:13max-control-nesting
modelmigration/v1_9/v82.go:81:13
return err } else if !has { return fmt.Errorf("User %d is not exist", repo.OwnerID)services/actions/notifier_helper.go1
354:6max-parameters
services/actions/notifier_helper.go:354:6
// from (the repo itself for repo-level runs, the source repo for scoped runs).func buildApproveAndInsertRun( ctx context.Context,modelmigration/v1_11/v111.go1
94:7max-public-structs
modelmigration/v1_11/v111.go:94:7
type Permission struct { AccessMode intbuild/openapi3gen/enumscan.go1
160:4modifies-parameter
build/openapi3gen/enumscan.go:160:4
if ts.Name.Name == annotated { enumTypes[annotated] = "" return nilmodels/repo/release.go1
360:2modifies-value-receiver
models/repo/release.go:360:2
func (s releaseMetaSearch) Swap(i, j int) { s.ID[i], s.ID[j] = s.ID[j], s.ID[i] s.Rel[i], s.Rel[j] = s.Rel[j], s.Rel[i]cmd/admin_auth_ldap_test.go1
262:13nested-structs
cmd/admin_auth_ldap_test.go:262:13
// Test cases cases := []struct { args []stringcmd/migrate_storage.go1
208:5nil-error-return
cmd/migrate_storage.go:208:5
if errors.Is(err, fs.ErrNotExist) { return nil }cmd/admin_auth_ldap_test.go1
466:5nil-value-with-nil-error
cmd/admin_auth_ldap_test.go:466:5
assert.FailNow(t, "getAuthSourceById called", "case %d: should not call getAuthSourceByID", n) return nil, nil //nolint:nilnil // mock function covering improper behavior },modelmigration/v1_9/v82.go1
92:5no-defer-in-loop
modelmigration/v1_9/v82.go:92:5
} defer gitRepo.Close() gitRepoCache[release.RepoID] = gitRepocmd/embedded.go1
166:4no-else-after-return
cmd/embedded.go:166:4
return errors.New("no files matched the given pattern") } else if len(matchedAssetFiles) > 1 { return errors.New("too many files matched the given pattern, try to be more specific")main.go1
33:6no-init
main.go:33:6
func init() { setting.AppVer = Versionbuild/generate-emoji.go1
71:5no-package-var
build/generate-emoji.go:71:5
var replacer = strings.NewReplacer( "main.Gemoji", "Gemoji",models/unittest/fixtures.go1
120:4overwritten-before-use
models/unittest/fixtures.go:120:4
if util.AsciiEqualFold(cmdPart, "INTO") { cmdPart, cmdRemaining, _ = cutSpaceForSQL(cmdRemaining) }build/generate-emoji.go1
7:9package-comments
build/generate-emoji.go:7:9
package mainmodelmigration/v1_10/v101.go2
4:9package-directory-mismatch
modelmigration/v1_10/v101.go:4:9
package v1_104:9package-naming
modelmigration/v1_10/v101.go:4:9
package v1_10services/oauth2_provider/access_token.go1
62:2partially-typed-constant-group
services/oauth2_provider/access_token.go:62:2
// TokenTypeBearer represents a token type specified in RFC 6749 TokenTypeBearer TokenType = "bearer" // TokenTypeMAC represents a token type specified in RFC 6749cmd/admin_auth_ldap_test.go1
452:14range-value-address
cmd/admin_auth_ldap_test.go:452:14
var createdAuthSource *auth.Source service := &authService{ initDB: func(context.Context) error {modules/templates/vars/vars_test.go1
17:3redefines-builtin-id
modules/templates/vars/vars_test.go:17:3
out string error bool }{cmd/admin_auth_ldap_test.go1
70:29redundant-conversion
cmd/admin_auth_ldap_test.go:70:29
Port: 9876, SecurityProtocol: ldap.SecurityProtocol(1), SkipVerify: true,modules/session/virtual.go1
13:2redundant-import-alias
modules/session/virtual.go:13:2
"gitea.com/go-chi/session" couchbase "gitea.com/go-chi/session/couchbase" memcache "gitea.com/go-chi/session/memcache"modules/git/attribute/checker.go1
86:16separate-byte-string-map-key
modules/git/attribute/checker.go:86:16
filename := string(fields[3*i]) attribute := string(fields[3*i+1]) info := string(fields[3*i+2])modules/actions/workflows.go1
802:4single-case-switch
modules/actions/workflows.go:802:4
action := payload.Action switch action { case api.HookPackageCreated:models/actions/run_job_status_test.go1
15:7slice-preallocation
models/actions/run_job_status_test.go:15:7
t.Helper() var jobs []*ActionRunJob for _, v := range statuses {cmd/hook.go1
231:3task-comment
cmd/hook.go:231:3
for scanner.Scan() { // TODO: support news feeds for wiki if isWiki {build/openapi3gen/convert.go1
168:1top-level-declaration-order
build/openapi3gen/convert.go:168:1
type enumUsage struct { schemaName stringcmd/admin_auth_ldap.go1
412:45unchecked-type-assertion
cmd/admin_auth_ldap.go:412:45
parseAuthSourceLdap(c, authSource) if err := parseLdapConfig(c, authSource.Cfg.(*ldap.Source)); err != nil { return errrouters/api/packages/container/manifest.go1
271:2unexported-naming
routers/api/packages/container/manifest.go:271:2
_pv := &packages_model.PackageVersion{ PackageID: p.ID,routers/api/packages/container/errors.go1
37:50unexported-return
routers/api/packages/container/errors.go:37:50
// WithMessage creates a new instance of the error with a different messagefunc (e *namedError) WithMessage(message string) *namedError { return &namedError{cmd/generate.go1
123:3unnecessary-format
cmd/generate.go:123:3
if isatty.IsTerminal(os.Stdout.Fd()) { fmt.Printf("\n") }cmd/doctor_convert.go1
47:4unreachable-code
cmd/doctor_convert.go:47:4
log.Fatal("Failed to convert database from varchar to nvarchar: %v", err) return err }cmd/generate.go1
103:50unused-parameter
cmd/generate.go:103:50
func runGenerateInternalToken(_ context.Context, c *cli.Command) error { internalToken, err := generate.NewInternalToken()modelmigration/v1_16/v189_test.go1
24:7unused-receiver
modelmigration/v1_16/v189_test.go:24:7
func (ls *LoginSourceOriginalV189) TableName() string { return "login_source"cmd/serv.go1
176:4use-fmt-print
cmd/serv.go:176:4
case asymkey_model.KeyTypeDeploy: println("Hi there! You've successfully authenticated with the deploy key named " + key.Name + ", but Gitea does not provide shell access.") case asymkey_model.KeyTypePrincipal:build/generate-emoji.go1
188:2use-slices-sort
build/generate-emoji.go:188:2
sort.Slice(data, func(i, j int) bool { return data[i].Aliases[0] < data[j].Aliases[0]modules/glob/glob_test.go1
18:2var-naming
modules/glob/glob_test.go:18:2
const ( pattern_all = "[a-z][!a-x]*cat*[h][!b]*eyes*" regexp_all = `^[a-z][^a-x].*cat.*[h][^b].*eyes.*$`modelmigration/v1_11/v115.go1
147:33weak-cryptography
modelmigration/v1_11/v115.go:147:33
newAvatar := fmt.Sprintf("%x", md5.Sum(fmt.Appendf(nil, "%d-%x", userID, md5.Sum(data)))) if newAvatar == oldAvatar {build/openapi3gen/convert.go1
209:60add-constant
build/openapi3gen/convert.go:209:60
} if len(propRef.Value.Enum) > 1 && propRef.Value.Type.Is("string") { key := groupKey{modules/options/options_bindata.go1
15:2blank-imports
modules/options/options_bindata.go:15:2
_ "embed")modules/templates/helper.go1
196:21boolean-literal-comparison
modules/templates/helper.go:196:21
func isQueryParamEmpty(v any) bool { return v == nil || v == false || v == 0 || v == int64(0) || v == ""}build/generate-go-licenses.go1
60:6cognitive-complexity
build/generate-go-licenses.go:60:6
// and the package directories used from each module.func getModules(goCmd string) []ModuleInfo { cmd := exec.Command(goCmd, "list", "-deps", "-f",models/actions/run_list.go1
184:6confusing-naming
models/actions/run_list.go:184:6
func getRunWorkflowIDs(ctx context.Context, repoID int64, extraCond builder.Cond) ([]string, error) { ids := make([]string, 0, 10)models/actions/utils.go1
21:53confusing-results
models/actions/utils.go:21:53
func generateSaltedToken() (string, string, string, string) { salt := util.CryptoRandomString(10)modules/globallock/memory_locker.go1
18:6constructor-interface-return
modules/globallock/memory_locker.go:18:6
func NewMemoryLocker() Locker { return &memoryLocker{}modules/auth/password/pwn/pwn.go1
27:2context-stored-in-struct
modules/auth/password/pwn/pwn.go:27:2
type Client struct { ctx context.Context http *http.Clientbuild/generate-go-licenses.go1
135:6cyclomatic-complexity
build/generate-go-licenses.go:135:6
// If moduleRoot is non-empty, paths are made relative to it.func scanDirForLicenses(dir, modulePath, moduleRoot string) []LicenseEntry { dirEntries, err := os.ReadDir(dir)cmd/doctor_convert.go1
40:4deep-exit
cmd/doctor_convert.go:40:4
if err := db.ConvertDatabaseTable(); err != nil { log.Fatal("Failed to convert database & table: %v", err) return errmodules/setting/git_test.go1
41:2deferred-return-function-not-called
modules/setting/git_test.go:41:2
func TestGitReflog(t *testing.T) { defer test.MockVariableValue(&Git) defer test.MockVariableValue(&GitConfig)modules/markup/common/footnote.go1
290:13deprecated-api-usage
modules/markup/common/footnote.go:290:13
open := pos closure := util.FindClosure(line[pos:], '[', ']', false, false) //nolint:staticcheck // deprecated function if closure < 0 {tests/integration/auth_ldap_test.go1
513:2discarded-deferred-result
tests/integration/auth_ldap_test.go:513:2
} defer test.MockVariableValue(&ldap.MockedSearchEntry, func(source *ldap.Source, name, passwd string, directBind bool) *ldap.SearchResult { var u *ldapUsercmd/admin.go1
152:5discarded-error-result
cmd/admin.go:152:5
log.Warn(" GetReleaseCountByRepoID: %v", err) gitRepo.Close() continuecmd/web_graceful.go1
21:1doc-comment-period
cmd/web_graceful.go:21:1
// NoHTTPRedirector tells our cleanup routine that we will not be using a fallback http redirectorfunc NoHTTPRedirector() {models/actions/utils.go1
81:4early-return
models/actions/utils.go:81:4
if stopped.IsZero() || stopped < started { if !fallbackEnd.IsZero() && fallbackEnd >= started { end = fallbackEndcmd/admin_user_create.go1
173:22error-strings
cmd/admin_user_create.go:173:22
if err != nil { return fmt.Errorf("IsTableNotEmpty: %w", err) }models/asymkey/error.go1
13:6error-type-naming
models/asymkey/error.go:13:6
// ErrKeyUnableVerify represents a "KeyUnableVerify" kind of error.type ErrKeyUnableVerify struct { Result stringmodels/asymkey/ssh_key_authorized_keys.go1
81:3excessive-blank-identifiers
models/asymkey/ssh_key_authorized_keys.go:81:3
} else { pubKey, _, _, _, err := ssh.ParseAuthorizedKey([]byte(key.Content)) if err != nil {build/openapi3gen/convert.go1
34:6exported-declaration-comment
build/openapi3gen/convert.go:34:6
// fallback naming.func Convert(swaggerJSON []byte, astEnumMap map[string][]string) (*openapi3.T, error) { var swagger2 openapi2.Tmodelmigration/base/db.go1
1:1file-length-limit
modelmigration/base/db.go:1:1
// Copyright 2022 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MITcmd/hook.go1
433:22flag-parameter
cmd/hook.go:433:22
func hookPrintResult(output, isCreate bool, branch, url string) { if !output {build/generate-openapi.go1
1:1format
build/generate-openapi.go:1:1
// Copyright 2026 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MIT- Fix (safe): run `strider fmt build/generate-openapi.go`
build/openapi3gen/convert.go1
182:6function-length
build/openapi3gen/convert.go:182:6
// with an actionable error ā there are no silent fallbacks.func extractSharedEnums(doc *openapi3.T, astEnumMap map[string][]string) error { if doc.Components == nil {models/issues/stopwatch.go1
102:6function-result-limit
models/issues/stopwatch.go:102:6
// HasUserStopwatch returns true if the user has a stopwatchfunc HasUserStopwatch(ctx context.Context, userID int64) (exists bool, sw *Stopwatch, issue *Issue, err error) { type stopwatchIssueRepo struct {routers/api/actions/artifacts.go1
399:26get-function-return-value
routers/api/actions/artifacts.go:399:26
// getDownloadArtifactURL generates download url for each artifactfunc (ar artifactRoutes) getDownloadArtifactURL(ctx *ArtifactContext) { _, runID, ok := validateRunID(ctx)routers/web/repo/issue_page_meta.go1
357:114identical-if-chain-branches
routers/web/repo/issue_page_meta.go:357:114
tmp.CanChange = true } else if ctx.Doer != nil && ctx.Doer.ID == review.ReviewerID && review.Type == issues_model.ReviewTypeRequest { // A user can refuse review requestsmodelmigration/v1_26/v326.go1
296:2identical-switch-branches
modelmigration/v1_26/v326.go:296:2
return payload.PullRequest.Head.Sha, nil case webhook_module.HookEventPullRequestReviewApproved, webhook_module.HookEventPullRequestReviewRejected,cmd/admin_auth.go1
13:2import-alias-naming
cmd/admin_auth.go:13:2
auth_model "gitea.dev/models/auth" "gitea.dev/models/db"cmd/cmdtest/cmd_test.go1
187:66import-shadowing
cmd/cmdtest/cmd_test.go:187:66
func TestCliCmdError(t *testing.T) { app := newTestApp(cli.Command{Action: func(ctx context.Context, cmd *cli.Command) error { return errors.New("normal error") }}) r, err := runTestApp(app, "./gitea", "test-cmd")modelmigration/v1_8/v76.go1
66:4inefficient-map-lookup
modelmigration/v1_8/v76.go:66:4
if _, ok := unit.Config["AllowRebaseMerge"]; !ok { unit.Config["AllowRebaseMerge"] = allowMergeRebase }models/auth/oauth2.go1
84:26insecure-url-scheme
models/auth/oauth2.go:84:26
DisplayName: "tea", RedirectURIs: []string{"http://127.0.0.1", "https://127.0.0.1"}, }models/db/engine.go1
76:14interface-method-limit
models/db/engine.go:76:14
// Session represents a xorm session interfacetype Session interface { Enginemodules/optional/serialization.go1
21:7marshal-receiver
modules/optional/serialization.go:21:7
func (o Option[T]) MarshalJSON() ([]byte, error) { if !o.Has() {models/asymkey/gpg_key_add.go1
113:8max-control-nesting
models/asymkey/gpg_key_add.go:113:8
for _, originalSubkey := range original.Subkeys { if originalSubkey.PublicKey == nil { continueservices/actions/reusable_workflow.go1
272:6max-parameters
services/actions/reusable_workflow.go:272:6
// insertCallerChildren parses the called workflow with the caller's resolved inputs and inserts each parsed job.func insertCallerChildren(ctx context.Context, run *actions_model.ActionRun, attempt *actions_model.ActionRunAttempt, caller *actions_model.ActionRunJob, content []byte, sourceRepoID int64, sourceCommitSHA string, vars map[string]string, inputs map[string]any) error { // Parse the called workflow with the caller's `inputs`modelmigration/v1_11/v111.go1
100:7max-public-structs
modelmigration/v1_11/v111.go:100:7
type TeamUser struct { ID int64 `xorm:"pk autoincr"`build/openapi3gen/enumscan.go1
189:4modifies-parameter
build/openapi3gen/enumscan.go:189:4
} enumValues[ident.Name] = append(enumValues[ident.Name], unquoted) }models/repo/release.go1
360:11modifies-value-receiver
models/repo/release.go:360:11
func (s releaseMetaSearch) Swap(i, j int) { s.ID[i], s.ID[j] = s.ID[j], s.ID[i] s.Rel[i], s.Rel[j] = s.Rel[j], s.Rel[i]cmd/admin_auth_ldap_test.go1
492:13nested-structs
cmd/admin_auth_ldap_test.go:492:13
// Test cases cases := []struct { args []stringmodels/actions/runner.go1
360:4nil-error-return
models/actions/runner.go:360:4
if errors.Is(err, util.ErrNotExist) { return nil }models/actions/run_job.go1
690:3nil-value-with-nil-error
models/actions/run_job.go:690:3
if job.Status.IsDone() { return nil, nil //nolint:nilnil // signal "nothing to cancel; not an error" }models/issues/issue_project_multi_test.go1
111:4no-defer-in-loop
models/issues/issue_project_multi_test.go:111:4
projects = append(projects, project) defer func(id int64) { _ = project_model.DeleteProjectByID(t.Context(), id)cmd/embedded.go1
212:4no-else-after-return
cmd/embedded.go:212:4
return fmt.Errorf("%s: %s", destdir, err) } else if !fi.IsDir() { return fmt.Errorf("destination %q is not a directory", destdir)models/actions/artifact.go1
53:6no-init
models/actions/artifact.go:53:6
func init() { db.RegisterModel(new(ActionArtifact))build/generate-emoji.go1
81:5no-package-var
build/generate-emoji.go:81:5
var emojiRE = regexp.MustCompile(`\{Emoji:"([^"]*)"`)models/unittest/fixtures.go1
124:3overwritten-before-use
models/unittest/fixtures.go:124:3
case util.AsciiEqualFold(cmdPart, "UPDATE"): cmdPart, cmdRemaining, _ = cutSpaceForSQL(cmdRemaining) fixturesLoader.MarkTableChanged(trimTableNameQuotes(cmdPart))build/generate-gitignores.go1
6:9package-comments
build/generate-gitignores.go:6:9
package mainmodelmigration/v1_10/v88.go2
4:9package-directory-mismatch
modelmigration/v1_10/v88.go:4:9
package v1_104:9package-naming
modelmigration/v1_10/v88.go:4:9
package v1_10cmd/admin_auth_ldap_test.go1
920:14range-value-address
cmd/admin_auth_ldap_test.go:920:14
var updatedAuthSource *auth.Source service := &authService{ initDB: func(context.Context) error {modules/util/sync.go1
13:2redefines-builtin-id
modules/util/sync.go:13:2
value T panic any}cmd/admin_auth_ldap_test.go1
117:24redundant-conversion
cmd/admin_auth_ldap_test.go:117:24
Port: 1234, SecurityProtocol: ldap.SecurityProtocol(0), UserBase: "ou=Users,dc=min-domain-bind,dc=org",modules/session/virtual.go1
14:2redundant-import-alias
modules/session/virtual.go:14:2
couchbase "gitea.com/go-chi/session/couchbase" memcache "gitea.com/go-chi/session/memcache" mysql "gitea.com/go-chi/session/mysql"modules/mcaptcha/mcaptcha_test.go1
22:3single-case-switch
modules/mcaptcha/mcaptcha_test.go:22:3
w.Header().Set("Content-Type", "application/json") switch r.URL.Path { case "/api/v1/pow/siteverify":models/actions/run_job_status_test.go1
21:8slice-preallocation
models/actions/run_job_status_test.go:21:8
if !assert.Equal(t, expected, actual) { var statusStrings []string for _, s := range statuses {cmd/main.go1
142:2task-comment
cmd/main.go:142:2
// TODO: we should eventually drop the default command, // but not sure whether it would break Windows users who used to double-click the EXE to run.build/openapi3gen/enumscan.go1
34:1top-level-declaration-order
build/openapi3gen/enumscan.go:34:1
var rxSwaggerEnum = regexp.MustCompile(`swagger:enum\s+(\w+)`)cmd/admin_auth_ldap.go1
438:45unchecked-type-assertion
cmd/admin_auth_ldap.go:438:45
parseAuthSourceLdap(c, authSource) if err := parseLdapConfig(c, authSource.Cfg.(*ldap.Source)); err != nil { return errservices/lfs/server.go1
138:5unexported-naming
services/lfs/server.go:138:5
if match[2] != "" { _toByte, _ := strconv.ParseInt(match[2], 10, 32) if _toByte >= fromByte && _toByte < toByte {routers/api/packages/container/errors.go1
46:53unexported-return
routers/api/packages/container/errors.go:46:53
// WithStatusCode creates a new instance of the error with a different status codefunc (e *namedError) WithStatusCode(statusCode int) *namedError { return &namedError{cmd/generate.go1
139:3unnecessary-format
cmd/generate.go:139:3
if isatty.IsTerminal(os.Stdout.Fd()) { fmt.Printf("\n") }cmd/dump_repo.go1
189:3unreachable-code
cmd/dump_repo.go:189:3
log.Fatal("Failed to dump repository: %v", err) return err }cmd/generate.go1
118:49unused-parameter
cmd/generate.go:118:49
func runGenerateLfsJwtSecret(_ context.Context, c *cli.Command) error { _, jwtSecretBase64 := generate.NewJwtSecretWithBase64()modelmigration/v1_20/v249.go1
23:7unused-receiver
modelmigration/v1_20/v249.go:23:7
// TableName sets the name of this tablefunc (a *Action) TableName() string { return "action"cmd/serv.go1
178:4use-fmt-print
cmd/serv.go:178:4
case asymkey_model.KeyTypePrincipal: println("Hi there! You've successfully authenticated with the principal " + key.Content + ", but Gitea does not provide shell access.") default:build/generate-go-licenses.go1
221:2use-slices-sort
build/generate-go-licenses.go:221:2
sort.Slice(entries, func(i, j int) bool { return entries[i].Path < entries[j].Pathmodules/glob/glob_test.go1
19:2var-naming
modules/glob/glob_test.go:19:2
pattern_all = "[a-z][!a-x]*cat*[h][!b]*eyes*" regexp_all = `^[a-z][^a-x].*cat.*[h][^b].*eyes.*$` fixture_all_match = "my cat has very bright eyes"modelmigration/v1_11/v115.go1
147:75weak-cryptography
modelmigration/v1_11/v115.go:147:75
newAvatar := fmt.Sprintf("%x", md5.Sum(fmt.Appendf(nil, "%d-%x", userID, md5.Sum(data)))) if newAvatar == oldAvatar {build/openapi3gen/convert_test.go1
22:36add-constant
build/openapi3gen/convert_test.go:22:36
if got != "Color" { t.Fatalf("got %q, want %q", got, "Color") }modules/public/public_bindata.go1
13:2blank-imports
modules/public/public_bindata.go:13:2
_ "embed"modules/web/middleware/binding.go1
97:24boolean-literal-comparison
modules/web/middleware/binding.go:97:24
if errs.Len() == 0 || data["HasErrorFormValidation"] == true { return errsbuild/generate-go-licenses.go1
103:6cognitive-complexity
build/generate-go-licenses.go:103:6
// are only included if their text differs from the root license(s).func findLicenseFiles(mod ModuleInfo) []LicenseEntry { var entries []LicenseEntrymodels/activities/notification_list.go1
78:6confusing-naming
models/activities/notification_list.go:78:6
func createOrUpdateIssueNotifications(ctx context.Context, issueID, commentID, notificationAuthorID, receiverID int64) error { // initmodels/db/conn.go1
75:56confusing-results
models/db/conn.go:75:56
func ConnStrDefaultDatabase(opts ConnOptions) (string, string, error) { opts.Database, opts.Schema = "", ""modules/globallock/redis_locker.go1
37:6constructor-interface-return
modules/globallock/redis_locker.go:37:6
func NewRedisLocker(connection string) Locker { conn := nosql.GetManager().GetRedisClient(connection)modules/auth/webauthn/webauthn.go1
44:2context-stored-in-struct
modules/auth/webauthn/webauthn.go:44:2
type user struct { ctx context.Context User *user_model.Userbuild/openapi3gen/convert.go1
112:6cyclomatic-complexity
build/openapi3gen/convert.go:112:6
// for code generators.func addURIFormats(doc *openapi3.T) { if doc.Components == nil {cmd/doctor_convert.go1
46:4deep-exit
cmd/doctor_convert.go:46:4
if err := db.ConvertVarcharToNVarchar(); err != nil { log.Fatal("Failed to convert database from varchar to nvarchar: %v", err) return errmodules/setting/git_test.go1
42:2deferred-return-function-not-called
modules/setting/git_test.go:42:2
defer test.MockVariableValue(&Git) defer test.MockVariableValue(&GitConfig)modules/secret/secret.go1
31:9deprecated-api-usage
modules/secret/secret.go:31:9
} cfb := cipher.NewCFBEncrypter(block, iv) //nolint:staticcheck // need to migrate and refactor to a new approach cfb.XORKeyStream(ciphertext[aes.BlockSize:], []byte(b))tests/integration/oauth_avatar_test.go1
47:3discarded-deferred-result
tests/integration/oauth_avatar_test.go:47:3
defer test.MockVariableValue(&setting.OAuth2Client.EnableAutoRegistration, true)() defer test.MockVariableValue(&gothic.CompleteUserAuth, func(res http.ResponseWriter, req *http.Request) (goth.User, error) { return goth.User{cmd/admin.go1
158:4discarded-error-result
cmd/admin.go:158:4
repo.FullName(), oldnum, count) gitRepo.Close() }cmd/web_graceful.go1
27:1doc-comment-period
cmd/web_graceful.go:27:1
// NoInstallListener tells our cleanup routine that we will not be using a possibly provided listener// for our install HTTP/HTTPS servicefunc NoInstallListener() {models/db/collation.go1
87:9early-return
models/db/collation.go:87:9
} } else if x.Dialect().URI().DBType == schemas.MSSQL { if _, err = x.SQL("SELECT DATABASEPROPERTYEX(DB_NAME(), 'Collation')").Get(&res.DatabaseCollation); err != nil {cmd/admin_user_create.go1
229:21error-strings
cmd/admin_user_create.go:229:21
if err := user_model.CreateUser(ctx, u, &user_model.Meta{}, overwriteDefault); err != nil { return fmt.Errorf("CreateUser: %w", err) }models/asymkey/error.go1
31:6error-type-naming
models/asymkey/error.go:31:6
// ErrKeyNotExist represents a "KeyNotExist" kind of error.type ErrKeyNotExist struct { ID int64models/asymkey/ssh_key_fingerprint.go1
32:2excessive-blank-identifiers
models/asymkey/ssh_key_fingerprint.go:32:2
// Calculate fingerprint. pk, _, _, _, err := ssh.ParseAuthorizedKey([]byte(publicKeyContent)) if err != nil {build/openapi3gen/enumscan.go1
25:6exported-declaration-comment
build/openapi3gen/enumscan.go:25:6
// across spec properties and scanned Go type declarations.func EnumKey(values []any) string { strs := make([]string, len(values))modelmigration/migrations.go1
1:1file-length-limit
modelmigration/migrations.go:1:1
// Copyright 2015 The Gogs Authors. All rights reserved.// Copyright 2017 The Gitea Authors. All rights reserved.cmd/hook.go1
433:30flag-parameter
cmd/hook.go:433:30
func hookPrintResult(output, isCreate bool, branch, url string) { if !output {build/openapi3gen/convert.go1
1:1format
build/openapi3gen/convert.go:1:1
// Copyright 2026 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MIT- Fix (safe): run `strider fmt build/openapi3gen/convert.go`
cmd/admin_auth_ldap.go1
27:6function-length
cmd/admin_auth_ldap.go:27:6
func commonLdapCLIFlags() []cli.Flag { return []cli.Flag{modules/actions/workflows.go1
178:6function-result-limit
modules/actions/workflows.go:178:6
func DetectWorkflows( ctx context.Context,routers/api/actions/artifactsv4.go1
628:28get-function-return-value
routers/api/actions/artifactsv4.go:628:28
func (r *artifactV4Routes) getSignedArtifactURL(ctx *ArtifactContext) { var req GetSignedArtifactURLRequestservices/context/org.go1
103:51identical-if-chain-branches
services/context/org.go:103:51
opts.RequireMember = true } else if ctx.IsSigned && ctx.Doer.IsRestricted { opts.RequireMember = truemodels/auth/access_token_scope.go1
228:2identical-switch-branches
models/auth/access_token_scope.go:228:2
return Write case perm.AccessModeAdmin: return Writecmd/admin_auth.go1
15:2import-alias-naming
cmd/admin_auth.go:15:2
"gitea.dev/models/db" auth_service "gitea.dev/services/auth"cmd/cmdtest/cmd_test.go1
194:65import-shadowing
cmd/cmdtest/cmd_test.go:194:65
app = newTestApp(cli.Command{Action: func(ctx context.Context, cmd *cli.Command) error { return cli.Exit("exit error", 2) }}) r, err = runTestApp(app, "./gitea", "test-cmd")models/activities/repo_activity.go1
120:4inefficient-map-lookup
models/activities/repo_activity.go:120:4
if user, ok := users[u.ID]; !ok { users[u.ID] = &ActivityAuthorData{ Name: u.DisplayName(),models/auth/oauth2_test.go1
25:64insecure-url-scheme
models/auth/oauth2_test.go:25:64
expectedValidUntil := timeutil.TimeStamp(time.Now().Unix() + 600) code, err := grant.GenerateNewAuthorizationCode(t.Context(), "http://127.0.0.1/", "", "") require.NoError(t, err)models/db/engine.go1
90:22interface-method-limit
models/db/engine.go:90:22
// and are needed by the migration packages.type EngineMigration interface { Enginemodules/optional/serialization.go1
38:7marshal-receiver
modules/optional/serialization.go:38:7
func (o Option[T]) MarshalYAML() (any, error) { if !o.Has() {models/asymkey/gpg_key_add.go1
116:8max-control-nesting
models/asymkey/gpg_key_add.go:116:8
} if originalSubkey.PublicKey.KeyId == subkey.PublicKey.KeyId { found = trueservices/pull/review.go1
115:6max-parameters
services/pull/review.go:115:6
// CreateCodeComment creates a comment on the code linefunc CreateCodeComment(ctx context.Context, doer *user_model.User, gitRepo *git.Repository, issue *issues_model.Issue, line int64, content, treePath string, pendingReview bool, replyReviewID int64, latestCommitID string, attachments []string) (*issues_model.Comment, error) { var (modelmigration/v1_11/v111.go1
106:7max-public-structs
modelmigration/v1_11/v111.go:106:7
type Collaboration struct { ID int64 `xorm:"pk autoincr"`cmd/admin.go1
143:7modifies-parameter
cmd/admin.go:143:7
if _, err = repo_module.SyncReleasesWithTags(ctx, repo, gitRepo); err != nil { log.Warn(" SyncReleasesWithTags: %v", err)models/repo/release.go1
361:2modifies-value-receiver
models/repo/release.go:361:2
s.ID[i], s.ID[j] = s.ID[j], s.ID[i] s.Rel[i], s.Rel[j] = s.Rel[j], s.Rel[i]}cmd/admin_auth_ldap_test.go1
967:13nested-structs
cmd/admin_auth_ldap_test.go:967:13
// Test cases cases := []struct { args []stringmodels/actions/scoped_workflow.go1
160:4nil-error-return
models/actions/scoped_workflow.go:160:4
if exists, existErr := db.GetEngine(ctx).Where("owner_id = ? AND source_repo_id = ?", ownerID, repoID).Exist(new(ActionScopedWorkflowSource)); existErr == nil && exists { return nil }models/actions/run_job.go1
702:4nil-value-with-nil-error
models/actions/run_job.go:702:4
log.Error("Failed to cancel job %d because it has changed", job.ID) return nil, nil //nolint:nilnil // signal "nothing to cancel; not an error" }modules/avatar/identicon/identicon_test.go1
36:3no-defer-in-loop
modules/avatar/identicon/identicon_test.go:36:3
} defer f.Close() err = png.Encode(f, img)cmd/embedded.go1
254:4no-else-after-return
cmd/embedded.go:254:4
return nil } else if !fi.Mode().IsRegular() { return fmt.Errorf("%s already exists, but it's not a regular file", dest)models/actions/run.go1
76:6no-init
models/actions/run.go:76:6
func init() { db.RegisterModel(new(ActionRun))build/generate-go-licenses.go1
23:5no-package-var
build/generate-go-licenses.go:23:5
// also defined in vite.config.tsvar licenseRe = regexp.MustCompile(`^(?i)((UN)?LICEN(S|C)E|COPYING).*$`)models/unittest/fixtures.go1
129:4overwritten-before-use
models/unittest/fixtures.go:129:4
if util.AsciiEqualFold(cmdPart, "FROM") { cmdPart, cmdRemaining, _ = cutSpaceForSQL(cmdRemaining) }build/generate-go-licenses.go1
6:9package-comments
build/generate-go-licenses.go:6:9
package mainmodelmigration/v1_10/v89.go2
4:9package-directory-mismatch
modelmigration/v1_10/v89.go:4:9
package v1_104:9package-naming
modelmigration/v1_10/v89.go:4:9
package v1_10cmd/admin_auth_ldap_test.go1
920:14range-value-address
cmd/admin_auth_ldap_test.go:920:14
var updatedAuthSource *auth.Source service := &authService{ initDB: func(context.Context) error {tests/integration/api_actions_artifact_v4_test.go1
63:3redefines-builtin-id
tests/integration/api_actions_artifact_v4_test.go:63:3
noLength bool append int path stringcmd/admin_auth_ldap_test.go1
297:29redundant-conversion
cmd/admin_auth_ldap_test.go:297:29
Port: 987, SecurityProtocol: ldap.SecurityProtocol(2), SkipVerify: true,modules/session/virtual.go1
15:2redundant-import-alias
modules/session/virtual.go:15:2
memcache "gitea.com/go-chi/session/memcache" mysql "gitea.com/go-chi/session/mysql" postgres "gitea.com/go-chi/session/postgres"modules/repository/license.go1
101:2single-case-switch
modules/repository/license.go:101:2
// It's unsafe to apply them to all licenses. switch name { case "0BSD":models/asymkey/ssh_key.go1
352:6slice-preallocation
models/asymkey/ssh_key.go:352:6
// Get Public Keys from DB with the current auth source var giteaKeys []string keys, err := db.Find[PublicKey](ctx, FindPublicKeyOptions{cmd/serv.go1
138:2task-comment
cmd/serv.go:138:2
func runServ(ctx context.Context, c *cli.Command) error { // FIXME: This needs to internationalised setup(ctx, c.Bool("debug"))cmd/cmdtest/cmd_test.go1
45:1top-level-declaration-order
cmd/cmdtest/cmd_test.go:45:1
type runResult struct { Stdout stringcmd/admin_auth_ldap.go1
457:45unchecked-type-assertion
cmd/admin_auth_ldap.go:457:45
parseAuthSourceLdap(c, authSource) if err := parseLdapConfig(c, authSource.Cfg.(*ldap.Source)); err != nil { return errtests/integration/api_repo_collaborator_test.go1
95:3unexported-naming
tests/integration/api_repo_collaborator_test.go:95:3
_session := loginUser(t, user5.Name) _testCtx := NewAPITestContext(t, user5.Name, repo2.Name, auth_model.AccessTokenScopeReadRepository)services/actions/notifier_helper.go1
87:59unexported-return
services/actions/notifier_helper.go:87:59
func (input *notifyInput) WithDoer(doer *user_model.User) *notifyInput { input.Doer = doercmd/migrate.go1
39:3unreachable-code
cmd/migrate.go:39:3
log.Fatal("Failed to initialize ORM engine: %v", err) return err }cmd/generate.go1
129:46unused-parameter
cmd/generate.go:129:46
func runGenerateSecretKey(_ context.Context, c *cli.Command) error { secretKey, err := generate.NewSecretKey()modelmigration/v1_20/v249.go1
28:7unused-receiver
modelmigration/v1_20/v249.go:28:7
// TableIndices implements xorm's TableIndices interfacefunc (a *Action) TableIndices() []*schemas.Index { repoIndex := schemas.NewIndex("r_u_d", schemas.IndexType)cmd/serv.go1
180:4use-fmt-print
cmd/serv.go:180:4
default: println("Hi there, " + user.Name + "! You've successfully authenticated with the key named " + key.Name + ", but Gitea does not provide shell access.") }build/openapi3gen/convert.go1
357:2use-slices-sort
build/openapi3gen/convert.go:357:2
ordered := append([]string(nil), candidates...) sort.Slice(ordered, func(i, j int) bool { return len(ordered[i]) > len(ordered[j]) }) var matches []stringmodules/glob/glob_test.go1
20:2var-naming
modules/glob/glob_test.go:20:2
regexp_all = `^[a-z][^a-x].*cat.*[h][^b].*eyes.*$` fixture_all_match = "my cat has very bright eyes" fixture_all_mismatch = "my dog has very bright eyes"models/auth/twofactor.go1
94:7weak-cryptography
models/auth/twofactor.go:94:7
func (t *TwoFactor) getEncryptionKey() []byte { k := md5.Sum([]byte(setting.SecretKey)) return k[:]build/openapi3gen/convert_test.go1
58:7add-constant
build/openapi3gen/convert_test.go:58:7
Properties: openapi3.Schemas{ "color": {Value: &openapi3.Schema{ Type: &openapi3.Types{"string"},modules/templates/templates_bindata.go1
15:2blank-imports
modules/templates/templates_bindata.go:15:2
_ "embed")routers/api/packages/api.go1
43:6boolean-literal-comparison
routers/api/packages/api.go:43:6
return func(ctx *context.Context) { if ctx.Data["IsApiToken"] == true { scope, ok := ctx.Data["ApiTokenScope"].(auth_model.AccessTokenScope)build/generate-go-licenses.go1
135:6cognitive-complexity
build/generate-go-licenses.go:135:6
// If moduleRoot is non-empty, paths are made relative to it.func scanDirForLicenses(dir, modulePath, moduleRoot string) []LicenseEntry { dirEntries, err := os.ReadDir(dir)models/asymkey/gpg_key.go1
222:6confusing-naming
models/asymkey/gpg_key.go:222:6
// DeleteGPGKey deletes GPG key information in database.func DeleteGPGKey(ctx context.Context, doer *user_model.User, id int64) (err error) { key, err := GetGPGKeyForUserByID(ctx, doer.ID, id)models/db/conn.go1
80:41confusing-results
models/db/conn.go:80:41
func ConnStr(opts ConnOptions) (string, string, error) { switch {modules/htmlutil/html.go1
134:6constructor-interface-return
modules/htmlutil/html.go:134:6
func NewHTMLWriter(w io.Writer) HTMLWriter { return &htmlWriter{w: w}modules/git/attribute/batch.go1
24:2context-stored-in-struct
modules/git/attribute/batch.go:24:2
stdOut *nulSeparatedAttributeWriter ctx context.Context cancel context.CancelFuncbuild/openapi3gen/convert.go1
182:6cyclomatic-complexity
build/openapi3gen/convert.go:182:6
// with an actionable error ā there are no silent fallbacks.func extractSharedEnums(doc *openapi3.T, astEnumMap map[string][]string) error { if doc.Components == nil {cmd/dump.go1
102:2deep-exit
cmd/dump.go:102:2
func fatal(format string, args ...any) { log.Fatal(format, args...)}tests/integration/repo_archive_test.go1
39:3deferred-return-function-not-called
tests/integration/repo_archive_test.go:39:3
// When using "archiving and caching" approach, archiving with paths will always use streaming and never be cached defer test.MockVariableValue(&setting.Repository.StreamArchives, false) // this can be removed if there is always streaming mode req := NewRequest(t, "GET", "/user2/glob/archive/master.tar.gz?path=aaa.doc&path=x/y")modules/secret/secret.go1
48:9deprecated-api-usage
modules/secret/secret.go:48:9
text = text[aes.BlockSize:] cfb := cipher.NewCFBDecrypter(block, iv) //nolint:staticcheck // need to migrate and refactor to a new approach cfb.XORKeyStream(text, text)tests/integration/oauth_test.go1
1337:4discarded-deferred-result
tests/integration/oauth_test.go:1337:4
defer test.MockVariableValue(&setting.OAuth2Client.EnableAutoRegistration, true)() defer test.MockVariableValue(&gothic.CompleteUserAuth, func(res http.ResponseWriter, req *http.Request) (goth.User, error) { return goth.User{cmd/admin_auth.go1
89:2discarded-error-result
cmd/admin_auth.go:89:2
} w.Flush()main.go1
27:1doc-comment-period
main.go:27:1
// these flags will be set by the build flagsvar (models/issues/review.go1
415:10early-return
models/issues/review.go:415:10
} } else if opts.ReviewerTeam != nil { review.Type = ReviewTypeRequestcmd/admin_user_delete.go1
50:21error-strings
cmd/admin_user_delete.go:50:21
if !c.IsSet("id") && !c.IsSet("username") && !c.IsSet("email") { return errors.New("You must provide the id, username or email of a user to delete") }models/asymkey/error.go1
50:6error-type-naming
models/asymkey/error.go:50:6
// ErrKeyAlreadyExist represents a "KeyAlreadyExist" kind of error.type ErrKeyAlreadyExist struct { OwnerID int64models/asymkey/ssh_key_parse.go1
166:2excessive-blank-identifiers
models/asymkey/ssh_key_parse.go:166:2
// Finally we need to check whether we can actually read the proposed key: _, _, _, _, err := ssh.ParseAuthorizedKey([]byte(keyType + " " + keyContent + " " + keyComment)) if err != nil {build/openapi3gen/enumscan.go1
46:6exported-declaration-comment
build/openapi3gen/enumscan.go:46:6
// constants can't be extracted.func ScanSwaggerEnumTypes(dirs []string) (map[string][]string, error) { fset := token.NewFileSet()models/actions/run_job.go1
1:1file-length-limit
models/actions/run_job.go:1:1
// Copyright 2022 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MITcmd/serv.go1
57:33flag-parameter
cmd/serv.go:57:33
func setup(ctx context.Context, debug bool) { if debug {build/openapi3gen/convert_test.go1
1:1format
build/openapi3gen/convert_test.go:1:1
// Copyright 2026 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MIT- Fix (safe): run `strider fmt build/openapi3gen/convert_test.go`
cmd/admin_auth_ldap.go1
251:6function-length
cmd/admin_auth_ldap.go:251:6
// parseLdapConfig assigns values on config according to command line flags.func parseLdapConfig(c *cli.Command, config *ldap.Source) error { if c.IsSet("name") {modules/git/attribute/checker.go1
17:6function-result-limit
modules/git/attribute/checker.go:17:6
func checkAttrCommand(ctx context.Context, gitRepo *git.Repository, treeish string, filenames, attributes []string) (*gitcmd.Command, []string, func(), error) { cancel := func() {}routers/api/packages/alpine/alpine.go1
32:6get-function-return-value
routers/api/packages/alpine/alpine.go:32:6
func GetRepositoryKey(ctx *context.Context) { _, pub, err := alpine_service.GetOrCreateKeyPair(ctx, ctx.Package.Owner.ID)models/auth/access_token_scope.go1
230:2identical-switch-branches
models/auth/access_token_scope.go:230:2
return Write case perm.AccessModeOwner: return Writecmd/admin_auth_oauth.go1
12:2import-alias-naming
cmd/admin_auth_oauth.go:12:2
auth_model "gitea.dev/models/auth" "gitea.dev/modules/util"cmd/cmdtest/cmd_test.go1
201:65import-shadowing
cmd/cmdtest/cmd_test.go:201:65
app = newTestApp(cli.Command{Action: func(ctx context.Context, cmd *cli.Command) error { return nil }}) r, err = runTestApp(app, "./gitea", "test-cmd", "--no-such")models/issues/comment_list.go1
226:5inefficient-map-lookup
models/issues/comment_list.go:226:5
if _, ok := issues[comment.Issue.ID]; !ok { issues[comment.Issue.ID] = comment.Issue }models/auth/oauth2_test.go1
51:64insecure-url-scheme
models/auth/oauth2_test.go:51:64
grant := unittest.AssertExistsAndLoadBean(t, &auth_model.OAuth2Grant{ID: 1}) code, err := grant.GenerateNewAuthorizationCode(t.Context(), "http://127.0.0.1/", "", "") require.NoError(t, err)modules/migration/downloader.go1
14:17interface-method-limit
modules/migration/downloader.go:14:17
// Downloader downloads the site repo informationtype Downloader interface { GetRepoInfo(ctx context.Context) (*Repository, error)models/issues/issue_update.go1
656:7max-control-nesting
models/issues/issue_update.go:656:7
for _, user := range teamusers { if already, ok := resolved[user.LowerName]; !ok || !already { users = append(users, user)services/pull/review.go1
208:6max-parameters
services/pull/review.go:208:6
// createCodeComment creates a plain code comment at the specified line / pathfunc createCodeComment(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, issue *issues_model.Issue, content, treePath string, line, reviewID int64, attachments []string) (*issues_model.Comment, error) { var commitID, patch stringmodelmigration/v1_11/v111.go1
113:7max-public-structs
modelmigration/v1_11/v111.go:113:7
type Access struct { ID int64 `xorm:"pk autoincr"`cmd/admin_auth_ldap.go1
233:3modifies-parameter
cmd/admin_auth_ldap.go:233:3
if c.IsSet("name") { authSource.Name = c.String("name") }models/repo/release.go1
361:12modifies-value-receiver
models/repo/release.go:361:12
s.ID[i], s.ID[j] = s.ID[j], s.ID[i] s.Rel[i], s.Rel[j] = s.Rel[j], s.Rel[i]}cmd/admin_auth_oauth_test.go1
18:17nested-structs
cmd/admin_auth_oauth_test.go:18:17
func TestAddOauth(t *testing.T) { testCases := []struct { name stringmodels/actions/utils.go1
51:5nil-error-return
models/actions/utils.go:51:5
if errors.Is(err, io.EOF) { return nil }models/asymkey/gpg_key_commit_verification.go1
74:3nil-value-with-nil-error
models/asymkey/gpg_key_commit_verification.go:74:3
if err != nil { return nil, nil //nolint:nilnil // verification failed, not an error }modules/git/blame_sha256_test.go1
54:4no-defer-in-loop
modules/git/blame_sha256_test.go:54:4
assert.NotNil(t, blameReader) defer blameReader.Close()cmd/embedded.go1
256:4no-else-after-return
cmd/embedded.go:256:4
return fmt.Errorf("%s already exists, but it's not a regular file", dest) } else if rename { if err := os.Rename(dest, dest+".bak"); err != nil {models/actions/run_attempt.go1
45:6no-init
models/actions/run_attempt.go:45:6
func init() { db.RegisterModel(new(ActionRunAttempt))build/generate-go-licenses.go1
28:5no-package-var
build/generate-go-licenses.go:28:5
// LICENSE.docs), only the primary files are kept.var primaryLicenseRe = regexp.MustCompile(`^(?i)(LICEN[SC]E|COPYING)$`)models/unittest/fixtures.go1
135:4overwritten-before-use
models/unittest/fixtures.go:135:4
if util.AsciiEqualFold(cmdPart, "TABLE") { cmdPart, cmdRemaining, _ = cutSpaceForSQL(cmdRemaining) }build/generate-openapi.go1
17:9package-comments
build/generate-openapi.go:17:9
package mainmodelmigration/v1_10/v90.go2
4:9package-directory-mismatch
modelmigration/v1_10/v90.go:4:9
package v1_104:9package-naming
modelmigration/v1_10/v90.go:4:9
package v1_10cmd/admin_auth_ldap_test.go2
1308:14range-value-address
cmd/admin_auth_ldap_test.go:1308:14
var updatedAuthSource *auth.Source service := &authService{ initDB: func(context.Context) error {334:24redundant-conversion
cmd/admin_auth_ldap_test.go:334:24
Port: 123, SecurityProtocol: ldap.SecurityProtocol(0), UserDN: "cn=%s,ou=Users,dc=min-domain-simple,dc=org",modules/session/virtual.go1
16:2redundant-import-alias
modules/session/virtual.go:16:2
mysql "gitea.com/go-chi/session/mysql" postgres "gitea.com/go-chi/session/postgres")modules/session/redis.go1
113:3single-case-switch
modules/session/redis.go:113:3
for k, v := range uri.Query() { switch k { case "prefix":models/auth/oauth2.go1
91:6slice-preallocation
models/auth/oauth2.go:91:6
builtinApps := BuiltinApplications() var builtinAllClientIDs []string for clientID := range builtinApps {cmd/web.go1
243:2task-comment
cmd/web.go:243:2
mux.Handle("/debug/fgprof", fgprof.Handler()) // FIXME: it should use a proper context _, _, finished := process.GetManager().AddTypedContext(context.TODO(), "Web: PProf Server", process.SystemProcessType, true)cmd/embedded.go1
102:1top-level-declaration-order
cmd/embedded.go:102:1
type assetFile struct { fs *assetfs.LayeredFScmd/admin_auth_oauth.go1
229:28unchecked-type-assertion
cmd/admin_auth_oauth.go:229:28
oAuth2Config := source.Cfg.(*oauth2.Source)tests/integration/api_repo_collaborator_test.go1
96:3unexported-naming
tests/integration/api_repo_collaborator_test.go:96:3
_session := loginUser(t, user5.Name) _testCtx := NewAPITestContext(t, user5.Name, repo2.Name, auth_model.AccessTokenScopeReadRepository)services/actions/notifier_helper.go1
92:47unexported-return
services/actions/notifier_helper.go:92:47
func (input *notifyInput) WithRef(ref string) *notifyInput { input.Ref = git.RefName(ref)cmd/migrate_storage.go1
230:3unreachable-code
cmd/migrate_storage.go:230:3
log.Fatal("Failed to initialize ORM engine: %v", err) return err }cmd/hook.go1
300:39unused-parameter
cmd/hook.go:300:39
// invoked for every ref update which does not like pre-receive and post-receivefunc runHookUpdate(_ context.Context, c *cli.Command) error { if isInternal, _ := strconv.ParseBool(os.Getenv(repo_module.EnvIsInternal)); isInternal {modelmigration/v1_23/v308.go1
32:7unused-receiver
modelmigration/v1_23/v308.go:32:7
func (a *improveActionTableIndicesAction) TableIndices() []*schemas.Index { repoIndex := schemas.NewIndex("r_u_d", schemas.IndexType)cmd/serv.go1
182:3use-fmt-print
cmd/serv.go:182:3
} println("If this is unexpected, please log in with password and setup Gitea under another user.") return nilmodelmigration/v1_20/v259_test.go1
102:2use-slices-sort
modelmigration/v1_20/v259_test.go:102:2
// sort the tokens (insertion order by auto-incrementing primary key) sort.Slice(tokens, func(i, j int) bool { return tokens[i].ID < tokens[j].IDmodules/glob/glob_test.go1
21:2var-naming
modules/glob/glob_test.go:21:2
fixture_all_match = "my cat has very bright eyes" fixture_all_mismatch = "my dog has very bright eyes"models/avatars/avatar.go1
95:7weak-cryptography
models/avatars/avatar.go:95:7
func HashEmail(email string) string { m := md5.New() _, _ = m.Write([]byte(strings.ToLower(strings.TrimSpace(email))))build/openapi3gen/convert_test.go1
60:20add-constant
build/openapi3gen/convert_test.go:60:20
Type: &openapi3.Types{"string"}, Enum: []any{"red", "green", "blue"}, }},routers/api/v1/api.go1
332:6boolean-literal-comparison
routers/api/v1/api.go:332:6
scope, scopeExists := ctx.Data["ApiTokenScope"].(auth_model.AccessTokenScope) if ctx.Data["IsApiToken"] != true || !scopeExists { returnbuild/openapi3gen/convert.go1
54:6cognitive-complexity
build/openapi3gen/convert.go:54:6
func fixFileSchemas(doc *openapi3.T) { for _, pathItem := range doc.Paths.Map() {models/asymkey/gpg_key_add.go1
69:6confusing-naming
models/asymkey/gpg_key_add.go:69:6
// AddGPGKey adds new public key to database.func AddGPGKey(ctx context.Context, ownerID int64, content, token, signature string) ([]*GPGKey, error) { ekeys, err := CheckArmoredGPGKeyString(content)models/db/conn.go1
168:47confusing-results
models/db/conn.go:168:47
// parseMSSQLHostPort splits the host into host and portfunc parseMSSQLHostPort(info string) (string, string) { // the default port "0" might be related to MSSQL's dynamic port, maybe it should be double-confirmed in the futuremodules/indexer/code/internal/indexer.go1
36:6constructor-interface-return
modules/indexer/code/internal/indexer.go:36:6
// NewDummyIndexer returns a dummy indexerfunc NewDummyIndexer() Indexer { return &dummyIndexer{modules/git/catfile_batch_command.go1
18:2context-stored-in-struct
modules/git/catfile_batch_command.go:18:2
type catFileBatchCommand struct { ctx context.Context repo RepositoryFacadebuild/openapi3gen/convert.go1
322:6cyclomatic-complexity
build/openapi3gen/convert.go:322:6
// astEnumMap. Returns "" if extraction is inconclusive.func extractEnumTypeName(s *openapi3.Schema, astEnumMap map[string][]string) string { if s == nil || s.Extensions == nil {cmd/dump_repo.go1
188:3deep-exit
cmd/dump_repo.go:188:3
); err != nil { log.Fatal("Failed to dump repository: %v", err) return errmodules/storage/minio_test.go1
114:13deprecated-api-usage
modules/storage/minio_test.go:114:13
creds := buildMinioCredentials(cfg) v, err := creds.Get()cmd/admin_user_change_password.go1
76:2discarded-error-result
cmd/admin_user_change_password.go:76:2
fmt.Printf("%s's password has been successfully updated!\n", user.Name) return nilmain.go1
29:26doc-comment-period
main.go:29:26
var ( Version = "development" // program version for this build Tags = "" // the Golang build tagsmodels/packages/descriptor.go1
136:3early-return
models/packages/descriptor.go:136:3
if err != nil { if errors.Is(err, util.ErrNotExist) { creator = user_model.NewGhostUser()cmd/keys.go1
58:21error-strings
cmd/keys.go:58:21
if !c.IsSet("username") { return errors.New("No username provided") }models/asymkey/error.go1
72:6error-type-naming
models/asymkey/error.go:72:6
// ErrKeyNameAlreadyUsed represents a "KeyNameAlreadyUsed" kind of error.type ErrKeyNameAlreadyUsed struct { OwnerID int64modules/git/parse_treeentry_test.go1
130:2excessive-blank-identifiers
modules/git/parse_treeentry_test.go:130:2
_, _, _, n, err = ParseCatFileTreeLine(Sha1ObjectFormat, buf) assert.ErrorIs(t, err, io.EOF)cmd/helper.go1
115:6exported-declaration-comment
cmd/helper.go:115:6
// Any log appears in git stdout pipe will break the git protocol, eg: client can't push and hangs forever.func PrepareConsoleLoggerLevel(defaultLevel log.Level) func(context.Context, *cli.Command) (context.Context, error) { return func(ctx context.Context, c *cli.Command) (context.Context, error) {models/actions/task.go1
1:1file-length-limit
models/actions/task.go:1:1
// Copyright 2022 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MITcmd/web.go1
322:29flag-parameter
cmd/web.go:322:29
func listen(m http.Handler, handleRedirector bool) error { listenAddr := setting.HTTPAddrbuild/openapi3gen/enumscan.go1
1:1format
build/openapi3gen/enumscan.go:1:1
// Copyright 2026 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MIT- Fix (safe): run `strider fmt build/openapi3gen/enumscan.go`
cmd/admin_auth_ldap_test.go1
18:6function-length
cmd/admin_auth_ldap_test.go:18:6
func TestAddLdapBindDn(t *testing.T) { // Mock cli functions to do not exit on errormodules/git/catfile_batch_reader.go1
186:6function-result-limit
modules/git/catfile_batch_reader.go:186:6
// <mode-in-ascii-dropping-initial-zeros> SP <name> NUL <binary-hash>func ParseCatFileTreeLine(objectFormat ObjectFormat, rd BufferedReader) (mode EntryMode, name string, objID ObjectID, n int, err error) { // use the in-buffer memory as much as possible to avoid extra allocationsrouters/api/packages/alpine/alpine.go1
63:6get-function-return-value
routers/api/packages/alpine/alpine.go:63:6
func GetRepositoryFile(ctx *context.Context) { pv, err := alpine_service.GetOrCreateRepositoryVersion(ctx, ctx.Package.Owner.ID)models/auth/access_token_scope.go1
232:2identical-switch-branches
models/auth/access_token_scope.go:232:2
return Write default: return NoAccesscmd/admin_auth_oauth_test.go1
10:2import-alias-naming
cmd/admin_auth_oauth_test.go:10:2
auth_model "gitea.dev/models/auth" "gitea.dev/services/auth/source/oauth2"cmd/cmdtest/cmd_test.go1
208:65import-shadowing
cmd/cmdtest/cmd_test.go:208:65
app = newTestApp(cli.Command{Action: func(ctx context.Context, cmd *cli.Command) error { return nil }}) r, err = runTestApp(app, "./gitea", "test-cmd")models/issues/issue_update.go1
658:8inefficient-map-lookup
models/issues/issue_update.go:658:8
users = append(users, user) resolved[user.LowerName] = true }models/auth/oauth2_test.go1
89:32insecure-url-scheme
models/auth/oauth2_test.go:89:32
app := &auth_model.OAuth2Application{ RedirectURIs: []string{"http://127.0.0.1/", "http://::1/", "http://192.168.0.1/", "http://intranet/", "https://127.0.0.1/"}, ConfidentialClient: false,modules/migration/uploader.go1
10:15interface-method-limit
modules/migration/uploader.go:10:15
// Uploader uploads all the information of one repositorytype Uploader interface { MaxBatchInsertSize(tp string) intmodels/issues/pull.go1
964:4max-control-nesting
models/issues/pull.go:964:4
} else if string(char) == " " { if len(token) > 0 { tokens = append(tokens, token)tests/integration/api_packages_conan_test.go1
158:6max-parameters
tests/integration/api_packages_conan_test.go:158:6
func uploadConanPackageV2(t *testing.T, baseURL, token, name, version, user, channel, recipeRevision, packageRevision string) { type fileList struct {modelmigration/v1_11/v111.go1
120:7max-public-structs
modelmigration/v1_11/v111.go:120:7
type TeamUnit struct { ID int64 `xorm:"pk autoincr"`cmd/admin_auth_ldap.go1
236:3modifies-parameter
cmd/admin_auth_ldap.go:236:3
if c.IsSet("not-active") { authSource.IsActive = !c.Bool("not-active") }models/repo/repo_list.go1
43:2modifies-value-receiver
models/repo/repo_list.go:43:2
func (repos RepositoryList) Swap(i, j int) { repos[i], repos[j] = repos[j], repos[i]}cmd/admin_auth_oauth_test.go1
160:17nested-structs
cmd/admin_auth_oauth_test.go:160:17
func TestUpdateOauth(t *testing.T) { testCases := []struct { name stringmodels/activities/notification.go1
352:3nil-error-return
models/activities/notification.go:352:3
if err != nil { return nil }models/asymkey/gpg_key_commit_verification.go1
90:2nil-value-with-nil-error
models/asymkey/gpg_key_commit_verification.go:90:2
} return nil, nil //nolint:nilnil // verification failed, not an error}modules/git/blame_sha256_test.go1
139:4no-defer-in-loop
modules/git/blame_sha256_test.go:139:4
assert.NotNil(t, blameReader) defer blameReader.Close()cmd/generate.go1
154:4no-else-after-return
cmd/generate.go:154:4
return err } else if !info.IsDir() { return errors.New("file already exists and is not a directory")models/actions/run_job.go1
131:6no-init
models/actions/run_job.go:131:6
func init() { db.RegisterModel(new(ActionRunJob))build/generate-go-licenses.go1
31:5no-package-var
build/generate-go-licenses.go:31:5
// ignoredNames are LicenseEntry.Name values to exclude from the output.var ignoredNames = map[string]bool{ "gitea.dev": true,routers/web/repo/view.go1
317:4overwritten-before-use
routers/web/repo/view.go:317:4
log.Debug("first call to get directory file commit info") clearFilesCommitInfo := func() { log.Warn("clear directory file commit info to force async loading on frontend")build/openapi3gen/convert.go1
4:9package-comments
build/openapi3gen/convert.go:4:9
package openapi3genmodelmigration/v1_10/v91.go2
4:9package-directory-mismatch
modelmigration/v1_10/v91.go:4:9
package v1_104:9package-naming
modelmigration/v1_10/v91.go:4:9
package v1_10cmd/admin_auth_ldap_test.go2
1308:14range-value-address
cmd/admin_auth_ldap_test.go:1308:14
var updatedAuthSource *auth.Source service := &authService{ initDB: func(context.Context) error {549:29redundant-conversion
cmd/admin_auth_ldap_test.go:549:29
Port: 9876, SecurityProtocol: ldap.SecurityProtocol(1), SkipVerify: true,routers/web/repo/actions/actions_test.go1
15:2redundant-import-alias
routers/web/repo/actions/actions_test.go:15:2
repo_model "gitea.dev/models/repo" unittest "gitea.dev/models/unittest" "gitea.dev/modules/setting"modules/structs/task.go1
13:2single-case-switch
modules/structs/task.go:13:2
func (taskType TaskType) Name() string { switch taskType { case TaskTypeMigrateRepo:models/db/engine_dump.go1
14:6slice-preallocation
models/db/engine_dump.go:14:6
func DumpDatabase(filePath string, dbType setting.DatabaseType) error { var tbs []*schemas.Table for _, t := range registeredModels {cmd/web_acme.go1
47:2task-comment
cmd/web_acme.go:47:2
// Due to docker port mapping this can't be checked programmatically // TODO: these are placeholders until we add options for each in settings with appropriate warning enableHTTPChallenge := truecmd/hook.go1
104:1top-level-declaration-order
cmd/hook.go:104:1
type delayWriter struct { internal io.Writercmd/admin_auth_smtp.go1
183:26unchecked-type-assertion
cmd/admin_auth_smtp.go:183:26
smtpConfig := source.Cfg.(*smtp.Source)tests/integration/api_repo_collaborator_test.go1
122:3unexported-naming
tests/integration/api_repo_collaborator_test.go:122:3
_session := loginUser(t, user5.Name) _testCtx := NewAPITestContext(t, user5.Name, repo2.Name, auth_model.AccessTokenScopeReadRepository)services/actions/notifier_helper.go1
97:62unexported-return
services/actions/notifier_helper.go:97:62
func (input *notifyInput) WithPayload(payload api.Payloader) *notifyInput { input.Payload = payloadcmd/migrate_storage.go1
246:4unreachable-code
cmd/migrate_storage.go:246:4
log.Fatal("Path must be given when storage is local") return nil }cmd/migrate.go1
26:38unused-parameter
cmd/migrate.go:26:38
func runMigrate(ctx context.Context, c *cli.Command) error { if err := initDB(ctx); err != nil {modelmigration/v1_24/v317.go1
33:7unused-receiver
modelmigration/v1_24/v317.go:33:7
// TableIndices implements xorm's TableIndices interfacefunc (a *improveActionTableIndicesAction) TableIndices() []*schemas.Index { repoIndex := schemas.NewIndex("r_u_d", schemas.IndexType)modules/git/diff_test.go1
175:2use-fmt-print
modules/git/diff_test.go:175:2
result, _ := CutDiffAroundLine(strings.NewReader(diff), 4, false, 3) println(result)}models/activities/repo_activity.go1
136:2use-slices-sort
models/activities/repo_activity.go:136:2
sort.Slice(v, func(i, j int) bool { return v[i].Commits > v[j].Commitsmodules/glob/glob_test.go1
23:2var-naming
modules/glob/glob_test.go:23:2
pattern_plain = "google.com" regexp_plain = `^google\.com$`models/git/commit_status.go1
544:27weak-cryptography
models/git/commit_status.go:544:27
func HashCommitStatusContext(context string) string { return fmt.Sprintf("%x", sha1.Sum([]byte(context)))}build/openapi3gen/convert_test.go1
60:27add-constant
build/openapi3gen/convert_test.go:60:27
Type: &openapi3.Types{"string"}, Enum: []any{"red", "green", "blue"}, }},routers/api/v1/repo/release.go1
26:5boolean-literal-comparison
routers/api/v1/repo/release.go:26:5
} if ctx.Data["IsApiToken"] != true { // not API token request, the request is from a user session with write accessbuild/openapi3gen/convert.go1
112:6cognitive-complexity
build/openapi3gen/convert.go:112:6
// for code generators.func addURIFormats(doc *openapi3.T) { if doc.Components == nil {models/asymkey/ssh_key_deploy.go1
109:6confusing-naming
models/asymkey/ssh_key_deploy.go:109:6
// AddDeployKey add new deploy key to database and authorized_keys file.func AddDeployKey(ctx context.Context, repoID int64, name, content string, readOnly bool) (*DeployKey, error) { fingerprint, err := CalcFingerprint(content)models/db/driver_sqlite_mattn.go1
20:68confusing-results
models/db/driver_sqlite_mattn.go:20:68
func makeSQLiteConnStrMattnCGO(opts SQLiteConnStrOptions) (string, string, error) { var params []stringmodules/indexer/internal/indexer.go1
23:6constructor-interface-return
modules/indexer/internal/indexer.go:23:6
// NewDummyIndexer returns a dummy indexerfunc NewDummyIndexer() Indexer { return &dummyIndexer{}modules/git/catfile_batch_legacy.go1
20:2context-stored-in-struct
modules/git/catfile_batch_legacy.go:20:2
type catFileBatchLegacy struct { ctx context.Context repo RepositoryFacadebuild/openapi3gen/convert_test.go1
76:6cyclomatic-complexity
build/openapi3gen/convert_test.go:76:6
func TestFixFileSchemas_recursesIntoNested(t *testing.T) { fileType := func() *openapi3.SchemaRef {cmd/helper.go1
58:3deep-exit
cmd/helper.go:58:3
if setting.Database.Type == "" { log.Fatal(`Database settings are missing from the configuration file: %q.Ensure you are running in the correct environment or set the correct configuration file with -c.modules/storage/minio_test.go1
131:14deprecated-api-usage
modules/storage/minio_test.go:131:14
creds := buildMinioCredentials(cfg) v, err := creds.Get()cmd/admin_user_create.go1
155:3discarded-error-result
cmd/admin_user_create.go:155:3
// codeql[disable-next-line=go/clear-text-logging] fmt.Printf("generated random password is '%s'\n", password) } else if userType == user_model.UserTypeIndividual {modelmigration/base/db.go1
28:1doc-comment-period
modelmigration/base/db.go:28:1
// RecreateTables will recreate the tables for the provided beans using the newly provided bean definition and move all data to that new table// WARNING: YOU MUST PROVIDE THE FULL BEAN DEFINITIONfunc RecreateTables(beans ...any) func(EngineMigration) error {models/repo/release.go1
118:4early-return
models/repo/release.go:118:4
if err != nil { if user_model.IsErrUserNotExist(err) { r.Publisher = user_model.NewGhostUser()cmd/keys.go1
72:21error-strings
cmd/keys.go:72:21
if content == "" { return errors.New("No key type and content provided") }models/asymkey/error.go1
92:6error-type-naming
models/asymkey/error.go:92:6
// ErrGPGNoEmailFound represents a "ErrGPGNoEmailFound" kind of error.type ErrGPGNoEmailFound struct { FailedEmails []stringmodules/log/init.go1
18:2excessive-blank-identifiers
modules/log/init.go:18:2
func init() { _, filename, _, _ := runtime.Caller(0) projectPackagePrefix = strings.TrimSuffix(filename, "modules/log/init.go")cmd/hook.go1
136:23exported-declaration-comment
cmd/hook.go:136:23
func (d *delayWriter) WriteString(s string) (n int, err error) { if d.buf != nil {models/activities/action.go1
1:1file-length-limit
models/activities/action.go:1:1
// Copyright 2014 The Gogs Authors. All rights reserved.// Copyright 2019 The Gitea Authors. All rights reserved.modelmigration/v1_27/v331_test.go1
146:76flag-parameter
modelmigration/v1_27/v331_test.go:146:76
func hasIndexWithColumns(indexes map[string]*schemas.Index, cols []string, isUnique bool) bool { for _, index := range indexes {build/openapi3gen/enumscan_test.go1
1:1format
build/openapi3gen/enumscan_test.go:1:1
// Copyright 2026 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MIT- Fix (safe): run `strider fmt build/openapi3gen/enumscan_test.go`
cmd/admin_auth_ldap_test.go1
257:6function-length
cmd/admin_auth_ldap_test.go:257:6
func TestAddLdapSimpleAuth(t *testing.T) { // Mock cli functions to do not exit on errormodules/git/diff.go1
107:6function-result-limit
modules/git/diff.go:107:6
// ParseDiffHunkString parse the diff hunk content and returnfunc ParseDiffHunkString(diffHunk string) (leftLine, leftHunk, rightLine, rightHunk int) { ss := strings.Split(diffHunk, "@@")routers/api/packages/arch/arch.go1
31:6get-function-return-value
routers/api/packages/arch/arch.go:31:6
func GetRepositoryKey(ctx *context.Context) { _, pub, err := arch_service.GetOrCreateKeyPair(ctx, ctx.Package.Owner.ID)models/issues/review.go1
117:2identical-switch-branches
models/issues/review.go:117:2
return "dot-fill" default: return "comment"cmd/admin_auth_smtp.go1
11:2import-alias-naming
cmd/admin_auth_smtp.go:11:2
auth_model "gitea.dev/models/auth" "gitea.dev/modules/util"cmd/cmdtest/cmd_test.go1
226:37import-shadowing
cmd/cmdtest/cmd_test.go:226:37
}, Action: func(ctx context.Context, cmd *cli.Command) error { configValues["action"] = setting.CustomConfmodules/assetfs/layered.go1
100:5inefficient-map-lookup
modules/assetfs/layered.go:100:5
if _, exist := filesMap[entryName]; !exist && shouldInclude(entry) { filesMap[entryName] = entry }models/auth/oauth2_test.go1
89:53insecure-url-scheme
models/auth/oauth2_test.go:89:53
app := &auth_model.OAuth2Application{ RedirectURIs: []string{"http://127.0.0.1/", "http://::1/", "http://192.168.0.1/", "http://intranet/", "https://127.0.0.1/"}, ConfidentialClient: false,modules/setting/config_provider.go1
21:16interface-method-limit
modules/setting/config_provider.go:21:16
type ConfigKey interface { Name() stringmodels/repo/repo_list_test.go1
409:8max-control-nesting
models/repo/repo_list_test.go:409:8
if testCase.opts.Collaborate.Has() { if testCase.opts.Collaborate.Value() { assert.NotEqual(t, testCase.opts.OwnerID, repo.Owner.ID)tests/integration/api_team_test.go1
233:6max-parameters
tests/integration/api_team_test.go:233:6
func checkTeamResponse(t *testing.T, testName string, apiTeam *api.Team, name, description string, includesAllRepositories bool, permission api.AccessLevelName, units []string, unitsMap map[string]string) { t.Run(testName, func(t *testing.T) {modelmigration/v1_11/v111.go1
128:7max-public-structs
modelmigration/v1_11/v111.go:128:7
// Team represents a organization team. type Team struct { ID int64 `xorm:"pk autoincr"`cmd/admin_auth_ldap.go1
239:3modifies-parameter
cmd/admin_auth_ldap.go:239:3
if c.IsSet("active") { authSource.IsActive = c.Bool("active") }models/repo/repo_list.go1
43:12modifies-value-receiver
models/repo/repo_list.go:43:12
func (repos RepositoryList) Swap(i, j int) { repos[i], repos[j] = repos[j], repos[i]}cmd/admin_auth_smtp_test.go1
18:17nested-structs
cmd/admin_auth_smtp_test.go:18:17
func TestAddSMTP(t *testing.T) { testCases := []struct { name stringmodels/asymkey/gpg_key.go1
226:4nil-error-return
models/asymkey/gpg_key.go:226:4
if IsErrGPGKeyNotExist(err) { return nil }models/auth/oauth2.go1
228:3nil-value-with-nil-error
models/auth/oauth2.go:228:3
} else if !has { return nil, nil //nolint:nilnil // return nil to indicate that the object does not exist }modules/git/blame_test.go1
48:4no-defer-in-loop
modules/git/blame_test.go:48:4
assert.NotNil(t, blameReader) defer blameReader.Close()cmd/serv.go1
184:4no-else-after-return
cmd/serv.go:184:4
return nil } else if c.Bool("debug") { log.Debug("SSH_ORIGINAL_COMMAND: %s", os.Getenv("SSH_ORIGINAL_COMMAND"))models/actions/run_job_summary.go1
56:6no-init
models/actions/run_job_summary.go:56:6
func init() { db.RegisterModel(new(ActionRunJobSummary))build/generate-go-licenses.go1
36:5no-package-var
build/generate-go-licenses.go:36:5
var excludedExt = map[string]bool{ ".gitignore": true,tests/integration/migration-test/migration_test.go1
103:2overwritten-before-use
tests/integration/migration-test/migration_test.go:103:2
cleanup, err := unittest.ResetTestDatabase() require.NoError(t, err)cmd/actions.go1
4:9package-comments
cmd/actions.go:4:9
package cmdmodelmigration/v1_10/v92.go2
4:9package-directory-mismatch
modelmigration/v1_10/v92.go:4:9
package v1_104:9package-naming
modelmigration/v1_10/v92.go:4:9
package v1_10cmd/admin_auth_oauth_test.go1
304:9range-value-address
cmd/admin_auth_oauth_test.go:304:9
t.Run(tc.name, func(t *testing.T) { a := &authService{ initDB: func(ctx context.Context) error {cmd/admin_auth_ldap_test.go1
630:24redundant-conversion
cmd/admin_auth_ldap_test.go:630:24
Cfg: &ldap.Source{ SecurityProtocol: ldap.SecurityProtocol(1), },services/convert/action_test.go1
12:2redundant-import-alias
services/convert/action_test.go:12:2
actions_model "gitea.dev/models/actions" db "gitea.dev/models/db" repo_model "gitea.dev/models/repo"services/mailer/incoming/incoming_handler.go1
166:2single-case-switch
services/mailer/incoming/incoming_handler.go:166:2
switch r := ref.(type) { case *issues_model.Issue:models/git/protected_branch_list_test.go1
62:7slice-preallocation
models/git/protected_branch_list_test.go:62:7
for _, kase := range kases { var pbs ProtectedBranchRules for _, rule := range kase.Rules {cmd/web_acme.go1
69:2task-comment
cmd/web_acme.go:69:2
} // FIXME: this path is not right, it uses "AppWorkPath" incorrectly, and writes the data into "AppWorkPath/https" // Ideally it should migrate to AppDataPath write to "AppDataPath/https"cmd/main.go1
82:1top-level-declaration-order
cmd/main.go:82:1
type AppVersion struct { Version stringmodelmigration/migrations.go1
56:18unchecked-type-assertion
modelmigration/migrations.go:56:18
m.migrate = func(ctx context.Context, x base.EngineMigration) error { return any(fn).(func(base.EngineMigration) error)(x) }tests/integration/api_repo_collaborator_test.go1
123:3unexported-naming
tests/integration/api_repo_collaborator_test.go:123:3
_session := loginUser(t, user5.Name) _testCtx := NewAPITestContext(t, user5.Name, repo2.Name, auth_model.AccessTokenScopeReadRepository)services/actions/notifier_helper.go1
102:73unexported-return
services/actions/notifier_helper.go:102:73
func (input *notifyInput) WithPullRequest(pr *issues_model.PullRequest) *notifyInput { input.PullRequest = prmodelmigration/migrations.go2
523:3unreachable-code
modelmigration/migrations.go:523:3
Please try upgrading to a lower version first (suggested v1.6.4), then upgrade to this version.`) return nil }462:21unused-parameter
modelmigration/migrations.go:462:21
// EnsureUpToDate will check if the db is at the correct versionfunc EnsureUpToDate(ctx context.Context, x base.EngineMigration) error { currentDB, err := GetCurrentDBVersion(x)modelmigration/v1_26/v329.go1
21:7unused-receiver
modelmigration/v1_26/v329.go:21:7
// TableIndices implements xorm's TableIndices interfacefunc (n *UserBadge) TableIndices() []*schemas.Index { indices := make([]*schemas.Index, 0, 1)models/git/protected_branch_list.go1
27:2use-slices-sort
models/git/protected_branch_list.go:27:2
func (rules ProtectedBranchRules) sort() { sort.Slice(rules, func(i, j int) bool { rules[i].loadGlob()modules/glob/glob_test.go1
24:2var-naming
modules/glob/glob_test.go:24:2
pattern_plain = "google.com" regexp_plain = `^google\.com$` fixture_plain_match = "google.com"modules/auth/password/pwn/pwn.go1
80:9weak-cryptography
modules/auth/password/pwn/pwn.go:80:9
sha := sha1.New() sha.Write([]byte(pw))build/openapi3gen/convert_test.go1
60:36add-constant
build/openapi3gen/convert_test.go:60:36
Type: &openapi3.Types{"string"}, Enum: []any{"red", "green", "blue"}, }},routers/api/v1/user/app.go1
130:5boolean-literal-comparison
routers/api/v1/user/app.go:130:5
// a token-authenticated request must not mint a token with a broader scope than its own if ctx.Data["IsApiToken"] == true { apiTokenScope, ok := ctx.Data["ApiTokenScope"].(auth_model.AccessTokenScope)build/openapi3gen/convert.go1
149:6cognitive-complexity
build/openapi3gen/convert.go:149:6
// or "deprecated (use X instead)"). Does not match negated phrases.func addDeprecatedFlags(doc *openapi3.T) { if doc.Components == nil {models/auth/oauth2.go1
89:6confusing-naming
models/auth/oauth2.go:89:6
func Init(ctx context.Context) error { builtinApps := BuiltinApplications()models/db/driver_sqlite_modernc.go1
28:71confusing-results
models/db/driver_sqlite_modernc.go:28:71
func makeSQLiteConnStrModerncCCGO(opts SQLiteConnStrOptions) (string, string, error) { var params []stringmodules/indexer/issues/internal/indexer.go1
24:6constructor-interface-return
modules/indexer/issues/internal/indexer.go:24:6
// NewDummyIndexer returns a dummy indexerfunc NewDummyIndexer() Indexer { return &dummyIndexer{modules/git/gitcmd/command.go1
50:2context-stored-in-struct
modules/git/gitcmd/command.go:50:2
cmdCtx context.Context cmdCancel process.CancelCauseFuncbuild/openapi3gen/enumscan.go1
46:6cyclomatic-complexity
build/openapi3gen/enumscan.go:46:6
// constants can't be extracted.func ScanSwaggerEnumTypes(dirs []string) (map[string][]string, error) { fset := token.NewFileSet()cmd/hook.go1
312:3deep-exit
cmd/hook.go:312:3
// ignore update to refs/pull/xxx/head, so we don't need to output any information os.Exit(1) }modules/storage/minio_test.go1
143:14deprecated-api-usage
modules/storage/minio_test.go:143:14
creds := buildMinioCredentials(cfg) v, err := creds.Get()cmd/admin_user_create.go1
231:2discarded-error-result
cmd/admin_user_create.go:231:2
} fmt.Printf("New user '%s' has been successfully created!\n", username)modelmigration/base/db.go1
49:1doc-comment-period
modelmigration/base/db.go:49:1
// WARNING: YOU MUST PROVIDE THE FULL BEAN DEFINITION// WARNING: YOU MUST COMMIT THE SESSION AT THE ENDfunc RecreateTable(sess Session, bean any) error {models/unittest/fscopy.go1
75:4early-return
models/unittest/fscopy.go:75:4
if _, err = os.Stat(filepath.Join(srcPath, destFile)); err != nil { if os.IsNotExist(err) { shouldRemove = truemodelmigration/base/db_test.go1
61:13error-strings
modelmigration/base/db_test.go:61:13
sess.Close() t.Errorf("Unable to drop columns[%d:]: %s from drop_test: %v", i, columns[i:], err) returnmodels/asymkey/error.go1
108:6error-type-naming
models/asymkey/error.go:108:6
// ErrGPGInvalidTokenSignature represents a "ErrGPGInvalidTokenSignature" kind of error.type ErrGPGInvalidTokenSignature struct { Wrapped errormodules/setting/config_env_test.go1
77:2excessive-blank-identifiers
modules/setting/config_env_test.go:77:2
ok, _, _, _ = decodeEnvironmentKey("PREFIX__", "", "PREFIX__SEC__KEY") assert.True(t, ok)cmd/hook.go1
153:23exported-declaration-comment
cmd/hook.go:153:23
func (d *delayWriter) Close() error { stopped := d.timer.Stop()models/auth/oauth2.go1
1:1file-length-limit
models/auth/oauth2.go:1:1
// Copyright 2019 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MITmodels/actions/run_job_list.go1
64:57flag-parameter
models/actions/run_job_list.go:64:57
func (jobs ActionJobList) LoadRuns(ctx context.Context, withRepo bool) error { if withRepo {cmd/actions.go1
1:1format
cmd/actions.go:1:1
// Copyright 2023 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MIT- Fix (safe): run `strider fmt cmd/actions.go`
cmd/admin_auth_ldap_test.go1
487:6function-length
cmd/admin_auth_ldap_test.go:487:6
func TestUpdateLdapBindDn(t *testing.T) { // Mock cli functions to do not exit on errormodules/git/diff2.go1
18:6function-result-limit
modules/git/diff2.go:18:6
// TODO: it can be merged with another "GetDiffShortStat" in the futurefunc GetDiffShortStatByCmdArgs(ctx context.Context, repo RepositoryFacade, trustedArgs gitcmd.TrustedCmdArgs, dynamicArgs ...string) (numFiles, totalAdditions, totalDeletions int, err error) { // Now if we call:routers/api/packages/arch/arch.go1
168:6get-function-return-value
routers/api/packages/arch/arch.go:168:6
func GetPackageOrRepositoryFile(ctx *context.Context) { repository := ctx.PathParam("repository")models/unittest/fixtures.go1
117:2identical-switch-branches
models/unittest/fixtures.go:117:2
fixturesLoader.MarkTableChanged(trimTableNameQuotes(cmdPart)) case util.AsciiEqualFold(cmdPart, "MERGE"): cmdPart, cmdRemaining, _ = cutSpaceForSQL(cmdRemaining)cmd/admin_auth_smtp_test.go1
10:2import-alias-naming
cmd/admin_auth_smtp_test.go:10:2
auth_model "gitea.dev/models/auth" "gitea.dev/services/auth/source/smtp"cmd/cmdtest/cmd_test.go1
241:37import-shadowing
cmd/cmdtest/cmd_test.go:241:37
app := newTestApp(cli.Command{ Action: func(ctx context.Context, cmd *cli.Command) error { return nil }, })modules/container/set.go1
21:3inefficient-map-lookup
modules/container/set.go:21:3
if _, has := s[value]; !has { s[value] = struct{}{} return truemodels/auth/oauth2_test.go1
89:68insecure-url-scheme
models/auth/oauth2_test.go:89:68
app := &auth_model.OAuth2Application{ RedirectURIs: []string{"http://127.0.0.1/", "http://::1/", "http://192.168.0.1/", "http://intranet/", "https://127.0.0.1/"}, ConfidentialClient: false,services/actions/interface.go1
9:10interface-method-limit
services/actions/interface.go:9:10
// API for actions of a repository or organizationtype API interface { // ListActionsSecrets list secretsmodules/actions/jobparser/model.go1
394:7max-control-nesting
modules/actions/jobparser/model.go:394:7
vv, ok := tt.(map[string]any) if !ok { return nil, fmt.Errorf("unknown on type(schedule): %#v", v)tests/integration/pull_create_test.go1
114:6max-parameters
tests/integration/pull_create_test.go:114:6
func testPullCreateFailure(t *testing.T, session *TestSession, baseRepoOwner, baseRepoName, baseBranch, headRepoOwner, headRepoName, headBranch, title string) *httptest.ResponseRecorder { headCompare := headBranchmodelmigration/v1_17/v212.go1
83:7max-public-structs
modelmigration/v1_17/v212.go:83:7
type PackageBlobUpload struct { ID string `xorm:"pk"`cmd/admin_auth_ldap.go1
242:3modifies-parameter
cmd/admin_auth_ldap.go:242:3
if c.IsSet("synchronize-users") { authSource.IsSyncEnabled = c.Bool("synchronize-users") }models/repo/repo_list.go1
114:3modifies-value-receiver
models/repo/repo_list.go:114:3
for i := range repos { repos[i].Owner = users[repos[i].OwnerID] }cmd/admin_auth_smtp_test.go1
134:17nested-structs
cmd/admin_auth_smtp_test.go:134:17
func TestUpdateSMTP(t *testing.T) { testCases := []struct { name stringmodels/asymkey/gpg_key_commit_verification.go1
74:3nil-error-return
models/asymkey/gpg_key_commit_verification.go:74:3
if err != nil { return nil, nil //nolint:nilnil // verification failed, not an error }models/auth/oauth2.go1
476:3nil-value-with-nil-error
models/auth/oauth2.go:476:3
} else if !has { return nil, nil //nolint:nilnil // return nil to indicate that the object does not exist }modules/git/blame_test.go1
134:4no-defer-in-loop
modules/git/blame_test.go:134:4
assert.NotNil(t, blameReader) defer blameReader.Close()modelmigration/migrations.go1
508:4no-else-after-return
modelmigration/migrations.go:508:4
return fmt.Errorf("get: %w", err) } else if !has { // If the version record does not exist, it is a fresh installation, and we can skip all migrations.models/actions/runner.go1
207:6no-init
models/actions/runner.go:207:6
func init() { db.RegisterModel(&ActionRunner{})build/generate-openapi.go1
45:2no-package-var
build/generate-openapi.go:45:2
var ( appSubUrlRe = regexp.MustCompile(regexp.QuoteMeta(appSubUrlVar)) appVerRe = regexp.MustCompile(regexp.QuoteMeta(appVerVar))tests/test_utils.go1
41:2overwritten-before-use
tests/test_utils.go:41:2
setting.LoadDBSetting() cleanupDb, err := unittest.ResetTestDatabase() if err != nil {cmd/admin.go1
5:9package-comments
cmd/admin.go:5:9
package cmdmodelmigration/v1_10/v93.go2
4:9package-directory-mismatch
modelmigration/v1_10/v93.go:4:9
package v1_104:9package-naming
modelmigration/v1_10/v93.go:4:9
package v1_10cmd/admin_auth_smtp_test.go1
103:9range-value-address
cmd/admin_auth_smtp_test.go:103:9
t.Run(tc.name, func(t *testing.T) { a := &authService{ initDB: func(ctx context.Context) error {cmd/admin_auth_ldap_test.go1
1006:29redundant-conversion
cmd/admin_auth_ldap_test.go:1006:29
Port: 987, SecurityProtocol: ldap.SecurityProtocol(2), SkipVerify: true,services/doctor/dbconsistency.go1
9:2redundant-import-alias
services/doctor/dbconsistency.go:9:2
modelmigration "gitea.dev/modelmigration" actions_model "gitea.dev/models/actions"services/webhook/dingtalk.go1
125:2single-case-switch
services/webhook/dingtalk.go:125:2
var text, title string switch p.Action { case api.HookIssueReviewed:models/git/protected_branch_list_test.go1
100:6slice-preallocation
models/git/protected_branch_list_test.go:100:6
var got []string for i := range pbr {modelmigration/base/db.go1
51:2task-comment
modelmigration/base/db.go:51:2
func RecreateTable(sess Session, bean any) error { // TODO: This will not work if there are foreign keyscmd/web_https.go1
36:1top-level-declaration-order
cmd/web_https.go:36:1
var curveStringMap = map[string]tls.CurveID{ "x25519": tls.X25519,modelmigration/v1_14/v156.go1
110:100unchecked-type-assertion
modelmigration/v1_14/v156.go:110:100
if git.IsErrNotExist(err) { log.Warn("Unable to find commit %s for Tag: %s in [%d]%s/%s. Cannot update publisher ID.", err.(git.ErrNotExist).ID, release.TagName, repo.ID, repo.OwnerName, repo.Name) continuetests/integration/api_repo_collaborator_test.go1
138:3unexported-naming
tests/integration/api_repo_collaborator_test.go:138:3
_session := loginUser(t, user10.Name) _testCtx := NewAPITestContext(t, user10.Name, repo2.Name, auth_model.AccessTokenScopeReadRepository)modelmigration/migrations.go1
534:3unreachable-code
modelmigration/migrations.go:534:3
log.Fatal("Migration Error: %s", msg) return nil }modelmigration/v1_16/v207.go1
8:22unused-parameter
modelmigration/v1_16/v207.go:8:22
func AddWebAuthnCred(x base.EngineMigration) error { // NO-OP Don't migrate here - let v210 do this.models/actions/artifact.go1
156:7unused-receiver
models/actions/artifact.go:156:7
func (opts FindArtifactsOptions) ToOrders() string { return "id"models/issues/issue_pin.go1
205:2use-slices-sort
models/issues/issue_pin.go:205:2
} sort.Slice(issues, func(i, j int) bool { return issues[i].PinOrder < issues[j].PinOrdermodules/glob/glob_test.go1
25:2var-naming
modules/glob/glob_test.go:25:2
regexp_plain = `^google\.com$` fixture_plain_match = "google.com" fixture_plain_mismatch = "gobwas.com"modules/base/tool_test.go1
47:127weak-cryptography
modules/base/tool_test.go:47:127
time2000 := time.Date(2000, 1, 2, 3, 4, 5, 0, time.Local) assert.Equal(t, "2000010203040000026fa5221b2731b7cf80b1b506f5e39e38c115fee5", CreateTimeLimitCode("test-sha1", 2, time2000, sha1.New())) assert.Equal(t, "2000010203040000026fa5221b2731b7cf80b1b506f5e39e38c115fee5", CreateTimeLimitCode("test-sha1", 2, "200001020304", sha1.New()))build/openapi3gen/convert_test.go1
90:31add-constant
build/openapi3gen/convert_test.go:90:31
Schema: &openapi3.SchemaRef{Value: &openapi3.Schema{ Type: &openapi3.Types{"object"}, Properties: openapi3.Schemas{routers/web/goget.go1
130:5boolean-literal-comparison
routers/web/goget.go:130:5
func goGetTokenCanReadRepo(ctx *context.Context) bool { if ctx.Data["IsApiToken"] != true { return truebuild/openapi3gen/convert.go1
182:6cognitive-complexity
build/openapi3gen/convert.go:182:6
// with an actionable error ā there are no silent fallbacks.func extractSharedEnums(doc *openapi3.T, astEnumMap map[string][]string) error { if doc.Components == nil {models/auth/oauth2.go1
335:6confusing-naming
models/auth/oauth2.go:335:6
func updateOAuth2Application(ctx context.Context, app *OAuth2Application) error { if _, err := db.GetEngine(ctx).ID(app.ID).UseBool("confidential_client", "skip_secondary_authorization").Update(app); err != nil {models/unittest/fixtures.go1
67:40confusing-results
models/unittest/fixtures.go:67:40
func cutSpaceForSQL(s string) (string, string, bool) { s = strings.TrimSpace(s)modules/log/event_writer_conn.go1
25:6constructor-interface-return
modules/log/event_writer_conn.go:25:6
func NewEventWriterConn(writerName string, writerMode WriterMode) EventWriter { w := &eventWriterConn{EventWriterBaseImpl: NewEventWriterBase(writerName, "conn", writerMode)}modules/git/gitcmd/context.go1
21:2context-stored-in-struct
modules/git/gitcmd/context.go:21:2
type cmdContext struct { context.Context cmd *Commandcmd/admin.go1
104:6cyclomatic-complexity
cmd/admin.go:104:6
func runRepoSyncReleases(ctx context.Context, _ *cli.Command) error { if err := initDB(ctx); err != nil {cmd/migrate.go1
38:3deep-exit
cmd/migrate.go:38:3
if err := db.InitEngineWithMigration(context.Background(), versioned_migration.Migrate); err != nil { log.Fatal("Failed to initialize ORM engine: %v", err) return errmodules/storage/minio_test.go1
156:14deprecated-api-usage
modules/storage/minio_test.go:156:14
creds := buildMinioCredentials(cfg) v, err := creds.Get()cmd/admin_user_create.go1
239:3discarded-error-result
cmd/admin_user_create.go:239:3
} fmt.Printf("Access token was successfully created... %s\n", t.Token) }modelmigration/base/db.go1
312:1doc-comment-period
modelmigration/base/db.go:312:1
// WARNING: YOU MUST COMMIT THE SESSION AT THE ENDfunc DropTableColumns(sess Session, tableName string, columnNames ...string) (err error) {modules/actions/jobparser/evaluator.go1
165:11early-return
modules/actions/jobparser/evaluator.go:165:11
exprStart = -1 } else if strStart > -1 { pos += strStart + 1modelmigration/base/db_test.go1
88:14error-strings
modelmigration/base/db_test.go:88:14
sess.Close() t.Errorf("Unable to drop columns: %s from drop_test: %v", dropcols, err) returnmodels/asymkey/error.go1
124:6error-type-naming
models/asymkey/error.go:124:6
// ErrGPGKeyParsing represents a "ErrGPGKeyParsing" kind of error.type ErrGPGKeyParsing struct { ParseError errormodules/setting/ssh.go1
140:3excessive-blank-identifiers
modules/setting/ssh.go:140:3
for _, caKey := range SSH.TrustedUserCAKeys { pubKey, _, _, _, err := gossh.ParseAuthorizedKey([]byte(caKey)) if err != nil {cmd/hook.go1
497:8exported-declaration-comment
cmd/hook.go:497:8
const VersionHead string = "version=1"models/git/branch.go1
1:1file-length-limit
models/git/branch.go:1:1
// Copyright 2016 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MITmodels/actions/runner.go1
331:67flag-parameter
models/actions/runner.go:331:67
func SetRunnerDisabled(ctx context.Context, runner *ActionRunner, isDisabled bool) error { if runner.IsDisabled == isDisabled {cmd/admin.go1
1:1format
cmd/admin.go:1:1
// Copyright 2016 The Gogs Authors. All rights reserved.// Copyright 2016 The Gitea Authors. All rights reserved.- Fix (safe): run `strider fmt cmd/admin.go`
cmd/admin_auth_ldap_test.go1
962:6function-length
cmd/admin_auth_ldap_test.go:962:6
func TestUpdateLdapSimpleAuth(t *testing.T) { // Mock cli functions to do not exit on errormodules/git/diff2.go1
35:6function-result-limit
modules/git/diff2.go:35:6
func parseDiffStat(stdout string) (numFiles, totalAdditions, totalDeletions int, err error) { if len(stdout) == 0 || stdout == "\n" {routers/api/packages/container/container.go1
212:6get-function-return-value
routers/api/packages/container/container.go:212:6
// https://docs.docker.com/registry/spec/api/#listing-repositoriesfunc GetRepositoryList(ctx *context.Context) { n := ctx.FormInt("n")modules/actions/github.go1
35:2identical-switch-branches
modules/actions/github.go:35:2
return true case webhook_module.HookEventFork: // GitHub "fork" eventcmd/admin_regenerate.go1
10:2import-alias-naming
cmd/admin_regenerate.go:10:2
"gitea.dev/modules/graceful" asymkey_service "gitea.dev/services/asymkey" repo_service "gitea.dev/services/repository"models/asymkey/gpg_key_commit_verification.go1
66:2import-shadowing
models/asymkey/gpg_key_commit_verification.go:66:2
// Generating hash of commit hash, err := populateHash(sig.Hash, []byte(payload)) if err != nil { // Skipping as failed to generate hashmodules/git/repo_stats.go1
100:7inefficient-map-lookup
modules/git/repo_stats.go:100:7
if _, ok := authors[email]; !ok { authors[email] = &CodeActivityAuthor{Name: author, Email: email, Commits: 0} }models/auth/oauth2_test.go1
89:91insecure-url-scheme
models/auth/oauth2_test.go:89:91
app := &auth_model.OAuth2Application{ RedirectURIs: []string{"http://127.0.0.1/", "http://::1/", "http://192.168.0.1/", "http://intranet/", "https://127.0.0.1/"}, ConfidentialClient: false,services/notify/notifier.go1
20:15interface-method-limit
services/notify/notifier.go:20:15
// Notifier defines an interface to notify receivertype Notifier interface { Run()modules/actions/jobparser/model.go1
398:7max-control-nesting
modules/actions/jobparser/model.go:398:7
schedules[i] = make(map[string]string, len(vv)) for k, vvv := range vv { var ok booltests/integration/workflow_run_api_check_test.go1
198:6max-parameters
tests/integration/workflow_run_api_check_test.go:198:6
func verifyWorkflowRunCanbeFoundWithStatusFilter(t *testing.T, runAPIURL, token string, id int64, conclusion, status, event, branch, actor, headSHA string) { filter := url.Values{}modelmigration/v1_19/v233.go1
137:7max-public-structs
modelmigration/v1_19/v233.go:137:7
} type MatrixPayloadUnsafe struct { MatrixPayloadSafecmd/admin_auth_ldap.go1
245:3modifies-parameter
cmd/admin_auth_ldap.go:245:3
if c.IsSet("disable-synchronize-users") { authSource.IsSyncEnabled = !c.Bool("disable-synchronize-users") }models/repo/repo_list.go1
136:5modifies-value-receiver
models/repo/repo_list.go:136:5
if st.RepoID == repos[i].ID { repos[i].PrimaryLanguage = st breakcmd/admin_user_change_password_test.go1
57:18nested-structs
cmd/admin_user_change_password_test.go:57:18
t.Run("failure cases", func(t *testing.T) { testCases := []struct { name stringmodels/asymkey/ssh_key.go1
274:4nil-error-return
models/asymkey/ssh_key.go:274:4
if auth.IsErrSourceNotExist(err) { return false, nil }models/auth/oauth2.go1
482:3nil-value-with-nil-error
models/auth/oauth2.go:482:3
} else if !has { return nil, nil //nolint:nilnil // return nil to indicate that the object does not exist }modules/graceful/restart_unix.go1
59:3no-defer-in-loop
modules/graceful/restart_unix.go:59:3
// Remember to close these at the end. defer func(i int) { _ = files[i].Close()modelmigration/v1_11/v111.go1
313:5no-else-after-return
modelmigration/v1_11/v111.go:313:5
return false, err } else if !has { return false, fmt.Errorf("PullRequest for issueID %d not exist", issueID)models/actions/runner_token.go1
43:6no-init
models/actions/runner_token.go:43:6
func init() { db.RegisterModel(new(ActionRunnerToken))build/generate-openapi.go1
46:2no-package-var
build/generate-openapi.go:46:2
appSubUrlRe = regexp.MustCompile(regexp.QuoteMeta(appSubUrlVar)) appVerRe = regexp.MustCompile(regexp.QuoteMeta(appVerVar))cmd/admin_auth.go1
4:9package-comments
cmd/admin_auth.go:4:9
package cmdmodelmigration/v1_10/v94.go2
4:9package-directory-mismatch
modelmigration/v1_10/v94.go:4:9
package v1_104:9package-naming
modelmigration/v1_10/v94.go:4:9
package v1_10cmd/admin_auth_smtp_test.go1
233:9range-value-address
cmd/admin_auth_smtp_test.go:233:9
t.Run(tc.name, func(t *testing.T) { a := &authService{ initDB: func(ctx context.Context) error {cmd/admin_auth_ldap_test.go1
1076:24redundant-conversion
cmd/admin_auth_ldap_test.go:1076:24
Cfg: &ldap.Source{ SecurityProtocol: ldap.SecurityProtocol(2), },services/oauth2_provider/access_token.go1
13:2redundant-import-alias
services/oauth2_provider/access_token.go:13:2
auth "gitea.dev/models/auth" "gitea.dev/models/db"services/webhook/discord.go1
207:2single-case-switch
services/webhook/discord.go:207:2
var color int switch p.Action { case api.HookIssueReviewed:models/git/protected_branch_list_test.go1
134:6slice-preallocation
models/git/protected_branch_list_test.go:134:6
var got []string for i := range pbr {modelmigration/base/db.go1
317:2task-comment
modelmigration/base/db.go:317:2
} // TODO: This will not work if there are foreign keysmodelmigration/migrations.go1
68:1top-level-declaration-order
modelmigration/migrations.go:68:1
// Version describes the version table. Should have only one row with id==1type Version struct { ID int64 `xorm:"pk autoincr"`modelmigration/v1_14/v156.go1
122:101unchecked-type-assertion
modelmigration/v1_14/v156.go:122:101
if git.IsErrNotExist(err) { log.Warn("Unable to find commit %s for Tag: %s in [%d]%s/%s. Cannot update publisher ID.", err.(git.ErrNotExist).ID, release.TagName, repo.ID, repo.OwnerName, repo.Name) continuetests/integration/api_repo_collaborator_test.go1
139:3unexported-naming
tests/integration/api_repo_collaborator_test.go:139:3
_session := loginUser(t, user10.Name) _testCtx := NewAPITestContext(t, user10.Name, repo2.Name, auth_model.AccessTokenScopeReadRepository)modules/git/gitcmd/env.go1
37:3unreachable-code
modules/git/gitcmd/env.go:37:3
log.Fatal("Unable to init Git's HomeDir, incorrect initialization of the setting and git modules") return "" }modelmigration/v1_16/v208.go1
8:48unused-parameter
modelmigration/v1_16/v208.go:8:48
func UseBase32HexForCredIDInWebAuthnCredential(x base.EngineMigration) error { // noopmodels/actions/schedule_list.go1
32:7unused-receiver
models/actions/schedule_list.go:32:7
func (opts FindScheduleOptions) ToOrders() string { return "`id` DESC"models/issues/review_list.go1
193:2use-slices-sort
models/issues/review_list.go:193:2
} sort.Slice(individualReviews, func(i, j int) bool { return individualReviews[i].UpdatedUnix < individualReviews[j].UpdatedUnixmodules/glob/glob_test.go1
26:2var-naming
modules/glob/glob_test.go:26:2
fixture_plain_match = "google.com" fixture_plain_mismatch = "gobwas.com"modules/base/tool_test.go1
48:133weak-cryptography
modules/base/tool_test.go:48:133
assert.Equal(t, "2000010203040000026fa5221b2731b7cf80b1b506f5e39e38c115fee5", CreateTimeLimitCode("test-sha1", 2, time2000, sha1.New())) assert.Equal(t, "2000010203040000026fa5221b2731b7cf80b1b506f5e39e38c115fee5", CreateTimeLimitCode("test-sha1", 2, "200001020304", sha1.New())) assert.Equal(t, "2000010203040000024842227a2f87041ff82025199c0187410a9297bf", CreateTimeLimitCode("test-hmac", 2, time2000, nil))build/openapi3gen/convert_test.go1
122:40add-constant
build/openapi3gen/convert_test.go:122:40
props := doc.Paths.Value("/upload").Post.RequestBody.Value.Content["multipart/form-data"].Schema.Value.Properties if !props["attachment"].Value.Type.Is("string") || props["attachment"].Value.Format != "binary" { t.Errorf("nested property not fixed: %+v", props["attachment"].Value)routers/web/repo/compare.go1
718:5boolean-literal-comparison
routers/web/repo/compare.go:718:5
if ctx.Data["PageIsWiki"] == true { var err errorbuild/openapi3gen/convert.go1
322:6cognitive-complexity
build/openapi3gen/convert.go:322:6
// astEnumMap. Returns "" if extraction is inconclusive.func extractEnumTypeName(s *openapi3.Schema, astEnumMap map[string][]string) string { if s == nil || s.Extensions == nil {models/auth/oauth2.go1
372:6confusing-naming
models/auth/oauth2.go:372:6
// DeleteOAuth2Application deletes the application with the given id and the grants and auth codes related to it. It checks if the userid was the creator of the app.func DeleteOAuth2Application(ctx context.Context, id, userid int64) error { return db.WithTx(ctx, func(ctx context.Context) error {modules/git/gitcmd/command.go1
580:61confusing-results
modules/git/gitcmd/command.go:580:61
func (c *Command) runStdBytes(ctx context.Context) ([]byte, []byte, RunStdError) { if c.cmdStdout != nil || c.cmdStderr != nil {modules/log/event_writer_console.go1
22:6constructor-interface-return
modules/log/event_writer_console.go:22:6
func NewEventWriterConsole(name string, mode WriterMode) EventWriter { w := &eventWriterConsole{EventWriterBaseImpl: NewEventWriterBase(name, "console", mode)}modules/graceful/manager_common.go1
33:2context-stored-in-struct
modules/graceful/manager_common.go:33:2
type Manager struct { ctx context.Context isChild boolcmd/admin_auth_ldap.go1
251:6cyclomatic-complexity
cmd/admin_auth_ldap.go:251:6
// parseLdapConfig assigns values on config according to command line flags.func parseLdapConfig(c *cli.Command, config *ldap.Source) error { if c.IsSet("name") {cmd/migrate_storage.go1
229:3deep-exit
cmd/migrate_storage.go:229:3
if err := db.InitEngineWithMigration(context.Background(), versioned_migration.Migrate); err != nil { log.Fatal("Failed to initialize ORM engine: %v", err) return errmodules/storage/minio_test.go1
169:14deprecated-api-usage
modules/storage/minio_test.go:169:14
creds := buildMinioCredentials(cfg) v, err := creds.Get()cmd/admin_user_disable_2fa.go1
70:2discarded-error-result
cmd/admin_user_disable_2fa.go:70:2
fmt.Printf("Disabled 2FA for user %q (removed %d TOTP and %d WebAuthn credential(s))\n", user.Name, totp, webAuthn) return nilmodelmigration/base/db.go1
482:1doc-comment-period
modelmigration/base/db.go:482:1
// ModifyColumn will modify column's type or other property. SQLITE is not supportedfunc ModifyColumn(x EngineMigration, tableName string, col *schemas.Column) error {modules/base/natural_sort.go1
35:10early-return
modules/base/natural_sort.go:35:10
end += size } else if isCurRuneNum == isNumber { end += sizemodelmigration/migrations.go1
473:21error-strings
modelmigration/migrations.go:473:21
if minDBVersion > currentDB { return fmt.Errorf("DB version %d (<= %d) is too old for auto-migration. Upgrade to Gitea 1.6.4 first then upgrade to this version", currentDB, minDBVersion) }models/asymkey/error.go1
139:6error-type-naming
models/asymkey/error.go:139:6
// ErrGPGKeyNotExist represents a "GPGKeyNotExist" kind of error.type ErrGPGKeyNotExist struct { ID int64modules/setting/testenv.go1
28:2excessive-blank-identifiers
modules/setting/testenv.go:28:2
func detectGiteaTestRoot() string { _, filename, _, _ := runtime.Caller(0) giteaRoot := filepath.Dir(filepath.Dir(filepath.Dir(filename)))cmd/main.go1
51:6exported-declaration-comment
cmd/main.go:51:6
func PrepareSubcommandWithGlobalFlags(originCmd *cli.Command) { originBefore := originCmd.Beforemodels/git/commit_status.go1
1:1file-length-limit
models/git/commit_status.go:1:1
// Copyright 2017 Gitea. All rights reserved.// SPDX-License-Identifier: MITmodels/activities/action.go1
439:46flag-parameter
models/activities/action.go:439:46
func (opts *GetFeedsOptions) ApplyPublicOnly(publicOnly bool) { if publicOnly {cmd/admin_auth.go1
1:1format
cmd/admin_auth.go:1:1
// Copyright 2023 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MIT- Fix (safe): run `strider fmt cmd/admin_auth.go`
cmd/admin_auth_oauth.go1
19:6function-length
cmd/admin_auth_oauth.go:19:6
func oauthCLIFlags() []cli.Flag { return []cli.Flag{modules/git/merge_tree.go1
20:6function-result-limit
modules/git/merge_tree.go:20:6
// If there are no conflicts, the list of conflicted files will be nil.func MergeTree(ctx context.Context, repo RepositoryFacade, baseRef, headRef, mergeBase string) (treeID string, isErrHasConflicts bool, conflictFiles []string, _ error) { cmd := gitcmd.NewCommand("merge-tree", "--write-tree", "-z", "--name-only", "--no-messages").routers/api/packages/container/container.go1
335:6get-function-return-value
routers/api/packages/container/container.go:335:6
// https://github.com/opencontainers/distribution-spec/blob/main/spec.md#pushing-a-blob-in-chunksfunc GetBlobsUpload(ctx *context.Context) { image := ctx.PathParam("image")modules/actions/github.go1
39:2identical-switch-branches
modules/actions/github.go:39:2
return true case webhook_module.HookEventIssueComment: // GitHub "issue_comment" eventcmd/admin_regenerate.go1
11:2import-alias-naming
cmd/admin_regenerate.go:11:2
asymkey_service "gitea.dev/services/asymkey" repo_service "gitea.dev/services/repository"models/auth/twofactor.go1
202:56import-shadowing
models/auth/twofactor.go:202:56
// It is a no-op for a user that has no 2FA enrolled.func DisableTwoFactor(ctx context.Context, uid int64) (totp, webAuthn int64, err error) { err = db.WithTx(ctx, func(ctx context.Context) error {modules/setting/repository.go1
375:6inefficient-map-lookup
modules/setting/repository.go:375:6
if _, has := Repository.DetectedCharsetScore[canonicalCharset]; !has { Repository.DetectedCharsetScore[canonicalCharset] = i i++models/auth/oauth2_test.go1
95:41insecure-url-scheme
models/auth/oauth2_test.go:95:41
// https://datatracker.ietf.org/doc/html/rfc8252#section-7.3 assert.True(t, app.ContainsRedirectURI("http://127.0.0.1:3456/")) assert.True(t, app.ContainsRedirectURI("http://127.0.0.1/"))services/webhook/payloader.go1
18:30interface-method-limit
services/webhook/payloader.go:18:30
// payloadConvertor defines the interface to convert system payload to webhook payloadtype payloadConvertor[T any] interface { Create(*api.CreatePayload) (T, error)modules/actions/jobparser/model.go1
400:8max-control-nesting
modules/actions/jobparser/model.go:400:8
var ok bool if schedules[i][k], ok = vvv.(string); !ok { return nil, fmt.Errorf("unknown on type(schedule): %#v", v)modelmigration/v1_19/v240.go1
100:7max-public-structs
modelmigration/v1_19/v240.go:100:7
type ActionTask struct { ID int64cmd/admin_auth_ldap.go1
247:2modifies-parameter
cmd/admin_auth_ldap.go:247:2
} authSource.TwoFactorPolicy = util.Iif(c.Bool("skip-local-2fa"), "skip", "")}modules/container/set.go1
21:3modifies-value-receiver
modules/container/set.go:21:3
if _, has := s[value]; !has { s[value] = struct{}{} return truecmd/admin_user_delete_test.go1
66:17nested-structs
cmd/admin_user_delete_test.go:66:17
func TestAdminUserDeleteFailure(t *testing.T) { testCases := []struct { name stringmodels/avatars/avatar.go1
154:4nil-error-return
models/avatars/avatar.go:154:4
// Seriously we don't care about any DB problems just return the lowerEmail - we expect the transaction to fail most of the time return lowerEmail, nil }models/auth/oauth2.go1
568:3nil-value-with-nil-error
models/auth/oauth2.go:568:3
} else if !has { return nil, nil //nolint:nilnil // return nil to indicate that the object does not exist }modules/lfs/filesystem_client.go1
47:3no-defer-in-loop
modules/lfs/filesystem_client.go:47:3
} defer f.Close() if err := callback(p, f, nil); err != nil {modelmigration/v1_11/v111.go1
321:5no-else-after-return
modelmigration/v1_11/v111.go:321:5
return false, err } else if !has { return false, fmt.Errorf("baseRepo with id %d not exist", pr.BaseRepoID)models/actions/schedule.go1
39:6no-init
models/actions/schedule.go:39:6
func init() { db.RegisterModel(new(ActionSchedule))build/generate-openapi.go1
48:2no-package-var
build/generate-openapi.go:48:2
enumScanDirs = []string{ "modules/structs",cmd/admin_auth_ldap.go1
4:9package-comments
cmd/admin_auth_ldap.go:4:9
package cmdmodelmigration/v1_10/v95.go2
4:9package-directory-mismatch
modelmigration/v1_10/v95.go:4:9
package v1_104:9package-naming
modelmigration/v1_10/v95.go:4:9
package v1_10modelmigration/v1_12/v128.go1
69:16range-value-address
modelmigration/v1_12/v128.go:69:16
for _, pr := range prs { baseRepo := &Repository{ID: pr.BaseRepoID} has, err := x.Table("repository").Get(baseRepo)cmd/hook.go1
505:36redundant-conversion
cmd/hook.go:505:36
index := bytes.IndexByte(rs.Data, byte(0)) if index >= len(rs.Data) {services/packages/container/common.go1
18:2redundant-import-alias
services/packages/container/common.go:18:2
v1 "github.com/opencontainers/image-spec/specs-go/v1")services/webhook/matrix.go1
206:2single-case-switch
services/webhook/matrix.go:206:2
switch p.Action { case api.HookIssueReviewed:models/issues/pull.go1
834:2slice-preallocation
models/issues/pull.go:834:2
rules := make([]*CodeOwnerRule, 0) lines := strings.Split(data, "\n")modelmigration/base/db_test.go1
23:2task-comment
modelmigration/base/db_test.go:23:2
defer deferable() // FIXME: this logic seems wrong. Need to add an assertion here in the future, but it seems causing failure. if x == nil || t.Failed() {modelmigration/v1_20/v259.go1
22:1top-level-declaration-order
modelmigration/v1_20/v259.go:22:1
// for all categories, write implies readconst ( AccessTokenScopeAll AccessTokenScope = "all"modelmigration/v1_8/v76.go1
54:53unchecked-type-assertion
modelmigration/v1_8/v76.go:54:53
if allowMerge, ok := unit.Config["AllowMerge"]; ok { allowMergeRebase = allowMergeRebase && allowMerge.(bool) }modules/setting/federation.go1
41:3unreachable-code
modules/setting/federation.go:41:3
log.Fatal("unsupported digest algorithm: %s", Federation.DigestAlgorithm) return }modelmigration/v1_16/v209.go1
8:32unused-parameter
modelmigration/v1_16/v209.go:8:32
func IncreaseCredentialIDTo410(x base.EngineMigration) error { // no-opmodels/actions/schedule_spec_list.go1
83:7unused-receiver
models/actions/schedule_spec_list.go:83:7
func (opts FindSpecOptions) ToOrders() string { return "`id` DESC"models/issues/review_list.go1
201:2use-slices-sort
models/issues/review_list.go:201:2
} sort.Slice(originalReviews, func(i, j int) bool { return originalReviews[i].UpdatedUnix < originalReviews[j].UpdatedUnixmodules/glob/glob_test.go1
28:2var-naming
modules/glob/glob_test.go:28:2
pattern_multiple = "https://*.google.*" regexp_multiple = `^https:\/\/.*\.google\..*$`modules/git/object_format.go1
67:12weak-cryptography
modules/git/object_format.go:67:12
func (h Sha1ObjectFormatImpl) ComputeHash(t ObjectType, content []byte) ObjectID { hasher := sha1.New() _, _ = hasher.Write(t.Bytes())build/openapi3gen/convert_test.go1
122:59add-constant
build/openapi3gen/convert_test.go:122:59
props := doc.Paths.Value("/upload").Post.RequestBody.Value.Content["multipart/form-data"].Schema.Value.Properties if !props["attachment"].Value.Type.Is("string") || props["attachment"].Value.Format != "binary" { t.Errorf("nested property not fixed: %+v", props["attachment"].Value)routers/web/repo/githttp.go1
166:25boolean-literal-comparison
routers/web/repo/githttp.go:166:25
if ctx.IsBasicAuth && ctx.Data["IsApiToken"] != true && !ctx.Doer.IsGiteaActions() { _, err = auth_model.GetTwoFactorByUID(ctx, ctx.Doer.ID)build/openapi3gen/enumscan.go1
46:6cognitive-complexity
build/openapi3gen/enumscan.go:46:6
// constants can't be extracted.func ScanSwaggerEnumTypes(dirs []string) (map[string][]string, error) { fset := token.NewFileSet()models/issues/assignees.go1
104:6confusing-naming
models/issues/assignees.go:104:6
func toggleIssueAssignee(ctx context.Context, issue *Issue, doer *user_model.User, assigneeID int64, isCreate bool) (removed bool, comment *Comment, err error) { removed, err = toggleUserAssignee(ctx, issue, assigneeID)modules/highlight/lexerdetect.go1
198:64confusing-results
modules/highlight/lexerdetect.go:198:64
func normalizeFileNameLang(fileName, fileLang string) (string, string) { fileName = path.Base(fileName)modules/log/event_writer_file.go1
30:6constructor-interface-return
modules/log/event_writer_file.go:30:6
func NewEventWriterFile(name string, mode WriterMode) EventWriter { w := &eventWriterFile{EventWriterBaseImpl: NewEventWriterBase(name, "file", mode)}modules/graceful/manager_common.go1
38:2context-stored-in-struct
modules/graceful/manager_common.go:38:2
state state shutdownCtx context.Context hammerCtx context.Contextcmd/admin_auth_oauth.go1
215:23cyclomatic-complexity
cmd/admin_auth_oauth.go:215:23
func (a *authService) runUpdateOauth(ctx context.Context, c *cli.Command) error { if !c.IsSet("id") {cmd/migrate_storage.go1
245:4deep-exit
cmd/migrate_storage.go:245:4
if p == "" { log.Fatal("Path must be given when storage is local") return nilmodules/storage/minio_test.go1
197:14deprecated-api-usage
modules/storage/minio_test.go:197:14
}) v, err := creds.Get()cmd/admin_user_generate_access_token.go1
91:3discarded-error-result
cmd/admin_user_generate_access_token.go:91:3
if c.Bool("raw") { fmt.Printf("%s\n", t.Token) } else {modelmigration/migrations.go1
62:1doc-comment-period
modelmigration/migrations.go:62:1
// Migrate executes the migrationfunc (m *migration) Migrate(ctx context.Context, x base.EngineMigration) error {modules/charset/charset.go1
149:10early-return
modules/charset/charset.go:149:10
break } else if c>>6 == 0b10 { // a continuation bytemodelmigration/v1_11/v111.go1
314:29error-strings
modelmigration/v1_11/v111.go:314:29
} else if !has { return false, fmt.Errorf("PullRequest for issueID %d not exist", issueID) }models/asymkey/error.go1
158:6error-type-naming
models/asymkey/error.go:158:6
// ErrGPGKeyImportNotExist represents a "GPGKeyImportNotExist" kind of error.type ErrGPGKeyImportNotExist struct { ID stringmodules/tempdir/tempdir_test.go1
57:4excessive-blank-identifiers
modules/tempdir/tempdir_test.go:57:4
_ = os.Chtimes(fb1.Name(), time.Now().Add(-time.Hour), time.Now().Add(-time.Hour)) _, _, _ = fa1.Close(), fa2.Close(), fb1.Close()cmd/main.go1
82:6exported-declaration-comment
cmd/main.go:82:6
type AppVersion struct { Version stringmodels/git/protected_branch.go1
1:1file-length-limit
models/git/protected_branch.go:1:1
// Copyright 2022 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MITmodels/activities/repo_activity.go1
48:93flag-parameter
models/activities/repo_activity.go:48:93
// GetActivityStats return stats for repository at given time rangefunc GetActivityStats(ctx context.Context, repo *repo_model.Repository, timeFrom time.Time, releases, issues, prs, code bool) (*ActivityStats, error) { stats := &ActivityStats{Code: &git.CodeActivityStats{}}cmd/admin_auth_ldap.go1
1:1format
cmd/admin_auth_ldap.go:1:1
// Copyright 2019 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MIT- Fix (safe): run `strider fmt cmd/admin_auth_ldap.go`
cmd/admin_auth_oauth.go1
215:23function-length
cmd/admin_auth_oauth.go:215:23
func (a *authService) runUpdateOauth(ctx context.Context, c *cli.Command) error { if !c.IsSet("id") {modules/git/repo_index.go1
53:25function-result-limit
modules/git/repo_index.go:53:25
// ReadTreeToTemporaryIndex reads a treeish to a temporary index filefunc (repo *Repository) ReadTreeToTemporaryIndex(ctx context.Context, treeish string) (tmpIndexFilename, tmpDir string, cancel context.CancelFunc, err error) { defer func() {routers/api/packages/container/container.go1
536:6get-function-return-value
routers/api/packages/container/container.go:536:6
// https://github.com/opencontainers/distribution-spec/blob/main/spec.md#pulling-blobsfunc GetBlob(ctx *context.Context) { blob, err := getBlobFromContext(ctx)modules/actions/github.go1
43:2identical-switch-branches
modules/actions/github.go:43:2
return true case webhook_module.HookEventPullRequestComment: // GitHub "pull_request_comment" eventcmd/admin_user_change_password.go1
11:2import-alias-naming
cmd/admin_user_change_password.go:11:2
user_model "gitea.dev/models/user" "gitea.dev/modules/auth/password"models/auth/twofactor_test.go1
68:2import-shadowing
models/auth/twofactor_test.go:68:2
// Both records are removed and counted separately. totp, webAuthn, err := auth_model.DisableTwoFactor(ctx, uid) require.NoError(t, err)modules/setting/repository.go1
382:4inefficient-map-lookup
modules/setting/repository.go:382:4
if _, has := Repository.DetectedCharsetScore[charset]; !has { Repository.DetectedCharsetScore[charset] = i i++models/auth/oauth2_test.go1
96:41insecure-url-scheme
models/auth/oauth2_test.go:96:41
assert.True(t, app.ContainsRedirectURI("http://127.0.0.1:3456/")) assert.True(t, app.ContainsRedirectURI("http://127.0.0.1/")) assert.True(t, app.ContainsRedirectURI("http://[::1]:3456/"))modules/actions/jobparser/model.go1
421:7max-control-nesting
modules/actions/jobparser/model.go:421:7
if expectedKey { if content.Kind != yaml.ScalarNode { return nil, fmt.Errorf("key type not string: %#v", content)modelmigration/v1_19/v240.go1
129:7max-public-structs
modelmigration/v1_19/v240.go:129:7
type ActionTaskStep struct { ID int64cmd/admin_auth_ldap.go1
253:3modifies-parameter
cmd/admin_auth_ldap.go:253:3
if c.IsSet("name") { config.Name = c.String("name") }modules/git/pipeline/lfs_common.go1
26:47modifies-value-receiver
modules/git/pipeline/lfs_common.go:26:47
func (a lfsResultSlice) Len() int { return len(a) }func (a lfsResultSlice) Swap(i, j int) { a[i], a[j] = a[j], a[i] }func (a lfsResultSlice) Less(i, j int) bool { return a[j].When.After(a[i].When) }cmd/admin_user_disable_2fa_test.go1
92:18nested-structs
cmd/admin_user_disable_2fa_test.go:92:18
t.Run("failure cases", func(t *testing.T) { testCases := []struct { name stringmodels/git/lfs_lock.go1
59:4nil-error-return
models/git/lfs_lock.go:59:4
l.Owner = user_model.NewGhostUser() return nil }models/db/collation.go1
100:3nil-value-with-nil-error
models/db/collation.go:100:3
} else { return nil, nil //nolint:nilnil // return nil for unsupported database types }modules/packages/composer/metadata.go1
141:4no-defer-in-loop
modules/packages/composer/metadata.go:141:4
} defer f.Close()modelmigration/v1_11/v115.go1
77:6no-else-after-return
modelmigration/v1_11/v115.go:77:6
return fmt.Errorf("[user: %s] %w", user.LowerName, err) } else if newAvatar == oldAvatar { continuemodels/actions/schedule_spec.go1
62:6no-init
models/actions/schedule_spec.go:62:6
func init() { db.RegisterModel(new(ActionScheduleSpec))build/openapi3gen/convert.go1
23:5no-package-var
build/openapi3gen/convert.go:23:5
// like "not deprecated" or "previously deprecated, now supported".var rxDeprecated = regexp.MustCompile(`(?i)(?:^|[\n.;])\s*deprecated\b`)cmd/admin_auth_oauth.go1
4:9package-comments
cmd/admin_auth_oauth.go:4:9
package cmdmodelmigration/v1_10/v96.go2
4:9package-directory-mismatch
modelmigration/v1_10/v96.go:4:9
package v1_104:9package-naming
modelmigration/v1_10/v96.go:4:9
package v1_10modelmigration/v1_12/v134.go1
67:16range-value-address
modelmigration/v1_12/v134.go:67:16
for _, pr := range prs { baseRepo := &Repository{ID: pr.BaseRepoID} has, err := x.Table("repository").Get(baseRepo)cmd/hook.go1
525:32redundant-conversion
cmd/hook.go:525:32
if strings.HasPrefix(option, "push-options") { response = append(response, byte(0)) response = append(response, []byte("push-options")...)tests/integration/mirror_pull_test.go1
23:2redundant-import-alias
tests/integration/mirror_pull_test.go:23:2
"gitea.dev/modules/test" migrations "gitea.dev/services/migrations" mirror_service "gitea.dev/services/mirror"services/webhook/msteams.go1
217:2single-case-switch
services/webhook/msteams.go:217:2
var color int switch p.Action { case api.HookIssueReviewed:models/organization/org_test.go1
517:6slice-preallocation
models/organization/org_test.go:517:6
assert.Len(t, users, 2) var ids []int64 for i := range users {modelmigration/v1_22/v287_test.go1
56:2task-comment
modelmigration/v1_22/v287_test.go:56:2
// TODO: check if badges have been updated}modelmigration/v1_27/v331.go1
35:1top-level-declaration-order
modelmigration/v1_27/v331.go:35:1
type actionArtifact struct { ID int64 `xorm:"pk autoincr"`modelmigration/v1_8/v76.go1
58:54unchecked-type-assertion
modelmigration/v1_8/v76.go:58:54
if allowRebase, ok := unit.Config["AllowRebase"]; ok { allowMergeRebase = allowMergeRebase && allowRebase.(bool) }modules/setting/oauth2.go1
118:3unreachable-code
modules/setting/oauth2.go:118:3
log.Fatal("Failed to map OAuth2 settings: %v", err) return }models/actions/run_list.go1
144:24unused-parameter
models/actions/run_list.go:144:24
// GetStatusInfoList returns a slice of StatusInfofunc GetStatusInfoList(ctx context.Context, lang translation.Locale) []StatusInfo { // same as those in aggregateJobStatus (StatusUnknown excluded; it's the "shouldn't happen" fallback)models/actions/task_list.go1
89:7unused-receiver
models/actions/task_list.go:89:7
func (opts FindTaskOptions) ToOrders() string { return "`id` DESC"models/issues/review_list.go1
209:2use-slices-sort
models/issues/review_list.go:209:2
} sort.Slice(teamReviewRequests, func(i, j int) bool { return teamReviewRequests[i].UpdatedUnix < teamReviewRequests[j].UpdatedUnixmodules/glob/glob_test.go1
29:2var-naming
modules/glob/glob_test.go:29:2
pattern_multiple = "https://*.google.*" regexp_multiple = `^https:\/\/.*\.google\..*$` fixture_multiple_match = "https://account.google.com"modules/git/utils.go1
71:7weak-cryptography
modules/git/utils.go:71:7
func HashFilePathForWebUI(s string) string { h := sha1.New() _, _ = h.Write([]byte(s))build/openapi3gen/convert_test.go1
125:66add-constant
build/openapi3gen/convert_test.go:125:66
} if !props["items"].Value.Items.Value.Type.Is("string") || props["items"].Value.Items.Value.Format != "binary" { t.Errorf("array items not fixed: %+v", props["items"].Value.Items.Value)routers/web/repo/middlewares.go1
36:18boolean-literal-comparison
routers/web/repo/middlewares.go:36:18
func GetDiffViewStyle(ctx *context.Context) string { return util.Iif(ctx.Data["IsSplitStyle"] == true, gitdiff.DiffStyleSplit, gitdiff.DiffStyleUnified)}build/openapi3gen/enumscan.go1
145:6cognitive-complexity
build/openapi3gen/enumscan.go:145:6
func registerEnumAnnotation(doc *ast.CommentGroup, specs []ast.Spec, enumTypes map[string]string) error { if doc == nil {models/issues/issue_label.go1
86:6confusing-naming
models/issues/issue_label.go:86:6
// NewIssueLabel creates a new issue-label relation.func NewIssueLabel(ctx context.Context, issue *Issue, label *Label, doer *user_model.User) (err error) { if HasIssueLabel(ctx, issue.ID, label.ID) {modules/indexer/code/elasticsearch/elasticsearch.go1
243:61confusing-results
modules/indexer/code/elasticsearch/elasticsearch.go:243:61
// If not found any of the positions, it will return -1, -1.func contentMatchIndexPos(content, start, end string) (int, int) { startIdx := strings.Index(content, start)modules/reqctx/datastore.go1
139:6constructor-interface-return
modules/reqctx/datastore.go:139:6
// It doesn't add the context to the process manager, nor do cleanupfunc NewRequestContextForTest(parentCtx context.Context) RequestContext { return &requestContext{Context: parentCtx, RequestDataStore: &requestDataStore{values: make(map[any]any)}}modules/graceful/manager_common.go1
39:2context-stored-in-struct
modules/graceful/manager_common.go:39:2
shutdownCtx context.Context hammerCtx context.Context terminateCtx context.Contextcmd/admin_user_create.go1
103:6cyclomatic-complexity
cmd/admin_user_create.go:103:6
func runCreateUser(ctx context.Context, c *cli.Command) error { // this command highly depends on the many setting options (create org, visibility, etc.), so it must have a full setting load firstcmd/web.go1
94:3deep-exit
cmd/web.go:94:3
if err != nil { log.Fatal("Failed to start port redirection: %v", err) }routers/api/v1/misc/markup.go1
37:19deprecated-api-usage
routers/api/v1/misc/markup.go:37:19
form := web.GetForm(ctx).(*api.MarkupOption) mode := util.Iif(form.Wiki, "wiki", form.Mode) //nolint:staticcheck // form.Wiki is deprecated common.RenderMarkup(ctx.Base, ctx.Repo, mode, form.Text, form.Context, form.FilePath)cmd/admin_user_generate_access_token.go1
93:3discarded-error-result
cmd/admin_user_generate_access_token.go:93:3
} else { fmt.Printf("Access token was successfully created: %s\n", t.Token) }modelmigration/migrations.go1
67:1doc-comment-period
modelmigration/migrations.go:67:1
// Version describes the version table. Should have only one row with id==1type Version struct {modules/charset/escape_stream.go1
202:4early-return
modules/charset/escape_stream.go:202:4
last, lastSize := utf8.DecodeRune(curPart[i:]) if last == utf8.RuneError && lastSize == 1 { curPartLen--modelmigration/v1_11/v113.go1
19:21error-strings
modelmigration/v1_11/v113.go:19:21
if err := x.Sync(new(Comment)); err != nil { return fmt.Errorf("Sync: %w", err) }models/asymkey/error.go1
177:6error-type-naming
models/asymkey/error.go:177:6
// ErrGPGKeyIDAlreadyUsed represents a "GPGKeyIDAlreadyUsed" kind of error.type ErrGPGKeyIDAlreadyUsed struct { KeyID stringmodules/testlogger/testlogger.go1
167:2excessive-blank-identifiers
modules/testlogger/testlogger.go:167:2
const relFilePath = "modules/testlogger/testlogger.go" _, filename, _, _ := runtime.Caller(0) if !strings.HasSuffix(filename, relFilePath) {cmd/main.go1
87:6exported-declaration-comment
cmd/main.go:87:6
func NewMainApp(appVer AppVersion) *cli.Command { app := &cli.Command{}models/issues/comment.go1
1:1file-length-limit
models/issues/comment.go:1:1
// Copyright 2018 The Gitea Authors.// Copyright 2016 The Gogs Authors.models/activities/repo_activity.go1
48:103flag-parameter
models/activities/repo_activity.go:48:103
// GetActivityStats return stats for repository at given time rangefunc GetActivityStats(ctx context.Context, repo *repo_model.Repository, timeFrom time.Time, releases, issues, prs, code bool) (*ActivityStats, error) { stats := &ActivityStats{Code: &git.CodeActivityStats{}}cmd/admin_auth_ldap_test.go1
1:1format
cmd/admin_auth_ldap_test.go:1:1
// Copyright 2019 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MIT- Fix (safe): run `strider fmt cmd/admin_auth_ldap_test.go`
cmd/admin_auth_oauth_test.go1
17:6function-length
cmd/admin_auth_oauth_test.go:17:6
func TestAddOauth(t *testing.T) { testCases := []struct {modules/indexer/code/bleve/bleve.go1
253:19function-result-limit
modules/indexer/code/bleve/bleve.go:253:19
// Returns the matching file-pathsfunc (b *Indexer) Search(ctx context.Context, opts *internal.SearchOptions) (int64, []*internal.SearchResult, []*internal.SearchResultLanguages, error) { var (routers/api/packages/container/container.go1
671:6get-function-return-value
routers/api/packages/container/container.go:671:6
// https://github.com/opencontainers/distribution-spec/blob/main/spec.md#pulling-manifestsfunc GetManifest(ctx *context.Context) { manifest, err := getManifestFromContext(ctx)modules/actions/github.go1
47:2identical-switch-branches
modules/actions/github.go:47:2
return true case webhook_module.HookEventWiki: // GitHub "gollum" eventcmd/admin_user_change_password.go1
15:2import-alias-naming
cmd/admin_user_change_password.go:15:2
"gitea.dev/modules/setting" user_service "gitea.dev/services/user"models/avatars/avatar.go1
47:2import-shadowing
models/avatars/avatar.go:47:2
gravatarSourceURL *url.URL libravatar *libravatar.Libravatar}routers/api/actions/artifacts_chunks.go1
217:4inefficient-map-lookup
routers/api/actions/artifacts_chunks.go:217:4
if _, ok := chunkMapV4[item.ChunkName]; ok { chunkMapV4[item.ChunkName] = item } else if chunkMapV4 == nil {models/auth/oauth2_test.go1
97:41insecure-url-scheme
models/auth/oauth2_test.go:97:41
assert.True(t, app.ContainsRedirectURI("http://127.0.0.1/")) assert.True(t, app.ContainsRedirectURI("http://[::1]:3456/"))modules/actions/jobparser/model.go1
426:7max-control-nesting
modules/actions/jobparser/model.go:426:7
err := content.Decode(&act) if err != nil { return nil, errmodelmigration/v1_22/v286_test.go1
44:7max-public-structs
modelmigration/v1_22/v286_test.go:44:7
type PullRequest struct { ID int64cmd/admin_auth_ldap.go1
256:3modifies-parameter
cmd/admin_auth_ldap.go:256:3
if c.IsSet("host") { config.Host = c.String("host") }modules/git/pipeline/lfs_common.go1
26:53modifies-value-receiver
modules/git/pipeline/lfs_common.go:26:53
func (a lfsResultSlice) Len() int { return len(a) }func (a lfsResultSlice) Swap(i, j int) { a[i], a[j] = a[j], a[i] }func (a lfsResultSlice) Less(i, j int) bool { return a[j].When.After(a[i].When) }cmd/cert_test.go1
16:13nested-structs
cmd/cert_test.go:16:13
func TestCertCommand(t *testing.T) { cases := []struct { name stringmodels/issues/comment.go1
737:5nil-error-return
models/issues/comment.go:737:5
if c.Type == CommentTypeReviewRequest { return nil }models/git/lfs_lock.go1
133:3nil-value-with-nil-error
models/git/lfs_lock.go:133:3
if !setting.LFS.StartServer { return nil, nil //nolint:nilnil // return nil when LFS is not started }modules/packages/conda/metadata.go1
112:4no-defer-in-loop
modules/packages/conda/metadata.go:112:4
} defer f.Close()modelmigration/v1_14/v156.go1
81:7no-else-after-return
modelmigration/v1_14/v156.go:81:7
return err } else if !has { log.Warn("Release[%d] is orphaned and refers to non-existing repository %d", release.ID, release.RepoID)models/actions/scoped_workflow.go1
40:6no-init
models/actions/scoped_workflow.go:40:6
func init() { db.RegisterModel(new(ActionScopedWorkflowSource))build/openapi3gen/enumscan.go1
34:5no-package-var
build/openapi3gen/enumscan.go:34:5
var rxSwaggerEnum = regexp.MustCompile(`swagger:enum\s+(\w+)`)cmd/admin_auth_smtp.go1
4:9package-comments
cmd/admin_auth_smtp.go:4:9
package cmdmodelmigration/v1_10/v97.go2
4:9package-directory-mismatch
modelmigration/v1_10/v97.go:4:9
package v1_104:9package-naming
modelmigration/v1_10/v97.go:4:9
package v1_10modelmigration/v1_12/v136.go1
76:16range-value-address
modelmigration/v1_12/v136.go:76:16
for _, pr := range results { baseRepo := &Repository{ID: pr.BaseRepoID} has, err := x.Table("repository").Get(baseRepo)modelmigration/v1_11/v115.go1
97:38redundant-conversion
modelmigration/v1_11/v115.go:97:38
len(deleteList), int(math.Ceil(float64(migrated)/float64(50))), count-int64(migrated))services/webhook/slack.go1
255:2single-case-switch
services/webhook/slack.go:255:2
switch p.Action { case api.HookIssueReviewed:models/repo/license.go1
30:6slice-preallocation
models/repo/license.go:30:6
func (rll RepoLicenseList) StringList() []string { var licenses []string for _, rl := range rll {models/actions/run.go1
313:3task-comment
models/actions/run.go:313:3
And("workflow_id = ?", workflowFile). // TODO: the badge only reflects the repo's own (repo-level) runs; a same-named scoped run must not leak in. // Support a scoped-workflow badge later by making this source-aware.modelmigration/v1_27/v331_test.go1
29:1top-level-declaration-order
modelmigration/v1_27/v331_test.go:29:1
type actionRunJobBeforeV331 struct { ID int64 `xorm:"pk autoincr"`modelmigration/v1_8/v76.go1
62:54unchecked-type-assertion
modelmigration/v1_8/v76.go:62:54
if allowSquash, ok := unit.Config["AllowSquash"]; ok { allowMergeRebase = allowMergeRebase && allowSquash.(bool) }services/oauth2_provider/jwtsigningkey.go1
394:4unreachable-code
services/oauth2_provider/jwtsigningkey.go:394:4
log.Fatal("Error generating private key: %v", err) return nil, err }models/db/log.go1
93:34unused-parameter
models/db/log.go:93:34
// SetLevel set the logger levelfunc (l *XORMLogBridge) SetLevel(lvl xormlog.LogLevel) {}models/activities/action.go1
158:7unused-receiver
models/activities/action.go:158:7
// TableIndices implements xorm's TableIndices interfacefunc (a *Action) TableIndices() []*schemas.Index { repoIndex := schemas.NewIndex("r_u_d", schemas.IndexType)models/organization/org_test.go1
257:2use-slices-sort
models/organization/org_test.go:257:2
assert.NoError(t, err) sort.Slice(orgUsers, func(i, j int) bool { return orgUsers[i].ID < orgUsers[j].IDmodules/glob/glob_test.go1
30:2var-naming
modules/glob/glob_test.go:30:2
regexp_multiple = `^https:\/\/.*\.google\..*$` fixture_multiple_match = "https://account.google.com" fixture_multiple_mismatch = "https://google.com"modules/packages/alpine/metadata.go1
79:7weak-cryptography
modules/packages/alpine/metadata.go:79:7
h := sha1.New()build/openapi3gen/convert_test.go1
128:67add-constant
build/openapi3gen/convert_test.go:128:67
} if !props["alt"].Value.AllOf[0].Value.Type.Is("string") || props["alt"].Value.AllOf[0].Value.Format != "binary" { t.Errorf("allOf branch not fixed: %+v", props["alt"].Value.AllOf[0].Value)routers/web/repo/setting/secrets.go1
35:5boolean-literal-comparison
routers/web/repo/setting/secrets.go:35:5
func getSecretsCtx(ctx *context.Context) (*secretsCtx, error) { if ctx.Data["PageIsRepoSettings"] == true { return &secretsCtx{build/openapi3gen/enumscan.go1
167:6cognitive-complexity
build/openapi3gen/enumscan.go:167:6
func collectEnumValues(gd *ast.GenDecl, enumTypes map[string]string, enumValues map[string][]any) { for _, spec := range gd.Specs {models/issues/issue_label.go1
145:6confusing-naming
models/issues/issue_label.go:145:6
// NewIssueLabels creates a list of issue-label relations.func NewIssueLabels(ctx context.Context, issue *Issue, labels []*Label, doer *user_model.User) (err error) { return db.WithTx(ctx, func(ctx context.Context) error {modules/indexer/code/internal/util.go1
37:50confusing-results
modules/indexer/code/internal/util.go:37:50
// FilenameMatchIndexPos returns the boundaries of its first seven lines.func FilenameMatchIndexPos(content string) (int, int) { count := 1modules/session/mem.go1
66:6constructor-interface-return
modules/session/mem.go:66:6
func NewMockMemStore(sid string) Store { return &mockMemStore{&mockMemRawStore{session.NewMemStore(sid)}}modules/graceful/manager_common.go1
40:2context-stored-in-struct
modules/graceful/manager_common.go:40:2
hammerCtx context.Context terminateCtx context.Context managerCtx context.Contextcmd/admin_user_delete.go1
48:6cyclomatic-complexity
cmd/admin_user_delete.go:48:6
func runDeleteUser(ctx context.Context, c *cli.Command) error { if !c.IsSet("id") && !c.IsSet("username") && !c.IsSet("email") {cmd/web.go1
101:3deep-exit
cmd/web.go:101:3
if err := os.MkdirAll(filepath.Dir(pidPath), os.ModePerm); err != nil { log.Fatal("Failed to create PID folder: %v", err) }routers/api/v1/misc/markup.go1
62:19deprecated-api-usage
routers/api/v1/misc/markup.go:62:19
form := web.GetForm(ctx).(*api.MarkdownOption) mode := util.Iif(form.Wiki, "wiki", form.Mode) //nolint:staticcheck // form.Wiki is deprecated common.RenderMarkup(ctx.Base, ctx.Repo, mode, form.Text, form.Context, "")cmd/admin_user_list.go1
58:2discarded-error-result
cmd/admin_user_list.go:58:2
w.Flush() return nilmodelmigration/migrations.go1
428:1doc-comment-period
modelmigration/migrations.go:428:1
// GetCurrentDBVersion returns the current db versionfunc GetCurrentDBVersion(x base.EngineMigration) (int64, error) {modules/git/attribute/batch.go1
184:3early-return
modules/git/attribute/batch.go:184:3
read += nulIdx + 1 if l > read { p = p[nulIdx+1:]modelmigration/v1_11/v115.go1
64:23error-strings
modelmigration/v1_11/v115.go:64:23
if err == nil { err = fmt.Errorf("Error: \"%s\" is not a regular file", oldAvatar) }models/asymkey/error.go1
196:6error-type-naming
models/asymkey/error.go:196:6
// ErrKeyAccessDenied represents a "KeyAccessDenied" kind of error.type ErrKeyAccessDenied struct { UserID int64modules/util/truncate.go1
51:2excessive-blank-identifiers
modules/util/truncate.go:51:2
func EllipsisDisplayString(str string, limit int) string { s, _, _, _ := ellipsisDisplayString(str, limit, ellipsisDisplayGuessWidth) return scmd/main.go1
176:6exported-declaration-comment
cmd/main.go:176:6
func RunMainApp(app *cli.Command, args ...string) error { ctx, cancel := installSignals()models/issues/comment_list.go1
1:1file-length-limit
models/issues/comment_list.go:1:1
// Copyright 2018 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MITmodels/activities/repo_activity.go1
48:111flag-parameter
models/activities/repo_activity.go:48:111
// GetActivityStats return stats for repository at given time rangefunc GetActivityStats(ctx context.Context, repo *repo_model.Repository, timeFrom time.Time, releases, issues, prs, code bool) (*ActivityStats, error) { stats := &ActivityStats{Code: &git.CodeActivityStats{}}cmd/admin_auth_oauth.go1
1:1format
cmd/admin_auth_oauth.go:1:1
// Copyright 2023 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MIT- Fix (safe): run `strider fmt cmd/admin_auth_oauth.go`
cmd/admin_auth_oauth_test.go1
159:6function-length
cmd/admin_auth_oauth_test.go:159:6
func TestUpdateOauth(t *testing.T) { testCases := []struct {modules/indexer/code/elasticsearch/elasticsearch.go1
255:6function-result-limit
modules/indexer/code/elasticsearch/elasticsearch.go:255:6
func convertResult(searchResult *es.SearchResponse, kw string, pageSize int) (int64, []*internal.SearchResult, []*internal.SearchResultLanguages, error) { hits := make([]*internal.SearchResult, 0, pageSize)routers/api/packages/container/container.go1
748:6get-function-return-value
routers/api/packages/container/container.go:748:6
// https://github.com/opencontainers/distribution-spec/blob/main/spec.md#content-discoveryfunc GetTagsList(ctx *context.Context) { image := ctx.PathParam("image")modules/actions/github.go1
51:2identical-switch-branches
modules/actions/github.go:51:2
return true case webhook_module.HookEventSchedule: // GitHub "schedule" eventcmd/admin_user_change_password_test.go1
12:2import-alias-naming
cmd/admin_user_change_password_test.go:12:2
"gitea.dev/models/unittest" user_model "gitea.dev/models/user"models/db/engine.go1
132:18import-shadowing
models/db/engine.go:132:18
// NamesToBean return a list of beans or an errorfunc NamesToBean(names ...string) ([]any, error) { beans := []any{}routers/api/actions/artifactsv4.go1
603:4inefficient-map-lookup
routers/api/actions/artifactsv4.go:603:4
if _, ok := table[artifact.ArtifactName]; ok || req.IdFilter != nil && artifact.ID != req.IdFilter.Value || req.NameFilter != nil && artifact.ArtifactName != req.NameFilter.Value { table[artifact.ArtifactName] = nil continuemodels/auth/oauth2_test.go1
102:42insecure-url-scheme
models/auth/oauth2_test.go:102:42
// not loopback assert.False(t, app.ContainsRedirectURI("http://192.168.0.1:9954/")) assert.False(t, app.ContainsRedirectURI("http://intranet:3456/"))modules/actions/jobparser/model.go1
430:7max-control-nesting
modules/actions/jobparser/model.go:430:7
} else { switch content.Kind { case yaml.SequenceNode:modelmigration/v1_22/v286_test.go1
51:7max-public-structs
modelmigration/v1_22/v286_test.go:51:7
type Release struct { ID int64cmd/admin_auth_ldap.go1
259:3modifies-parameter
cmd/admin_auth_ldap.go:259:3
if c.IsSet("port") { config.Port = c.Int("port") }modules/private/pushoptions.go1
41:3modifies-value-receiver
modules/private/pushoptions.go:41:3
if len(kv) == 2 { g[kv[0]] = kv[1] } else {cmd/cert_test.go1
69:13nested-structs
cmd/cert_test.go:69:13
func TestCertCommandFailures(t *testing.T) { cases := []struct { name stringmodels/issues/issue_label.go1
102:4nil-error-return
models/issues/issue_label.go:102:4
if err = RemoveDuplicateExclusiveIssueLabels(ctx, issue, label, doer); err != nil { return nil }models/git/lfs_lock.go1
145:2nil-value-with-nil-error
models/git/lfs_lock.go:145:2
} return nil, nil //nolint:nilnil // return nil to indicate that the object does not exist}modules/packages/conda/metadata.go1
118:4no-defer-in-loop
modules/packages/conda/metadata.go:118:4
} defer dec.Close()modelmigration/v1_21/v264.go1
36:4no-else-after-return
modelmigration/v1_21/v264.go:36:4
return err } else if !exist { return nilmodels/actions/task.go1
65:6no-init
models/actions/task.go:65:6
func init() { db.RegisterModel(new(ActionTask), func() error {cmd/embedded.go1
25:5no-package-var
cmd/embedded.go:25:5
var matchedAssetFiles []assetFilecmd/admin_regenerate.go1
4:9package-comments
cmd/admin_regenerate.go:4:9
package cmdmodelmigration/v1_10/v98.go2
4:9package-directory-mismatch
modelmigration/v1_10/v98.go:4:9
package v1_104:9package-naming
modelmigration/v1_10/v98.go:4:9
package v1_10modelmigration/v1_13/v147.go1
92:14range-value-address
modelmigration/v1_13/v147.go:92:14
for _, comment := range comments { review := &Review{ Type: ReviewTypeComment,modelmigration/v1_20/v259_test.go1
79:18redundant-conversion
modelmigration/v1_20/v259_test.go:79:18
assert.NoError(t, err) assert.Equal(t, int64(0), count)services/webhook/telegram.go1
133:2single-case-switch
services/webhook/telegram.go:133:2
var text, extraMarkdown string switch p.Action { case api.HookIssueReviewed:modules/auth/password/hash/hash_test.go1
46:2slice-preallocation
modules/auth/password/hash/hash_test.go:46:2
func TestParse(t *testing.T) { hashAlgorithmsToTest := []string{} for plainHashAlgorithmNames := range availableHasherFactories {models/actions/run_job.go1
26:1task-comment
models/actions/run_job.go:26:1
// https://docs.github.com/en/actions/reference/limits#existing-system-limits// TODO: check this limit when creating jobsconst MaxJobNumPerRun = 256modelmigration/v1_27/v338.go1
23:1top-level-declaration-order
modelmigration/v1_27/v338.go:23:1
type commentWithLongTextFields struct { Content string `xorm:"LONGTEXT"`models/asymkey/ssh_key_authorized_keys.go1
166:47unchecked-type-assertion
models/asymkey/ssh_key_authorized_keys.go:166:47
if err := db.GetEngine(ctx).Where("type != ?", KeyTypePrincipal).Iterate(new(PublicKey), func(idx int, bean any) (err error) { return WriteAuthorizedStringForValidKey(bean.(*PublicKey), t) }); err != nil {models/init.go1
13:11unused-parameter
models/init.go:13:11
// Init initialize modelfunc Init(ctx context.Context) error { return unit.LoadUnitConfig()models/activities/notification.go1
76:7unused-receiver
models/activities/notification.go:76:7
// TableIndices implements xorm's TableIndices interfacefunc (n *Notification) TableIndices() []*schemas.Index { indices := make([]*schemas.Index, 0, 8)models/organization/org_worktime.go1
61:2use-slices-sort
models/organization/org_worktime.go:61:2
// TODO: pgsql: NULL values are sorted last in default ascending order, so we need to sort them manually again. sort.Slice(results, func(i, j int) bool { if results[i].RepoName != results[j].RepoName {modules/glob/glob_test.go1
31:2var-naming
modules/glob/glob_test.go:31:2
fixture_multiple_match = "https://account.google.com" fixture_multiple_mismatch = "https://google.com"modules/packages/alpine/metadata.go1
119:7weak-cryptography
modules/packages/alpine/metadata.go:119:7
h = sha1.New()build/openapi3gen/convert_test.go1
128:105add-constant
build/openapi3gen/convert_test.go:128:105
} if !props["alt"].Value.AllOf[0].Value.Type.Is("string") || props["alt"].Value.AllOf[0].Value.Format != "binary" { t.Errorf("allOf branch not fixed: %+v", props["alt"].Value.AllOf[0].Value)routers/web/repo/setting/secrets.go1
45:5boolean-literal-comparison
routers/web/repo/setting/secrets.go:45:5
if ctx.Data["PageIsOrgSettings"] == true { if _, err := shared_user.RenderUserOrgHeader(ctx); err != nil {cmd/admin.go1
104:6cognitive-complexity
cmd/admin.go:104:6
func runRepoSyncReleases(ctx context.Context, _ *cli.Command) error { if err := initDB(ctx); err != nil {models/issues/issue_label.go1
187:6confusing-naming
models/issues/issue_label.go:187:6
// DeleteIssueLabel deletes issue-label relation.func DeleteIssueLabel(ctx context.Context, issue *Issue, label *Label, doer *user_model.User) error { if err := deleteIssueLabel(ctx, issue, label, doer); err != nil {modules/indexer/code/search.go1
37:80confusing-results
modules/indexer/code/search.go:37:80
func indices(content string, selectionStartIndex, selectionEndIndex int) (int, int) { startIndex := selectionStartIndexmodules/setting/config_provider.go1
192:6constructor-interface-return
modules/setting/config_provider.go:192:6
// NewConfigProviderFromData this function is mainly for testing purposefunc NewConfigProviderFromData(configContent string) (ConfigProvider, error) { cfg, err := ini.LoadSources(configProviderLoadOptions(), strings.NewReader(configContent))modules/graceful/manager_common.go1
41:2context-stored-in-struct
modules/graceful/manager_common.go:41:2
terminateCtx context.Context managerCtx context.Context shutdownCtxCancel context.CancelFunccmd/admin_user_disable_2fa.go1
38:6cyclomatic-complexity
cmd/admin_user_disable_2fa.go:38:6
func runDisableTwoFactor(ctx context.Context, c *cli.Command) error { if !c.IsSet("id") && !c.IsSet("username") {cmd/web.go1
106:3deep-exit
cmd/web.go:106:3
if err != nil { log.Fatal("Failed to create PID file: %v", err) }routers/api/v1/misc/markup_test.go1
48:3deprecated-api-usage
routers/api/v1/misc/markup_test.go:48:3
Context: context, Wiki: wiki, FilePath: filePath,cmd/admin_user_must_change_password.go1
62:2discarded-error-result
cmd/admin_user_must_change_password.go:62:2
// codeql[disable-next-line=go/clear-text-logging] fmt.Printf("Updated %d users setting MustChangePassword to %t\n", n, mustChangePassword) return nilmodelmigration/migrations.go1
456:1doc-comment-period
modelmigration/migrations.go:456:1
// ExpectedDBVersion returns the expected db versionfunc ExpectedDBVersion() int64 {modules/git/pipeline/lfs_find.go1
111:5early-return
modules/git/pipeline/lfs_find.go:111:5
} if len(trees) > 0 { info, _, err = batch.QueryContent(trees[len(trees)-1])modelmigration/v1_12/v125.go1
19:21error-strings
modelmigration/v1_12/v125.go:19:21
if err := x.Sync(new(Review)); err != nil { return fmt.Errorf("Sync: %w", err) }models/asymkey/error.go1
219:6error-type-naming
models/asymkey/error.go:219:6
// ErrDeployKeyNotExist represents a "DeployKeyNotExist" kind of error.type ErrDeployKeyNotExist struct { ID int64routers/api/packages/container/blob.go1
209:2excessive-blank-identifiers
routers/api/packages/container/blob.go:209:2
func digestFromHashSummer(h packages_module.HashSummer) string { _, _, hashSHA256, _ := h.Sums() return "sha256:" + hex.EncodeToString(hashSHA256)cmd/web_graceful.go1
28:6exported-declaration-comment
cmd/web_graceful.go:28:6
// for our install HTTP/HTTPS servicefunc NoInstallListener() { graceful.GetManager().InformCleanup()models/issues/issue.go1
1:1file-length-limit
models/issues/issue.go:1:1
// Copyright 2014 The Gogs Authors. All rights reserved.// Copyright 2020 The Gitea Authors. All rights reserved.models/activities/repo_activity.go1
48:116flag-parameter
models/activities/repo_activity.go:48:116
// GetActivityStats return stats for repository at given time rangefunc GetActivityStats(ctx context.Context, repo *repo_model.Repository, timeFrom time.Time, releases, issues, prs, code bool) (*ActivityStats, error) { stats := &ActivityStats{Code: &git.CodeActivityStats{}}cmd/admin_auth_oauth_test.go1
1:1format
cmd/admin_auth_oauth_test.go:1:1
// Copyright 2025 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MIT- Fix (safe): run `strider fmt cmd/admin_auth_oauth_test.go`
cmd/admin_auth_smtp_test.go1
17:6function-length
cmd/admin_auth_smtp_test.go:17:6
func TestAddSMTP(t *testing.T) { testCases := []struct {modules/indexer/code/elasticsearch/elasticsearch.go1
323:19function-result-limit
modules/indexer/code/elasticsearch/elasticsearch.go:323:19
// Search searches for codes and language stats by given conditions.func (b *Indexer) Search(ctx context.Context, opts *internal.SearchOptions) (int64, []*internal.SearchResult, []*internal.SearchResultLanguages, error) { searchMode := util.IfZero(opts.SearchMode, b.SupportedSearchModes()[0].ModeValue)routers/api/packages/debian/debian.go1
31:6get-function-return-value
routers/api/packages/debian/debian.go:31:6
func GetRepositoryKey(ctx *context.Context) { _, pub, err := debian_service.GetOrCreateKeyPair(ctx, ctx.Package.Owner.ID)modules/actions/github.go1
55:2identical-switch-branches
modules/actions/github.go:55:2
return true case webhook_module.HookEventIssues, webhook_module.HookEventIssueAssign,cmd/admin_user_create.go1
12:2import-alias-naming
cmd/admin_user_create.go:12:2
auth_model "gitea.dev/models/auth" "gitea.dev/models/db"models/git/commit_status.go1
543:30import-shadowing
models/git/commit_status.go:543:30
// disambiguating data into the input.func HashCommitStatusContext(context string) string { return fmt.Sprintf("%x", sha1.Sum([]byte(context)))routers/api/packages/chef/chef.go1
68:4inefficient-map-lookup
routers/api/packages/chef/chef.go:68:4
if _, ok := universe[pd.Package.Name]; !ok { universe[pd.Package.Name] = make(map[string]*VersionInfo) }models/auth/oauth2_test.go1
103:42insecure-url-scheme
models/auth/oauth2_test.go:103:42
assert.False(t, app.ContainsRedirectURI("http://192.168.0.1:9954/")) assert.False(t, app.ContainsRedirectURI("http://intranet:3456/")) // unparseablemodules/actions/jobparser/model.go1
434:8max-control-nesting
modules/actions/jobparser/model.go:434:8
err := content.Decode(&t) if err != nil { return nil, errmodelmigration/v1_22/v286_test.go1
56:7max-public-structs
modelmigration/v1_22/v286_test.go:56:7
type RepoIndexerStatus struct { ID int64cmd/admin_auth_ldap.go1
266:3modifies-parameter
cmd/admin_auth_ldap.go:266:3
} config.SecurityProtocol = p }modules/private/pushoptions.go1
43:3modifies-value-receiver
modules/private/pushoptions.go:43:3
} else { g[kv[0]] = "" }cmd/cmdtest/cmd_test.go1
78:13nested-structs
cmd/cmdtest/cmd_test.go:78:13
cases := []struct { env map[string]stringmodels/issues/label.go1
239:4nil-error-return
models/issues/label.go:239:4
if IsErrLabelNotExist(err) { return nil }models/git/protected_branch.go1
347:3nil-value-with-nil-error
models/git/protected_branch.go:347:3
} else if !exist { return nil, nil //nolint:nilnil // return nil to indicate that the object does not exist }modules/packages/cran/metadata.go1
135:4no-defer-in-loop
modules/packages/cran/metadata.go:135:4
} defer f.Close()modelmigration/v1_21/v264.go1
57:4no-else-after-return
modelmigration/v1_21/v264.go:57:4
return err } else if !has { return errors.New("no admin user found")models/actions/task_output.go1
23:6no-init
models/actions/task_output.go:23:6
func init() { db.RegisterModel(new(ActionTaskOutput))cmd/main.go1
19:5no-package-var
cmd/main.go:19:5
var cliHelpPrinterOld = cli.HelpPrintercmd/admin_user.go1
4:9package-comments
cmd/admin_user.go:4:9
package cmdmodelmigration/v1_10/v99.go2
4:9package-directory-mismatch
modelmigration/v1_10/v99.go:4:9
package v1_104:9package-naming
modelmigration/v1_10/v99.go:4:9
package v1_10modelmigration/v1_13/v147.go1
108:21range-value-address
modelmigration/v1_13/v147.go:108:21
reviewComment := &Comment{ Type: 22,modelmigration/v1_22/v293_test.go1
46:18redundant-conversion
modelmigration/v1_22/v293_test.go:46:18
assert.True(t, has) assert.Equal(t, int64(1), defaultColumn.ProjectID) assert.True(t, defaultColumn.Default)services/webhook/wechatwork.go1
130:2single-case-switch
services/webhook/wechatwork.go:130:2
var text, title string switch p.Action { case api.HookIssueReviewed:modules/auth/password/hash/hash_test.go1
64:2slice-preallocation
modules/auth/password/hash/hash_test.go:64:2
func TestHashing(t *testing.T) { hashAlgorithmsToTest := []string{} for plainHashAlgorithmNames := range availableHasherFactories {models/actions/run_job.go1
474:4task-comment
models/actions/run_job.go:474:4
} else { // TODO: Remove this fallback in the future. // Legacy fallback: jobs created before migration v331 have RunAttemptID=0 and are NOT backfilled.modelmigration/v1_27/v338_test.go1
25:1top-level-declaration-order
modelmigration/v1_27/v338_test.go:25:1
type commentBeforeLongTextMSSQLMigration struct { ID int64 `xorm:"pk autoincr"`models/auth/source.go1
106:75unchecked-type-assertion
models/auth/source.go:106:75
registeredConfigs[typ] = func() Config { return reflect.New(reflect.ValueOf(exemplar).Elem().Type()).Interface().(Config) }models/repo/repo.go1
672:29unused-parameter
models/repo/repo.go:672:29
// ComposeTeaCloneCommand returns Tea CLI clone command based on the given owner and repository name.func ComposeTeaCloneCommand(ctx context.Context, owner, repo string) string { return fmt.Sprintf("tea clone %s/%s", url.PathEscape(owner), url.PathEscape(repo))models/activities/notification_list.go1
65:7unused-receiver
models/activities/notification_list.go:65:7
func (opts FindNotificationOptions) ToOrders() string { return "notification.updated_unix DESC"models/repo/language_stats.go1
84:2use-slices-sort
models/repo/language_stats.go:84:2
// Sort the keys by the largest remainder sort.SliceStable(keys, func(i, j int) bool { _, remainderI := math.Modf(float64(percs[keys[i]]))modules/glob/glob_test.go1
33:2var-naming
modules/glob/glob_test.go:33:2
pattern_alternatives = "{https://*.google.*,*yandex.*,*yahoo.*,*mail.ru}" regexp_alternatives = `^(https:\/\/.*\.google\..*|.*yandex\..*|.*yahoo\..*|.*mail\.ru)$`modules/packages/multi_hasher.go1
43:9weak-cryptography
modules/packages/multi_hasher.go:43:9
func NewMultiHasher() *MultiHasher { md5 := md5.New() sha1 := sha1.New()build/openapi3gen/convert_test.go1
131:67add-constant
build/openapi3gen/convert_test.go:131:67
} if !props["one"].Value.OneOf[0].Value.Type.Is("string") || props["one"].Value.OneOf[0].Value.Format != "binary" { t.Errorf("oneOf branch not fixed: %+v", props["one"].Value.OneOf[0].Value)routers/web/repo/setting/secrets.go1
59:5boolean-literal-comparison
routers/web/repo/setting/secrets.go:59:5
if ctx.Data["PageIsUserSettings"] == true { return &secretsCtx{cmd/admin_auth_ldap.go1
251:6cognitive-complexity
cmd/admin_auth_ldap.go:251:6
// parseLdapConfig assigns values on config according to command line flags.func parseLdapConfig(c *cli.Command, config *ldap.Source) error { if c.IsSet("name") {models/issues/issue_label.go1
351:6confusing-naming
models/issues/issue_label.go:351:6
// Triggers appropriate WebHooks, if any.func ClearIssueLabels(ctx context.Context, issue *Issue, doer *user_model.User) (err error) { return db.WithTx(ctx, func(ctx context.Context) error {modules/indexer/internal/paginator.go1
13:70confusing-results
modules/indexer/internal/paginator.go:13:70
// ParsePaginator parses a db.Paginator into a skip and limitfunc ParsePaginator(paginator *db.ListOptions, maxNums ...int) (int, int) { // Use a very large number to indicate no limitmodules/setting/config_provider.go1
206:6constructor-interface-return
modules/setting/config_provider.go:206:6
// NOTE: do not print any log except error.func NewConfigProviderFromFile(file string) (ConfigProvider, error) { cfg := ini.Empty(configProviderLoadOptions())modules/hcaptcha/hcaptcha.go1
21:2context-stored-in-struct
modules/hcaptcha/hcaptcha.go:21:2
type Client struct { ctx context.Context http *http.Clientcmd/cert.go1
106:6cyclomatic-complexity
cmd/cert.go:106:6
func runCert(_ context.Context, c *cli.Command) error { var priv anycmd/web.go1
110:3deep-exit
cmd/web.go:110:3
if _, err := file.WriteString(strconv.FormatInt(int64(currentPid), 10)); err != nil { log.Fatal("Failed to write PID information: %v", err) }routers/api/v1/misc/markup_test.go1
72:3deprecated-api-usage
routers/api/v1/misc/markup_test.go:72:3
Context: context, Wiki: wiki, }cmd/config_test.go1
17:6discarded-error-result
cmd/config_test.go:17:6
configTemplate := tmpDir + "/app-template.ini" _ = os.WriteFile(configOld, []byte(`[sec]modelmigration/migrations.go1
461:1doc-comment-period
modelmigration/migrations.go:461:1
// EnsureUpToDate will check if the db is at the correct versionfunc EnsureUpToDate(ctx context.Context, x base.EngineMigration) error {modules/git/repo_compare.go1
128:2early-return
modules/git/repo_compare.go:128:2
commitSHAGroups := patchCommits.FindStringSubmatch(scanner.Text()) if len(commitSHAGroups) != 0 { commitSHA = commitSHAGroups[1]modelmigration/v1_12/v127.go1
37:21error-strings
modelmigration/v1_12/v127.go:37:21
if err := x.Sync(new(LanguageStat)); err != nil { return fmt.Errorf("Sync: %w", err) }models/asymkey/error.go1
240:6error-type-naming
models/asymkey/error.go:240:6
// ErrDeployKeyAlreadyExist represents a "DeployKeyAlreadyExist" kind of error.type ErrDeployKeyAlreadyExist struct { KeyID int64routers/api/packages/pypi/pypi.go1
125:2excessive-blank-identifiers
routers/api/packages/pypi/pypi.go:125:2
_, _, hashSHA256, _ := buf.Sums()main.go1
29:2exported-declaration-comment
main.go:29:2
var ( Version = "development" // program version for this build Tags = "" // the Golang build tagsmodels/issues/issue_list.go1
1:1file-length-limit
models/issues/issue_list.go:1:1
// Copyright 2017 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MITmodels/activities/repo_activity.go1
249:94flag-parameter
models/activities/repo_activity.go:249:94
func pullRequestsForActivityStatement(ctx context.Context, repoID int64, fromTime time.Time, merged bool) db.Session { sess := db.GetEngine(ctx).Where("pull_request.base_repo_id=?", repoID).cmd/admin_auth_smtp.go1
1:1format
cmd/admin_auth_smtp.go:1:1
// Copyright 2023 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MIT- Fix (safe): run `strider fmt cmd/admin_auth_smtp.go`
cmd/admin_auth_smtp_test.go1
133:6function-length
cmd/admin_auth_smtp_test.go:133:6
func TestUpdateSMTP(t *testing.T) { testCases := []struct {modules/indexer/code/internal/indexer.go1
58:24function-result-limit
modules/indexer/code/internal/indexer.go:58:24
func (d *dummyIndexer) Search(ctx context.Context, opts *SearchOptions) (int64, []*SearchResult, []*SearchResultLanguages, error) { return 0, nil, nil, errors.New("indexer is not ready")routers/api/packages/debian/debian.go1
46:6get-function-return-value
routers/api/packages/debian/debian.go:46:6
// https://wiki.debian.org/DebianRepository/Format#A.22Packages.22_Indicesfunc GetRepositoryFile(ctx *context.Context) { pv, err := debian_service.GetOrCreateRepositoryVersion(ctx, ctx.Package.Owner.ID)modules/actions/github.go1
62:2identical-switch-branches
modules/actions/github.go:62:2
return true case webhook_module.HookEventWorkflowRun: // GitHub "workflow_run" eventcmd/admin_user_create.go1
14:2import-alias-naming
cmd/admin_user_create.go:14:2
"gitea.dev/models/db" user_model "gitea.dev/models/user" pwd "gitea.dev/modules/auth/password"models/git/protected_branch.go1
288:2import-shadowing
models/git/protected_branch.go:288:2
func (protectBranch *ProtectedBranch) MergeBlockedByProtectedFiles(changedProtectedFiles []string) bool { glob := protectBranch.GetProtectedFilePatterns() if len(glob) == 0 {routers/web/repo/release.go1
62:3inefficient-map-lookup
routers/web/repo/release.go:62:3
} countCache[target], err = git.CommitsCountOfCommit(ctx, repoCtx.Repository, commit.ID.String()) if err != nil {models/auth/oauth2_test.go1
109:62insecure-url-scheme
models/auth/oauth2_test.go:109:62
func TestOAuth2Application_ContainsRedirect_Slash(t *testing.T) { app := &auth_model.OAuth2Application{RedirectURIs: []string{"http://127.0.0.1"}} assert.True(t, app.ContainsRedirectURI("http://127.0.0.1"))modules/actions/jobparser/model.go1
441:8max-control-nesting
modules/actions/jobparser/model.go:441:8
err := content.Decode(&t) if err != nil { return nil, errmodelmigration/v1_22/v286_test.go1
61:7max-public-structs
modelmigration/v1_22/v286_test.go:61:7
type Review struct { ID int64cmd/admin_auth_ldap.go1
269:3modifies-parameter
cmd/admin_auth_ldap.go:269:3
if c.IsSet("skip-tls-verify") { config.SkipVerify = c.Bool("skip-tls-verify") }services/context/context_template.go1
112:3modifies-value-receiver
services/context/context_template.go:112:3
ret = util.FastCryptoRandomHex(32) // 16 bytes / 128 bits entropy c["_cspScriptNonce"] = ret }cmd/serv_test.go1
16:13nested-structs
cmd/serv_test.go:16:13
func TestGetAccessMode(t *testing.T) { cases := []struct { verb, lfsVerb stringmodels/issues/milestone.go1
258:4nil-error-return
models/issues/milestone.go:258:4
if IsErrMilestoneNotExist(err) { return nil }models/git/protected_branch.go1
358:3nil-value-with-nil-error
models/git/protected_branch.go:358:3
} else if !exist { return nil, nil //nolint:nilnil // return nil to indicate that the object does not exist }modules/packages/debian/metadata.go1
116:5no-defer-in-loop
modules/packages/debian/metadata.go:116:5
} defer gzr.Close()modelmigration/v1_26/v326.go1
292:5no-else-after-return
modelmigration/v1_26/v326.go:292:5
return "", errors.New("pull request is missing in event payload") } else if payload.PullRequest.Head == nil { return "", errors.New("head of pull request is missing in event payload")models/actions/task_step.go1
34:6no-init
models/actions/task_step.go:34:6
func init() { db.RegisterModel(new(ActionTaskStep))cmd/web.go1
35:5no-package-var
cmd/web.go:35:5
// PIDFile could be set from build tagvar PIDFile = "/run/gitea.pid"cmd/admin_user_change_password.go1
4:9package-comments
cmd/admin_user_change_password.go:4:9
package cmdmodelmigration/v1_11/v102.go2
4:9package-directory-mismatch
modelmigration/v1_11/v102.go:4:9
package v1_114:9package-naming
modelmigration/v1_11/v102.go:4:9
package v1_11modelmigration/v1_15/v181.go1
71:30range-value-address
modelmigration/v1_15/v181.go:71:30
if !exist { if _, err := sess.Insert(&EmailAddress{ UID: user.ID,modelmigration/v1_22/v293_test.go1
54:18redundant-conversion
modelmigration/v1_22/v293_test.go:54:18
assert.True(t, has) assert.Equal(t, int64(2), expectDefaultColumn.ProjectID) assert.False(t, expectDefaultColumn.Default)modules/git/commit_info_nogogit.go1
87:6slice-preallocation
modules/git/commit_info_nogogit.go:87:6
func getLastCommitForPathsByCache(ctx context.Context, commitID, treePath string, paths []string, cache *LastCommitCache) (map[string]*Commit, []string, error) { var unHitEntryPaths []string results := make(map[string]*Commit)models/actions/task.go1
260:2task-comment
models/actions/task.go:260:2
// TODO: a more efficient way to filter labels log.Trace("runner labels: %v", runner.AgentLabels)modelmigration/v1_27/v341.go1
35:1top-level-declaration-order
modelmigration/v1_27/v341.go:35:1
type lfsLockWithCreated struct { Created time.Time `xorm:"created"`models/auth/source.go1
113:66unchecked-type-assertion
models/auth/source.go:113:66
registeredConfigs[typ] = func() Config { return reflect.New(reflect.TypeOf(exemplar)).Elem().Interface().(Config) }models/system/notice.go1
64:30unused-parameter
models/system/notice.go:64:30
// creates a system notice when error occurs.func RemoveStorageWithNotice(ctx context.Context, bucket storage.ObjectStorage, title, path string) { if err := bucket.Delete(path); err != nil {models/admin/task.go1
171:7unused-receiver
models/admin/task.go:171:7
func (err ErrTaskDoesNotExist) Unwrap() error { return util.ErrNotExistmodules/actions/jobparser/jobparser.go1
124:2use-slices-sort
modules/actions/jobparser/jobparser.go:124:2
} sort.Slice(ret, func(i, j int) bool { return matrixName(ret[i]) < matrixName(ret[j])modules/glob/glob_test.go1
34:2var-naming
modules/glob/glob_test.go:34:2
pattern_alternatives = "{https://*.google.*,*yandex.*,*yahoo.*,*mail.ru}" regexp_alternatives = `^(https:\/\/.*\.google\..*|.*yandex\..*|.*yahoo\..*|.*mail\.ru)$` fixture_alternatives_match = "http://yahoo.com"modules/packages/multi_hasher.go1
44:10weak-cryptography
modules/packages/multi_hasher.go:44:10
md5 := md5.New() sha1 := sha1.New() sha256 := sha256.New()build/openapi3gen/convert_test.go1
134:67add-constant
build/openapi3gen/convert_test.go:134:67
} if !props["any"].Value.AnyOf[0].Value.Type.Is("string") || props["any"].Value.AnyOf[0].Value.Format != "binary" { t.Errorf("anyOf branch not fixed: %+v", props["any"].Value.AnyOf[0].Value)routers/web/repo/setting/webhook.go1
72:5boolean-literal-comparison
routers/web/repo/setting/webhook.go:72:5
func getOwnerRepoCtx(ctx *context.Context) (*ownerRepoCtx, error) { if ctx.Data["PageIsRepoSettings"] == true { return &ownerRepoCtx{cmd/admin_auth_oauth.go1
215:23cognitive-complexity
cmd/admin_auth_oauth.go:215:23
func (a *authService) runUpdateOauth(ctx context.Context, c *cli.Command) error { if !c.IsSet("id") {models/issues/issue_list.go1
555:25confusing-naming
models/issues/issue_list.go:555:25
// LoadComments loads commentsfunc (issues IssueList) LoadComments(ctx context.Context) error { return issues.loadComments(ctx, builder.NewCond())modules/process/manager_exec.go1
15:72confusing-results
modules/process/manager_exec.go:15:72
// Exec a command and use the default timeout.func (pm *Manager) Exec(desc, cmdName string, args ...string) (string, string, error) { return pm.ExecDir(DefaultContext, -1, "", desc, cmdName, args...)modules/storage/azureblob.go1
122:6constructor-interface-return
modules/storage/azureblob.go:122:6
// NewAzureBlobStorage returns a azure blob storagefunc NewAzureBlobStorage(ctx context.Context, cfg *setting.Storage) (ObjectStorage, error) { config := cfg.AzureBlobConfigmodules/lfstransfer/backend/backend.go1
35:2context-stored-in-struct
modules/lfstransfer/backend/backend.go:35:2
type GiteaBackend struct { ctx context.Context server *url.URLcmd/config.go1
91:6cyclomatic-complexity
cmd/config.go:91:6
func runConfigEditIni(_ context.Context, c *cli.Command) error { // the config system may change the environment variables, so get a copy first, to be used latercmd/web.go1
211:3deep-exit
cmd/web.go:211:3
if _, err := os.Stat(setting.AppDataPath); err != nil { log.Fatal("Can not find APP_DATA_PATH %q", setting.AppDataPath) }routers/api/v1/repo/branch.go1
226:16deprecated-api-usage
routers/api/v1/repo/branch.go:226:16
} } else if len(opt.OldBranchName) > 0 { //nolint:staticcheck // deprecated field if exist, _ := git_model.IsBranchExist(ctx, ctx.Repo.Repository.ID, opt.OldBranchName); exist { //nolint:staticcheck // deprecated fieldcmd/config_test.go1
23:6discarded-error-result
cmd/config_test.go:23:6
_ = os.WriteFile(configTemplate, []byte(`[sec]modelmigration/migrations.go1
493:1doc-comment-period
modelmigration/migrations.go:493:1
// Migrate database to current versionfunc Migrate(ctx context.Context, x base.EngineMigration) error {modules/highlight/highlight_test.go1
19:3early-return
modules/highlight/highlight_test.go:19:3
for { if p := strings.IndexByte(s, '\n'); p != -1 { out = append(out, template.HTML(s[:p+1]))modelmigration/v1_12/v127.go1
40:21error-strings
modelmigration/v1_12/v127.go:40:21
if err := x.Sync(new(RepoIndexerStatus)); err != nil { return fmt.Errorf("Sync: %w", err) }models/asymkey/error.go1
260:6error-type-naming
models/asymkey/error.go:260:6
// ErrDeployKeyNameAlreadyUsed represents a "DeployKeyNameAlreadyUsed" kind of error.type ErrDeployKeyNameAlreadyUsed struct { RepoID int64routers/web/repo/wiki.go1
286:3excessive-blank-identifiers
routers/web/repo/wiki.go:286:3
if !isSideBar { sidebarContent, _, _, _ := wikiContentsByName(ctx, wikiGitRepo, commit, "_Sidebar") if ctx.Written() {main.go1
30:2exported-declaration-comment
main.go:30:2
Version = "development" // program version for this build Tags = "" // the Golang build tags)models/issues/issue_search.go1
1:1file-length-limit
models/issues/issue_search.go:1:1
// Copyright 2023 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MITmodels/activities/repo_activity.go1
311:105flag-parameter
models/activities/repo_activity.go:311:105
// FillUnresolvedIssues returns unresolved issue and pull request information for activity pagefunc (stats *ActivityStats) FillUnresolvedIssues(ctx context.Context, repoID int64, fromTime time.Time, issues, prs bool) error { // Check if we need to select anythingcmd/admin_auth_smtp_test.go1
1:1format
cmd/admin_auth_smtp_test.go:1:1
// Copyright 2025 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MIT- Fix (safe): run `strider fmt cmd/admin_auth_smtp_test.go`
cmd/admin_user_change_password_test.go1
18:6function-length
cmd/admin_user_change_password_test.go:18:6
func TestChangePasswordCommand(t *testing.T) { ctx := t.Context()modules/indexer/code/search.go1
133:6function-result-limit
modules/indexer/code/search.go:133:6
// PerformSearch perform a search on a repositoryfunc PerformSearch(ctx context.Context, opts *SearchOptions) (int64, []*Result, []*SearchResultLanguages, error) { if opts == nil || len(opts.Keyword) == 0 {routers/api/packages/debian/debian.go1
83:6get-function-return-value
routers/api/packages/debian/debian.go:83:6
// https://wiki.debian.org/DebianRepository/Format#indices_acquisition_via_hashsums_.28by-hash.29func GetRepositoryFileByHash(ctx *context.Context) { pv, err := debian_service.GetOrCreateRepositoryVersion(ctx, ctx.Package.Owner.ID)modules/container/filter_test.go1
19:3identical-switch-branches
modules/container/filter_test.go:19:3
return 0, true // included later case 1: return 0, true // duplicate of previous (should be ignored)cmd/admin_user_create_test.go1
11:2import-alias-naming
cmd/admin_user_create_test.go:11:2
auth_model "gitea.dev/models/auth" "gitea.dev/models/db"models/git/protected_branch.go1
539:3import-shadowing
models/git/protected_branch.go:539:3
} perm, err := access_model.GetIndividualUserRepoPermission(ctx, repo, user) if err != nil {routers/web/shared/user/header.go1
79:6inefficient-map-lookup
routers/web/shared/user/header.go:79:6
if _, ok := ctx.Data["NumFollowers"]; !ok { _, ctx.Data["NumFollowers"], _ = user_model.GetUserFollowers(ctx, ctx.ContextUser, ctx.Doer, db.ListOptions{PageSize: 1, Page: 1}) }models/auth/oauth2_test.go1
110:41insecure-url-scheme
models/auth/oauth2_test.go:110:41
app := &auth_model.OAuth2Application{RedirectURIs: []string{"http://127.0.0.1"}} assert.True(t, app.ContainsRedirectURI("http://127.0.0.1")) assert.True(t, app.ContainsRedirectURI("http://127.0.0.1/"))modules/actions/jobparser/model.go1
446:8max-control-nesting
modules/actions/jobparser/model.go:446:8
case yaml.MappingNode: if k != "workflow_dispatch" || act != "inputs" { return nil, fmt.Errorf("map should only for workflow_dispatch but %s: %#v", act, content)modelmigration/v1_22/v286_test.go1
86:7max-public-structs
modelmigration/v1_22/v286_test.go:86:7
type Repository struct { ID int64 `xorm:"pk autoincr"`cmd/admin_auth_ldap.go1
272:3modifies-parameter
cmd/admin_auth_ldap.go:272:3
if c.IsSet("bind-dn") { config.BindDN = c.String("bind-dn") }cmd/serv_test.go1
43:13nested-structs
cmd/serv_test.go:43:13
func TestGetAccessModeUnknownVerb(t *testing.T) { cases := []struct{ verb, lfsVerb string }{ {git.CmdVerbLfsAuthenticate, ""},models/organization/org_user.go1
65:4nil-error-return
models/organization/org_user.go:65:4
log.Error("Organization does not have owner team: %d", orgID) return false, nil }models/git/protected_tag.go1
109:3nil-value-with-nil-error
models/git/protected_tag.go:109:3
if !has { return nil, nil //nolint:nilnil // return nil to indicate that the object does not exist }modules/packages/debian/metadata.go1
131:5no-defer-in-loop
modules/packages/debian/metadata.go:131:5
} defer zr.Close()modelmigration/v1_26/v326.go1
305:5no-else-after-return
modelmigration/v1_26/v326.go:305:5
return "", errors.New("pull request is missing in event payload") } else if payload.PullRequest.Head == nil { return "", errors.New("head of pull request is missing in event payload")models/actions/tasks_version.go1
27:6no-init
models/actions/tasks_version.go:27:6
func init() { db.RegisterModel(new(ActionTasksVersion))cmd/web_https.go1
19:5no-package-var
cmd/web_https.go:19:5
var tlsVersionStringMap = map[string]uint16{ "": tls.VersionTLS12, // Default to tls.VersionTLS12cmd/admin_user_create.go1
4:9package-comments
cmd/admin_user_create.go:4:9
package cmdmodelmigration/v1_11/v103.go2
4:9package-directory-mismatch
modelmigration/v1_11/v103.go:4:9
package v1_114:9package-naming
modelmigration/v1_11/v103.go:4:9
package v1_11modelmigration/v1_16/v210.go1
123:19range-value-address
modelmigration/v1_16/v210.go:123:19
} remigrated := &webauthnCredential{ ID: reg.ID,modelmigration/v1_22/v293_test.go1
61:18redundant-conversion
modelmigration/v1_22/v293_test.go:61:18
assert.True(t, has) assert.Equal(t, int64(2), expectNonDefaultColumn.ProjectID) assert.True(t, expectNonDefaultColumn.Default)modules/hostmatcher/hostmatcher.go1
38:6slice-preallocation
modules/hostmatcher/hostmatcher.go:38:6
var reservedIPNets = sync.OnceValue(func() []*net.IPNet { var nets []*net.IPNet for _, cidr := range []string{models/actions/task_list.go1
36:2task-comment
models/actions/task_list.go:36:2
// TODO: Replace with "ActionJobList(maps.Values(jobs))" once available var jobsList ActionJobList = make([]*ActionRunJob, 0, len(jobs))modelmigration/v1_27/v341_test.go1
27:1top-level-declaration-order
modelmigration/v1_27/v341_test.go:27:1
type lfsLockBeforeDateTimeMigration struct { ID int64 `xorm:"pk autoincr"`models/db/context_test.go1
110:15unchecked-type-assertion
models/db/context_test.go:110:15
// and the internal states (including "cond" and others) are always there and not be reset in this callback. m1 := bean.(*TestModel1) assert.EqualValues(t, i+1, m1.ID)models/system/setting.go1
112:41unused-parameter
models/system/setting.go:112:41
func (d *dbConfigCachedGetter) GetValue(ctx context.Context, key string) (v string, has bool) { d.mu.RLock()models/asymkey/error.go1
45:7unused-receiver
models/asymkey/error.go:45:7
func (err ErrKeyNotExist) Unwrap() error { return util.ErrNotExistmodules/charset/generate/generate.go1
67:3use-slices-sort
modules/charset/generate/generate.go:67:3
} sort.Slice(pairs, func(i, j int) bool { return pairs[i].Confusable < pairs[j].Confusablemodules/glob/glob_test.go1
35:2var-naming
modules/glob/glob_test.go:35:2
regexp_alternatives = `^(https:\/\/.*\.google\..*|.*yandex\..*|.*yahoo\..*|.*mail\.ru)$` fixture_alternatives_match = "http://yahoo.com" fixture_alternatives_mismatch = "http://google.com"modules/packages/npm/creator.go1
337:11weak-cryptography
modules/packages/npm/creator.go:337:11
case "sha1": tmp := sha1.Sum(data) hash = tmp[:]build/openapi3gen/convert_test.go1
137:62add-constant
build/openapi3gen/convert_test.go:137:62
} if !props["not"].Value.Not.Value.Type.Is("string") || props["not"].Value.Not.Value.Format != "binary" { t.Errorf("not branch not fixed: %+v", props["not"].Value.Not.Value)routers/web/repo/setting/webhook.go1
81:5boolean-literal-comparison
routers/web/repo/setting/webhook.go:81:5
if ctx.Data["PageIsOrgSettings"] == true { return &ownerRepoCtx{cmd/admin_auth_smtp.go1
98:6cognitive-complexity
cmd/admin_auth_smtp.go:98:6
func parseSMTPConfig(c *cli.Command, conf *smtp.Source) error { if c.IsSet("auth-type") {models/issues/milestone.go1
173:6confusing-naming
models/issues/milestone.go:173:6
func updateMilestone(ctx context.Context, m *Milestone) error { m.Name = strings.TrimSpace(m.Name)modules/process/manager_exec.go1
20:102confusing-results
modules/process/manager_exec.go:20:102
// ExecTimeout a command and use a specific timeout duration.func (pm *Manager) ExecTimeout(timeout time.Duration, desc, cmdName string, args ...string) (string, string, error) { return pm.ExecDir(DefaultContext, timeout, "", desc, cmdName, args...)modules/storage/local.go1
30:6constructor-interface-return
modules/storage/local.go:30:6
// NewLocalStorage returns a local filesfunc NewLocalStorage(ctx context.Context, config *setting.Storage) (ObjectStorage, error) { // prepare storage root pathmodules/lfstransfer/backend/lock.go1
25:2context-stored-in-struct
modules/lfstransfer/backend/lock.go:25:2
type giteaLockBackend struct { ctx context.Context g *GiteaBackendcmd/doctor.go1
164:6cyclomatic-complexity
cmd/doctor.go:164:6
func runDoctorCheck(ctx context.Context, cmd *cli.Command) error { colorize := log.CanColorStdoutcmd/web.go1
375:3deep-exit
cmd/web.go:375:3
default: log.Fatal("Invalid protocol: %s", setting.Protocol) }routers/api/v1/repo/branch.go1
227:71deprecated-api-usage
routers/api/v1/repo/branch.go:227:71
} else if len(opt.OldBranchName) > 0 { //nolint:staticcheck // deprecated field if exist, _ := git_model.IsBranchExist(ctx, ctx.Repo.Repository.ID, opt.OldBranchName); exist { //nolint:staticcheck // deprecated field oldCommit, err = ctx.Repo.GitRepo.GetBranchCommit(ctx, opt.OldBranchName) //nolint:staticcheck // deprecated fieldcmd/config_test.go1
48:14discarded-error-result
cmd/config_test.go:48:14
// [env] is applied from environment variable data, _ := os.ReadFile(configNew) require.Equal(t, `[sec]modelmigration/migrationtest/tests.go1
26:1doc-comment-period
modelmigration/migrationtest/tests.go:26:1
//// fixtures in `modelmigration/fixtures/<TestName>` will be loaded automaticallyfunc PrepareTestEnv(t *testing.T, skip int, syncModels ...any) (base.EngineMigration, func()) {modules/indexer/code/elasticsearch/elasticsearch.go1
270:10early-return
modules/indexer/code/elasticsearch/elasticsearch.go:270:10
startIndex, endIndex = internal.FilenameMatchIndexPos(res["content"].(string)) } else if c, ok := hit.Highlight["content"]; ok && len(c) > 0 { // FIXME: Since the highlighting content will include <em> and </em> for the keywords,modelmigration/v1_12/v128.go1
61:22error-strings
modelmigration/v1_12/v128.go:61:22
if err := x.Limit(limit, start).Asc("id").Find(&prs); err != nil { return fmt.Errorf("Find: %w", err) }models/asymkey/error.go1
280:6error-type-naming
models/asymkey/error.go:280:6
// ErrSSHInvalidTokenSignature represents a "ErrSSHInvalidTokenSignature" kind of error.type ErrSSHInvalidTokenSignature struct { Wrapped errorrouters/web/repo/wiki.go1
298:3excessive-blank-identifiers
routers/web/repo/wiki.go:298:3
if !isFooter { footerContent, _, _, _ := wikiContentsByName(ctx, wikiGitRepo, commit, "_Footer") if ctx.Written() {modelmigration/base/db.go1
23:2exported-declaration-comment
modelmigration/base/db.go:23:2
type ( EngineMigration = db.EngineMigration Session = db.Sessionmodels/issues/issue_update.go1
1:1file-length-limit
models/issues/issue_update.go:1:1
// Copyright 2023 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MIT