doubledutch/dd-vote

View on GitHub

Showing 247 of 2,318 total issues

Function TestInfinityTimestamp has 110 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TestInfinityTimestamp(t *testing.T) {
    db := openTestConn(t)
    defer db.Close()
    var err error
    var resultT time.Time
Severity: Major
Found in vendor/github.com/lib/pq/encode_test.go - About 3 hrs to fix

    File array.go has 554 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    package pq
    
    import (
        "bytes"
        "database/sql"
    Severity: Minor
    Found in vendor/github.com/lib/pq/array.go - About 3 hrs to fix

      Function TestHasOne has 106 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func TestHasOne(t *testing.T) {
          user := User{
              Name:       "has one",
              CreditCard: CreditCard{Number: "411111111111"},
          }
      Severity: Major
      Found in vendor/github.com/jinzhu/gorm/association_test.go - About 3 hrs to fix

        File context_test.go has 546 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        // Copyright 2014 Manu Martinez-Almeida.  All rights reserved.
        // Use of this source code is governed by a MIT style
        // license that can be found in the LICENSE file.
        
        package gin
        Severity: Minor
        Found in vendor/github.com/gin-gonic/gin/context_test.go - About 3 hrs to fix

          Function TestHasMany has 102 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func TestHasMany(t *testing.T) {
              post := Post{
                  Title:    "post has many",
                  Body:     "body has many",
                  Comments: []*Comment{{Content: "Comment 1"}, {Content: "Comment 2"}},
          Severity: Major
          Found in vendor/github.com/jinzhu/gorm/association_test.go - About 3 hrs to fix

            Function ScanSlice has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
            Open

            func ScanSlice(src []interface{}, dest interface{}, fieldNames ...string) error {
                d := reflect.ValueOf(dest)
                if d.Kind() != reflect.Ptr || d.IsNil() {
                    return errScanSliceValue
                }
            Severity: Minor
            Found in vendor/github.com/garyburd/redigo/redis/scan.go - About 2 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

            File tree_test.go has 538 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            // Copyright 2013 Julien Schmidt. All rights reserved.
            // Use of this source code is governed by a BSD-style license that can be found
            // in the LICENSE file.
            
            package gin
            Severity: Minor
            Found in vendor/github.com/gin-gonic/gin/tree_test.go - About 2 hrs to fix

              Method Association.Delete has 97 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (association *Association) Delete(values ...interface{}) *Association {
                  if association.Error != nil {
                      return association
                  }
              
              
              Severity: Major
              Found in vendor/github.com/jinzhu/gorm/association.go - About 2 hrs to fix

                Function TestHstore has 95 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func TestHstore(t *testing.T) {
                    db := openTestConn(t)
                    defer db.Close()
                
                    // quitely create hstore if it doesn't exist
                Severity: Major
                Found in vendor/github.com/lib/pq/hstore/hstore_test.go - About 2 hrs to fix

                  Function parseArray has 94 lines of code (exceeds 50 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: Major
                  Found in vendor/github.com/lib/pq/array.go - About 2 hrs to fix

                    Function TestManyToManyWithCustomizedForeignKeys has 92 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func TestManyToManyWithCustomizedForeignKeys(t *testing.T) {
                        if dialect := os.Getenv("GORM_DIALECT"); dialect != "" && dialect != "sqlite" {
                            DB.DropTable(&Blog{}, &Tag{})
                            DB.DropTable("shared_blog_tags")
                            DB.CreateTable(&Blog{}, &Tag{})
                    Severity: Major
                    Found in vendor/github.com/jinzhu/gorm/multi_primary_keys_test.go - About 2 hrs to fix

                      Function TestManyToMany has 92 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func TestManyToMany(t *testing.T) {
                          DB.Raw("delete from languages")
                          var languages = []Language{{Name: "ZH"}, {Name: "EN"}}
                          user := User{Name: "Many2Many", Languages: languages}
                          DB.Save(&user)
                      Severity: Major
                      Found in vendor/github.com/jinzhu/gorm/association_test.go - About 2 hrs to fix

                        Function TestFlashes has 91 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func TestFlashes(t *testing.T) {
                            var req *http.Request
                            var rsp *httptest.ResponseRecorder
                            var hdr http.Header
                            var err error
                        Severity: Major
                        Found in vendor/github.com/gorilla/sessions/sessions_test.go - About 2 hrs to fix

                          Function queryCallback has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func queryCallback(scope *Scope) {
                              defer scope.trace(NowFunc())
                          
                              var (
                                  isSlice, isPtr bool
                          Severity: Minor
                          Found in vendor/github.com/jinzhu/gorm/callback_query.go - About 2 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 TestManyToManyWithCustomizedForeignKeys has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func TestManyToManyWithCustomizedForeignKeys(t *testing.T) {
                              if dialect := os.Getenv("GORM_DIALECT"); dialect != "" && dialect != "sqlite" {
                                  DB.DropTable(&Blog{}, &Tag{})
                                  DB.DropTable("shared_blog_tags")
                                  DB.CreateTable(&Blog{}, &Tag{})
                          Severity: Minor
                          Found in vendor/github.com/jinzhu/gorm/multi_primary_keys_test.go - About 2 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 sortProcessors has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func sortProcessors(cps []*CallbackProcessor) []*func(scope *Scope) {
                              var (
                                  allNames, sortedNames []string
                                  sortCallbackProcessor func(c *CallbackProcessor)
                              )
                          Severity: Minor
                          Found in vendor/github.com/jinzhu/gorm/callback.go - About 2 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 node.insertChild has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (n *node) insertChild(numParams uint8, path string, fullPath string, handlers HandlersChain) {
                              var offset int // already handled bytes of the path
                          
                              // find prefix until first wildcard (beginning with ':'' or '*'')
                              for i, max := 0, len(path); numParams > 0; i++ {
                          Severity: Minor
                          Found in vendor/github.com/gin-gonic/gin/tree.go - About 2 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 node.addRoute has 88 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (n *node) addRoute(path string, handlers HandlersChain) {
                              fullPath := path
                              n.priority++
                              numParams := countParams(path)
                          
                          
                          Severity: Major
                          Found in vendor/github.com/gin-gonic/gin/tree.go - About 2 hrs to fix

                            Function TestManyToManyPreloadForNestedPointer has 86 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func TestManyToManyPreloadForNestedPointer(t *testing.T) {
                                type (
                                    Level1 struct {
                                        ID    uint
                                        Value string
                            Severity: Major
                            Found in vendor/github.com/jinzhu/gorm/preload_test.go - About 2 hrs to fix

                              Function TestNestedPreload9 has 86 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func TestNestedPreload9(t *testing.T) {
                                  type (
                                      Level0 struct {
                                          ID       uint
                                          Value    string
                              Severity: Major
                              Found in vendor/github.com/jinzhu/gorm/preload_test.go - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language