doubledutch/dd-vote

View on GitHub

Showing 2,318 of 2,318 total issues

Method Scope.GetModelStruct has a Cognitive Complexity of 670 (exceeds 20 allowed). Consider refactoring.
Open

func (scope *Scope) GetModelStruct() *ModelStruct {
    var modelStruct ModelStruct
    // Scope value can't be nil
    if scope.Value == nil {
        return &modelStruct
Severity: Minor
Found in vendor/github.com/jinzhu/gorm/model_struct.go - About 1 wk 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

File conn.go has 1440 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package pq

import (
    "bufio"
    "crypto/md5"
Severity: Major
Found in vendor/github.com/lib/pq/conn.go - About 3 days to fix

    File preload_test.go has 1398 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    package gorm_test
    
    import (
        "database/sql"
        "encoding/json"
    Severity: Major
    Found in vendor/github.com/jinzhu/gorm/preload_test.go - About 2 days to fix

      File conn_test.go has 1213 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      package pq
      
      import (
          "database/sql"
          "database/sql/driver"
      Severity: Major
      Found in vendor/github.com/lib/pq/conn_test.go - About 2 days to fix

        File scope.go has 1058 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        package gorm
        
        import (
            "database/sql"
            "database/sql/driver"
        Severity: Major
        Found in vendor/github.com/jinzhu/gorm/scope.go - About 1 day to fix

          File array_test.go has 988 lines of code (exceeds 500 allowed). Consider refactoring.
          Open

          package pq
          
          import (
              "bytes"
              "database/sql"
          Severity: Major
          Found in vendor/github.com/lib/pq/array_test.go - About 1 day to fix

            Method Scope.GetModelStruct has 336 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (scope *Scope) GetModelStruct() *ModelStruct {
                var modelStruct ModelStruct
                // Scope value can't be nil
                if scope.Value == nil {
                    return &modelStruct
            Severity: Major
            Found in vendor/github.com/jinzhu/gorm/model_struct.go - About 1 day to fix

              Method node.findCaseInsensitivePath has a Cognitive Complexity of 89 (exceeds 20 allowed). Consider refactoring.
              Open

              func (n *node) findCaseInsensitivePath(path string, fixTrailingSlash bool) (ciPath []byte, found bool) {
                  ciPath = make([]byte, 0, len(path)+1) // preallocate enough memory
              
                  // Outer loop for walking the tree
                  for len(path) >= len(n.path) && strings.ToLower(path[:len(n.path)]) == strings.ToLower(n.path) {
              Severity: Minor
              Found in vendor/github.com/gin-gonic/gin/tree.go - About 1 day 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

              DB has 77 methods (exceeds 20 allowed). Consider refactoring.
              Open

              type DB struct {
                  Value             interface{}
                  Error             error
                  RowsAffected      int64
                  callbacks         *Callback
              Severity: Major
              Found in vendor/github.com/jinzhu/gorm/main.go - About 1 day to fix

                Scope has 77 methods (exceeds 20 allowed). Consider refactoring.
                Open

                type Scope struct {
                    Search          *search
                    Value           interface{}
                    SQL             string
                    SQLVars         []interface{}
                Severity: Major
                Found in vendor/github.com/jinzhu/gorm/scope.go - About 1 day to fix

                  Method node.getValue has a Cognitive Complexity of 82 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (n *node) getValue(path string, po Params) (handlers HandlersChain, p Params, tsr bool) {
                      p = po
                  walk: // Outer loop for walking the tree
                      for {
                          if len(path) > len(n.path) {
                  Severity: Minor
                  Found in vendor/github.com/gin-gonic/gin/tree.go - About 1 day 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

                  Function saveAfterAssociationsCallback has a Cognitive Complexity of 76 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func saveAfterAssociationsCallback(scope *Scope) {
                      if !scope.shouldSaveAssociations() {
                          return
                      }
                      for _, field := range scope.Fields() {
                  Severity: Minor
                  Found in vendor/github.com/jinzhu/gorm/callback_save.go - About 1 day 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 node.addRoute has a Cognitive Complexity of 76 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (n *node) addRoute(path string, handlers HandlersChain) {
                      fullPath := path
                      n.priority++
                      numParams := countParams(path)
                  
                  
                  Severity: Minor
                  Found in vendor/github.com/gin-gonic/gin/tree.go - About 1 day 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

                  Function parseArray has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func parseArray(src, del []byte) (dims []int, elems [][]byte, err error) {
                      var depth, i int
                  
                      if len(src) < 1 || src[0] != '{' {
                          return nil, nil, fmt.Errorf("pq: unable to parse array; expected %q at offset %d", '{', 0)
                  Severity: Minor
                  Found in vendor/github.com/lib/pq/array.go - About 7 hrs 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

                  Function TestRediStore has 194 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func TestRediStore(t *testing.T) {
                      var req *http.Request
                      var rsp *ResponseRecorder
                      var hdr http.Header
                      var err error
                  Severity: Major
                  Found in vendor/github.com/boj/redistore/redistore_test.go - About 6 hrs to fix

                    Function createCallback has a Cognitive Complexity of 59 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func createCallback(scope *Scope) {
                        if !scope.HasError() {
                            defer scope.trace(NowFunc())
                    
                            var (
                    Severity: Minor
                    Found in vendor/github.com/jinzhu/gorm/callback_create.go - About 6 hrs 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

                    Context has 48 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    type Context struct {
                        writermem responseWriter
                        Request   *http.Request
                        Writer    ResponseWriter
                    
                    
                    Severity: Minor
                    Found in vendor/github.com/gin-gonic/gin/context.go - About 6 hrs to fix

                      File association_test.go has 680 lines of code (exceeds 500 allowed). Consider refactoring.
                      Open

                      package gorm_test
                      
                      import (
                          "fmt"
                          "os"
                      Severity: Minor
                      Found in vendor/github.com/jinzhu/gorm/association_test.go - About 6 hrs to fix

                        Method Association.Delete has a Cognitive Complexity of 56 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (association *Association) Delete(values ...interface{}) *Association {
                            if association.Error != nil {
                                return association
                            }
                        
                        
                        Severity: Minor
                        Found in vendor/github.com/jinzhu/gorm/association.go - About 6 hrs 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 Association.Replace has a Cognitive Complexity of 53 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (association *Association) Replace(values ...interface{}) *Association {
                            if association.Error != nil {
                                return association
                            }
                        
                        
                        Severity: Minor
                        Found in vendor/github.com/jinzhu/gorm/association.go - About 5 hrs 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

                        Severity
                        Category
                        Status
                        Source
                        Language