Showing 32 of 52 total issues
Function NewGenerator
has a Cognitive Complexity of 84 (exceeds 20 allowed). Consider refactoring. Open
func NewGenerator(
generateEntity EntityGenerator,
generateRepository EntityGenerator,
generateQueryFile EntityGenerator,
generateRepositoriesFile WriteGenerator,
- 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 InitDatabaseReader
has a Cognitive Complexity of 59 (exceeds 20 allowed). Consider refactoring. Open
func InitDatabaseReader(loadAdapter AdapterLoader) DatabaseReader {
return func(config yoyo.Config) (db schema.Database, err error) {
var adapter Adapter
adapter, err = loadAdapter(config.Schema.Dialect)
if err != nil {
- 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
Query
has 46 methods (exceeds 20 allowed). Consider refactoring. Open
type Query struct {
n query.Node
}
File query.go
has 676 lines of code (exceeds 500 allowed). Consider refactoring. Open
package person
import (
"fmt"
Function NewEntityRepositoryGenerator
has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring. Open
func NewEntityRepositoryGenerator(packageName string, adapter Adapter, reposPath string, packagePath Finder, db schema.Database) EntityGenerator {
return func(t schema.Table, w io.StringWriter) (err error) {
var pkNames, insertCNames, selectCNames, scanFields, inFields, pkFields, colAssignments []string
for _, col := range t.Columns {
if col.PrimaryKey {
- 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 NewGenerator
has 125 lines of code (exceeds 50 allowed). Consider refactoring. Open
func NewGenerator(
generateEntity EntityGenerator,
generateRepository EntityGenerator,
generateQueryFile EntityGenerator,
generateRepositoriesFile WriteGenerator,
Function NewEntityRepositoryGenerator
has 117 lines of code (exceeds 50 allowed). Consider refactoring. Open
func NewEntityRepositoryGenerator(packageName string, adapter Adapter, reposPath string, packagePath Finder, db schema.Database) EntityGenerator {
return func(t schema.Table, w io.StringWriter) (err error) {
var pkNames, insertCNames, selectCNames, scanFields, inFields, pkFields, colAssignments []string
for _, col := range t.Columns {
if col.PrimaryKey {
Method Table.UnmarshalYAML
has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring. Open
func (t *Table) UnmarshalYAML(value *yaml.Node) (err error) {
for i, n := range value.Content {
switch n.Value {
case "columns":
colsNode := value.Content[i+1]
- 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 Database.validate
has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring. Open
func (db *Database) validate() (err error) {
tNames := make(map[string]bool)
for _, t := range db.Tables {
if err = t.validate(); err != nil {
return fmt.Errorf("%w for table `%s`", err, t.Name)
- 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 NewGenerator
has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring. Open
func NewGenerator(
createTable TableGenerator,
addMissingColumns TableGenerator,
addMissingIndices TableGenerator,
addAllIndices TableGenerator,
- 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 NewEntityGenerator
has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring. Open
func NewEntityGenerator(packageName string, db schema.Database, packagePath Finder, reposPath string) EntityGenerator {
return func(t schema.Table, w io.StringWriter) error {
var fields, referenceFields, scanFields, imports []string
nullPackagePath, err := packagePath(reposPath + "/nullable")
if err != nil {
- 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 GenerateQueryLogic
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
func GenerateQueryLogic(col string, column schema.Column) (methods, functions, imports []string) {
var (
ops []operation
goType string
)
Method Table.validate
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (t *Table) validate() (err error) {
if err = validateName(t.Name); err != nil {
return err
}
- 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 Datatype.String
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (dt Datatype) String() (s string) {
switch dt {
case Integer:
s = integer
case TinyInt:
Function FromString
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
func FromString(in string) (dt Datatype, err error) {
switch strings.ToUpper(strings.Split(in, "(")[0]) {
case integer, sint:
dt = Integer
case bigint:
Function InitDatabaseReader
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
func InitDatabaseReader(loadAdapter AdapterLoader) DatabaseReader {
return func(config yoyo.Config) (db schema.Database, err error) {
var adapter Adapter
adapter, err = loadAdapter(config.Schema.Dialect)
if err != nil {
Function NewQueryFileGenerator
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
func NewQueryFileGenerator(reposPath string, findPackagePath Finder, db schema.Database) EntityGenerator {
return func(t schema.Table, w io.StringWriter) error {
var methods, functions, imports []string
// We always need fmt
Function NewEntityGenerator
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
func NewEntityGenerator(packageName string, db schema.Database, packagePath Finder, reposPath string) EntityGenerator {
return func(t schema.Table, w io.StringWriter) error {
var fields, referenceFields, scanFields, imports []string
nullPackagePath, err := packagePath(reposPath + "/nullable")
if err != nil {
Function NewGenerator
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
generateEntity EntityGenerator,
generateRepository EntityGenerator,
generateQueryFile EntityGenerator,
generateRepositoriesFile WriteGenerator,
generateQueryNodeFile SimpleWriteGenerator,
Function NewGenerator
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
createTable TableGenerator,
addMissingColumns TableGenerator,
addMissingIndices TableGenerator,
addAllIndices TableGenerator,
hasTable StringSearcher,