Showing 42 of 93 total issues
Function setupSetter
has a Cognitive Complexity of 109 (exceeds 20 allowed). Consider refactoring. Open
func setupSetter(meta *Meta, fieldName string, record interface{}) {
nestedField := strings.Contains(fieldName, ".")
// Setup nested fields
if nestedField {
- 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 meta_test.go
has 911 lines of code (exceeds 500 allowed). Consider refactoring. Open
package resource_test
import (
"database/sql/driver"
"fmt"
Function ConvertFormToMetaValues
has a Cognitive Complexity of 53 (exceeds 20 allowed). Consider refactoring. Open
func ConvertFormToMetaValues(request *http.Request, metaors []Metaor, prefix string) (*MetaValues, error) {
metaValues := &MetaValues{}
metaorsMap := map[string]Metaor{}
convertedNextLevel := map[string]bool{}
nestedStructIndex := map[string]int{}
- 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 gulpfile.js
has 402 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
let gulp = require("gulp"),
babel = require("gulp-babel"),
eslint = require("gulp-eslint"),
Function adminTasks
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
function adminTasks() {
let pathto = function(file) {
return "../admin/views/assets/" + file;
};
let scripts = {
Method processor.decode
has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring. Open
func (processor *processor) decode() (errs []error) {
if processor.checkSkipLeft() || processor.MetaValues == nil {
return
}
- 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 moduleTasks
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
function moduleTasks(moduleNames) {
let moduleName = moduleNames.name,
subModuleName = moduleNames.subName,
useSubName = moduleNames.useSubName;
Function setupSetter
has 137 lines of code (exceeds 50 allowed). Consider refactoring. Open
func setupSetter(meta *Meta, fieldName string, record interface{}) {
nestedField := strings.Contains(fieldName, ".")
// Setup nested fields
if nestedField {
Function ParamsMatch
has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring. Open
func ParamsMatch(source string, pth string) (url.Values, string, bool) {
var (
i, j int
p = make(url.Values)
ext = path.Ext(pth)
- 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 meta.go
has 525 lines of code (exceeds 500 allowed). Consider refactoring. Open
package resource
import (
"database/sql"
"errors"
Function pathto
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
let pathto = function(file) {
if (moduleName && subModuleName) {
if (subModuleName == "admin") {
return "../" + moduleName + "/views/assets/" + file;
} else if (subModuleName == "enterprise") {
Function moduleTasks
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function moduleTasks(moduleNames) {
let moduleName = moduleNames.name,
subModuleName = moduleNames.subName,
useSubName = moduleNames.useSubName;
- 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 ConvertFormToMetaValues
has 68 lines of code (exceeds 50 allowed). Consider refactoring. Open
func ConvertFormToMetaValues(request *http.Request, metaors []Metaor, prefix string) (*MetaValues, error) {
metaValues := &MetaValues{}
metaorsMap := map[string]Metaor{}
convertedNextLevel := map[string]bool{}
nestedStructIndex := map[string]int{}
Function setupValuer
has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring. Open
func setupValuer(meta *Meta, fieldName string, record interface{}) {
nestedField := strings.Contains(fieldName, ".")
// Setup nested fields
if nestedField {
- 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 ParamsMatch
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
func ParamsMatch(source string, pth string) (url.Values, string, bool) {
var (
i, j int
p = make(url.Values)
ext = path.Ext(pth)
Function TestJoinURL
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestJoinURL(t *testing.T) {
var cases = []struct {
original string
input []interface{}
want string
Function convertMapToMetaValues
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
func convertMapToMetaValues(values map[string]interface{}, metaors []Metaor) (*MetaValues, error) {
metaValues := &MetaValues{}
metaorMap := make(map[string]Metaor)
for _, metaor := range metaors {
metaorMap[metaor.GetName()] = metaor
- 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 HandleManyToMany
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
func HandleManyToMany(context *qor.Context, scope *gorm.Scope, meta *Meta, record interface{}, metaValue *MetaValue, field reflect.Value, fieldHasVersion bool) {
Avoid deeply nested control flow statements. Open
if isPtr {
field.Set(reflect.Append(field, value))
} else {
field.Set(reflect.Append(field, value.Elem()))
}
Function ParamsMatch
has 7 return statements (exceeds 4 allowed). Open
func ParamsMatch(source string, pth string) (url.Values, string, bool) {
var (
i, j int
p = make(url.Values)
ext = path.Ext(pth)