Skip to content

optimization

optimization #2323

GitHub Actions / golangci succeeded Mar 11, 2024 in 0s

reviewdog [golangci] report

reported by reviewdog 🐶

Findings (0)
Filtered Findings (120)

clause/clause.go|43 col 21| Error return value of builder.WriteByte is not checked (errcheck)
clause/clause.go|47 col 23| Error return value of builder.WriteString is not checked (errcheck)
clause/clause.go|48 col 21| Error return value of builder.WriteByte is not checked (errcheck)
clause/clause.go|53 col 21| Error return value of builder.WriteByte is not checked (errcheck)
clause/delete.go|12 col 21| Error return value of builder.WriteString is not checked (errcheck)
clause/delete.go|16 col 22| Error return value of builder.WriteString is not checked (errcheck)
clause/expression.go|127 col 3| ifElseChain: rewrite if-else to switch statement (gocritic)
clause/expression.go|105 col 5| singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
clause/expression.go|28 col 1| calculated cyclomatic complexity for function Build is 15, max is 10 (cyclop)
clause/expression.go|85 col 1| calculated cyclomatic complexity for function Build is 37, max is 10 (cyclop)
clause/where.go|43 col 1| calculated cyclomatic complexity for function buildExprs is 19, max is 10 (cyclop)
clause/where.go|168 col 1| calculated cyclomatic complexity for function Build is 21, max is 10 (cyclop)
logger/sql.go|38 col 1| calculated cyclomatic complexity for function ExplainSQL is 47, max is 10 (cyclop)
logger/sql_test.go|11| File is not goimports-ed with -local gorm.io/gorm (goimports)
logger/sql_test.go|33 col 23| format - escaper always receives " ("\"") (unparam)
schema/field.go|832 col 16| Error return value is not checked (errcheck)
schema/field.go|291 col 3| ifElseChain: rewrite if-else to switch statement (gocritic)
schema/field.go|303 col 3| ifElseChain: rewrite if-else to switch statement (gocritic)
schema/field.go|14| File is not goimports-ed with -local gorm.io/gorm (goimports)
schema/relationship.go|9| File is not goimports-ed with -local gorm.io/gorm (goimports)
schema/naming.go|4 col 2| G505: Blocklisted import crypto/sha1: weak cryptographic primitive (gosec)
schema/naming.go|106 col 8| G401: Use of weak cryptographic primitive (gosec)
schema/relationship.go|266 col 2| Consider pre-allocating joinTableFields (prealloc)
schema/field.go|105 col 1| calculated cyclomatic complexity for function ParseField is 120, max is 10 (cyclop)
schema/field.go|445 col 1| calculated cyclomatic complexity for function setupValuerAndSetter is 199, max is 10 (cyclop)
schema/index.go|30 col 1| calculated cyclomatic complexity for function ParseIndexes is 14, max is 10 (cyclop)
schema/index.go|95 col 1| calculated cyclomatic complexity for function parseFieldIndexes is 14, max is 10 (cyclop)
schema/naming.go|129 col 1| calculated cyclomatic complexity for function toDBName is 19, max is 10 (cyclop)
schema/relationship.go|59 col 1| calculated cyclomatic complexity for function parseRelation is 19, max is 10 (cyclop)
schema/relationship.go|187 col 1| calculated cyclomatic complexity for function buildPolymorphicRelation is 13, max is 10 (cyclop)
schema/relationship.go|263 col 1| calculated cyclomatic complexity for function buildMany2ManyRelation is 27, max is 10 (cyclop)
schema/relationship.go|448 col 1| calculated cyclomatic complexity for function guessRelation is 46, max is 10 (cyclop)
schema/relationship.go|645 col 1| calculated cyclomatic complexity for function ParseConstraint is 19, max is 10 (cyclop)
schema/schema.go|121 col 1| calculated cyclomatic complexity for function ParseWithSpecialTableName is 76, max is 10 (cyclop)
schema/schema.go|380 col 1| calculated cyclomatic complexity for function callBackToMethodValue is 11, max is 10 (cyclop)
schema/utils.go|110 col 1| calculated cyclomatic complexity for function GetIdentityFieldValuesMap is 16, max is 10 (cyclop)
schema/naming.go|124 col 83| SA1019: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. (staticcheck)
schema/naming.go|189 col 31| SA1019: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. (staticcheck)
schema/naming.go|191 col 31| SA1019: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. (staticcheck)
utils/utils.go|121 col 1| calculated cyclomatic complexity for function ToString is 12, max is 10 (cyclop)
callbacks.go|107 col 16| Error return value of db.AddError is not checked (errcheck)
callbacks.go|109 col 16| Error return value of db.AddError is not checked (errcheck)
callbacks.go|125 col 15| Error return value of db.AddError is not checked (errcheck)
chainable_api.go|126 col 16| Error return value of tx.AddError is not checked (errcheck)
chainable_api.go|170 col 14| Error return value of tx.AddError is not checked (errcheck)
finisher_api.go|58 col 15| Error return value of tx.AddError is not checked (errcheck)
finisher_api.go|535 col 15| Error return value of tx.ScanRows is not checked (errcheck)
statement.go|84 col 22| Error return value of writer.WriteString is not checked (errcheck)
statement.go|103 col 20| Error return value of writer.WriteByte is not checked (errcheck)
statement.go|113 col 20| Error return value of writer.WriteByte is not checked (errcheck)
statement.go|118 col 21| Error return value of stmt.DB.AddError is not checked (errcheck)
statement.go|131 col 22| Error return value of writer.WriteString is not checked (errcheck)
statement.go|135 col 19| Error return value of writer.WriteByte is not checked (errcheck)
statement.go|205 col 23| Error return value of writer.WriteString is not checked (errcheck)
statement.go|436 col 18| Error return value of stmt.AddError is not checked (errcheck)
statement.go|474 col 19| Error return value of stmt.WriteByte is not checked (errcheck)
statement.go|584 col 19| Error return value of stmt.AddError is not checked (errcheck)
statement.go|586 col 19| Error return value of stmt.AddError is not checked (errcheck)
migrator/migrator.go|325 col 16| Error return value of m.RunWithValue is not checked (errcheck)
migrator/migrator.go|412 col 16| Error return value of m.RunWithValue is not checked (errcheck)
migrator/migrator.go|744 col 16| Error return value of m.RunWithValue is not checked (errcheck)
migrator/migrator.go|860 col 42| Error return value of (*database/sql.Row).Scan is not checked (errcheck)
callbacks/associations.go|164 col 23| Error return value is not checked (errcheck)
callbacks/associations.go|184 col 23| Error return value is not checked (errcheck)
callbacks/callbacks.go|41 col 50| Error return value of (*gorm.io/gorm.callback).Register is not checked (errcheck)
callbacks/callbacks.go|42 col 25| Error return value of createCallback.Register is not checked (errcheck)
callbacks/callbacks.go|43 col 25| Error return value of createCallback.Register is not checked (errcheck)
callbacks/callbacks.go|44 col 25| Error return value of createCallback.Register is not checked (errcheck)
callbacks/callbacks.go|47 col 50| Error return value of (*gorm.io/gorm.callback).Register is not checked (errcheck)
callbacks/callbacks.go|51 col 24| Error return value of queryCallback.Register is not checked (errcheck)
callbacks/callbacks.go|52 col 24| Error return value of queryCallback.Register is not checked (errcheck)
callbacks/callbacks.go|53 col 24| Error return value of queryCallback.Register is not checked (errcheck)
callbacks/callbacks.go|57 col 50| Error return value of (*gorm.io/gorm.callback).Register is not checked (errcheck)
callbacks/callbacks.go|58 col 25| Error return value of deleteCallback.Register is not checked (errcheck)
callbacks/callbacks.go|59 col 25| Error return value of deleteCallback.Register is not checked (errcheck)
callbacks/callbacks.go|60 col 25| Error return value of deleteCallback.Register is not checked (errcheck)
callbacks/callbacks.go|67 col 25| Error return value of updateCallback.Register is not checked (errcheck)
callbacks/callbacks.go|68 col 25| Error return value of updateCallback.Register is not checked (errcheck)
callbacks/callbacks.go|69 col 25| Error return value of updateCallback.Register is not checked (errcheck)
callbacks/callbacks.go|77 col 22| Error return value of rowCallback.Register is not checked (errcheck)
callbacks/callbacks.go|81 col 22| Error return value of rawCallback.Register is not checked (errcheck)
finisher_api.go|273 col 5| singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
schema/schema_test.go|178 col 36| G601: Implicit memory aliasing in for loop. (gosec)
schema/schema_test.go|219 col 35| G601: Implicit memory aliasing in for loop. (gosec)
schema/schema_test.go|287 col 35| G601: Implicit memory aliasing in for loop. (gosec)
callbacks.go|248 col 2| Consider pre-allocating names (prealloc)
migrator/migrator.go|404 col 3| unnecessary trailing newline (whitespace)
callbacks/associations.go|322 col 7| unnecessary trailing newline (whitespace)
callbacks/delete.go|110 col 2| unnecessary trailing newline (whitespace)
migrator/migrator.go|120 col 1| calculated cyclomatic complexity for function AutoMigrate is 26, max is 10 (cyclop)
migrator/migrator.go|209 col 1| calculated cyclomatic complexity for function CreateTable is 24, max is 10 (cyclop)
migrator/migrator.go|447 col 1| calculated cyclomatic complexity for function MigrateColumn is 41, max is 10 (cyclop)
migrator/migrator.go|865 col 1| calculated cyclomatic complexity for function ReorderModels is 22, max is 10 (cyclop)
utils/tests/dummy_dialecter.go|42 col 1| calculated cyclomatic complexity for function QuoteTo is 14, max is 10 (cyclop)
utils/tests/utils.go|30 col 1| calculated cyclomatic complexity for function AssertEqual is 25, max is 10 (cyclop)
association.go|75 col 1| calculated cyclomatic complexity for function Replace is 30, max is 10 (cyclop)
association.go|197 col 1| calculated cyclomatic complexity for function Delete is 35, max is 10 (cyclop)
association.go|380 col 1| calculated cyclomatic complexity for function saveAssociation is 51, max is 10 (cyclop)
callbacks.go|75 col 1| calculated cyclomatic complexity for function Execute is 25, max is 10 (cyclop)
callbacks.go|247 col 1| calculated cyclomatic complexity for function sortCallbacks is 34, max is 10 (cyclop)
chainable_api.go|112 col 1| calculated cyclomatic complexity for function Select is 18, max is 10 (cyclop)
finisher_api.go|73 col 1| calculated cyclomatic complexity for function Save is 16, max is 10 (cyclop)
finisher_api.go|174 col 1| calculated cyclomatic complexity for function FindInBatches is 17, max is 10 (cyclop)
finisher_api.go|246 col 1| calculated cyclomatic complexity for function assignInterfacesToValue is 21, max is 10 (cyclop)
finisher_api.go|346 col 1| calculated cyclomatic complexity for function FirstOrCreate is 13, max is 10 (cyclop)
finisher_api.go|442 col 1| calculated cyclomatic complexity for function Count is 18, max is 10 (cyclop)
finisher_api.go|620 col 1| calculated cyclomatic complexity for function Transaction is 11, max is 10 (cyclop)
gorm.go|121 col 1| calculated cyclomatic complexity for function Open is 23, max is 10 (cyclop)
gorm.go|218 col 1| calculated cyclomatic complexity for function Session is 21, max is 10 (cyclop)
gorm.go|376 col 1| calculated cyclomatic complexity for function DB is 11, max is 10 (cyclop)
scan.go|53 col 1| calculated cyclomatic complexity for function scanIntoStruct is 15, max is 10 (cyclop)
scan.go|125 col 1| calculated cyclomatic complexity for function Scan is 66, max is 10 (cyclop)
statement.go|81 col 1| calculated cyclomatic complexity for function QuoteTo is 23, max is 10 (cyclop)
statement.go|169 col 1| calculated cyclomatic complexity for function AddVar is 25, max is 10 (cyclop)
statement.go|284 col 1| calculated cyclomatic complexity for function BuildCondition is 70, max is 10 (cyclop)
statement.go|560 col 1| calculated cyclomatic complexity for function SetColumn is 16, max is 10 (cyclop)
statement.go|616 col 1| calculated cyclomatic complexity for function Changed is 18, max is 10 (cyclop)
statement.go|685 col 1| calculated cyclomatic complexity for function SelectAndOmitColumns is 23, max is 10 (cyclop)
callbacks/associations.go|13 col 1| calculated cyclomatic complexity for function SaveBeforeAssociations is 30, max is 10 (cyclop)
callbacks/associations.go|110 col 1| calculated cyclomatic complexity for function SaveAfterAssociations is 74, max is 10 (cyclop)