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
File array.go
has 554 lines of code (exceeds 500 allowed). Consider refactoring. Open
package pq
import (
"bytes"
"database/sql"
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"},
}
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
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"}},
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
}
- 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
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
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
}
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
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)
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{})
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)
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
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
- 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
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{})
- 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
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)
)
- 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 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++ {
- 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 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)
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
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