Showing 29 of 37 total issues

Method repository.saveHasMany has 6 return statements (exceeds 4 allowed).
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]
Severity: Major
Found in repository.go - About 40 mins to fix

    Function JoinWith has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func JoinWith(mode string, table string, from string, to string, filter ...FilterQuery) Query {
    Severity: Minor
    Found in query.go - About 35 mins to fix

      Method Structset.set has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func (s Structset) set(doc *Document, mut *Mutation, field string, value any, force bool) {
      Severity: Minor
      Found in structset.go - About 35 mins to fix

        Function NewJoinWith has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func NewJoinWith(mode string, table string, from string, to string, filter ...FilterQuery) JoinQuery {
        Severity: Minor
        Found in join_query.go - About 35 mins to fix

          Method Query.JoinWith has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func (q Query) JoinWith(mode string, table string, from string, to string, filter ...FilterQuery) Query {
          Severity: Minor
          Found in query.go - About 35 mins to fix

            Method Collection.PrimaryValues has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
            Open

            func (c Collection) PrimaryValues() []any {
                if p, ok := c.v.(primary); ok {
                    return p.PrimaryValues()
                }
            
            
            Severity: Minor
            Found in collection.go - About 35 mins to fix

            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

            func (q Query) String() string {
                if q.SQLQuery.Statement != "" {
                    return q.SQLQuery.String()
                }
            
            
            Severity: Minor
            Found in query.go - About 35 mins to fix

            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

            func (r repository) insert(cw contextWrapper, doc *Document, mutation Mutation) error {
                var (
                    pField   string
                    pFields  = doc.PrimaryFields()
                    queriers = Build(doc.Table())
            Severity: Major
            Found in repository.go - About 35 mins to fix

              Method repository.update has 5 return statements (exceeds 4 allowed).
              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
                      }
              Severity: Major
              Found in repository.go - About 35 mins to fix
                Severity
                Category
                Status
                Source
                Language