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
- 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 conn.go
has 1440 lines of code (exceeds 500 allowed). Consider refactoring. Open
package pq
import (
"bufio"
"crypto/md5"
File preload_test.go
has 1398 lines of code (exceeds 500 allowed). Consider refactoring. Open
package gorm_test
import (
"database/sql"
"encoding/json"
File conn_test.go
has 1213 lines of code (exceeds 500 allowed). Consider refactoring. Open
package pq
import (
"database/sql"
"database/sql/driver"
File scope.go
has 1058 lines of code (exceeds 500 allowed). Consider refactoring. Open
package gorm
import (
"database/sql"
"database/sql/driver"
File array_test.go
has 988 lines of code (exceeds 500 allowed). Consider refactoring. Open
package pq
import (
"bytes"
"database/sql"
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
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) {
- 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
DB
has 77 methods (exceeds 20 allowed). Consider refactoring. Open
type DB struct {
Value interface{}
Error error
RowsAffected int64
callbacks *Callback
Scope
has 77 methods (exceeds 20 allowed). Consider refactoring. Open
type Scope struct {
Search *search
Value interface{}
SQL string
SQLVars []interface{}
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) {
- 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 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() {
- 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 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)
- 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 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)
- 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 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
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 (
- 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
Context
has 48 methods (exceeds 20 allowed). Consider refactoring. Open
type Context struct {
writermem responseWriter
Request *http.Request
Writer ResponseWriter
File association_test.go
has 680 lines of code (exceeds 500 allowed). Consider refactoring. Open
package gorm_test
import (
"fmt"
"os"
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
}
- 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 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
}
- 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"