Showing 29 of 37 total issues
Method repository.saveHasMany
has 6 return statements (exceeds 4 allowed). Open
Open
func (r repository) saveHasMany(cw contextWrapper, doc *Document, mutation *Mutation, insertion bool) error {
for _, field := range doc.HasMany() {
var (
assoc = doc.Association(field)
assocMuts, changed = mutation.Assoc[field]
Function JoinWith
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func JoinWith(mode string, table string, from string, to string, filter ...FilterQuery) Query {
Method Structset.set
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (s Structset) set(doc *Document, mut *Mutation, field string, value any, force bool) {
Function NewJoinWith
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func NewJoinWith(mode string, table string, from string, to string, filter ...FilterQuery) JoinQuery {
Method Query.JoinWith
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (q Query) JoinWith(mode string, table string, from string, to string, filter ...FilterQuery) Query {
Method Collection.PrimaryValues
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
Open
func (c Collection) PrimaryValues() []any {
if p, ok := c.v.(primary); ok {
return p.PrimaryValues()
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method Query.String
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
Open
func (q Query) String() string {
if q.SQLQuery.Statement != "" {
return q.SQLQuery.String()
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method repository.insert
has 5 return statements (exceeds 4 allowed). Open
Open
func (r repository) insert(cw contextWrapper, doc *Document, mutation Mutation) error {
var (
pField string
pFields = doc.PrimaryFields()
queriers = Build(doc.Table())
Method repository.update
has 5 return statements (exceeds 4 allowed). Open
Open
func (r repository) update(cw contextWrapper, doc *Document, mutation Mutation, filter FilterQuery) error {
if mutation.Cascade {
if err := r.saveBelongsTo(cw, doc, &mutation); err != nil {
return err
}