Showing 28 of 41 total issues
Method parser.readDay
has a Cognitive Complexity of 127 (exceeds 20 allowed). Consider refactoring. Open
func (p *parser) readDay() (set *IntervalSet, err error) { //nolint:cyclop,gocyclo
defer func() {
if err != nil && !errors.Is(err, io.EOF) {
err = p.error(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 parser.readDay
has 229 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *parser) readDay() (set *IntervalSet, err error) { //nolint:cyclop,gocyclo
defer func() {
if err != nil && !errors.Is(err, io.EOF) {
err = p.error(err)
}
Method parser.cacheValues
has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring. Open
func (p *parser) cacheValues(rec Record) (err error) { //nolint:cyclop,funlen,gocognit,gocyclo
// Reset the values first.
p.resetDay()
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
File reason.go
has 587 lines of code (exceeds 500 allowed). Consider refactoring. Open
package nem12
import (
"fmt"
"strings"
File parser.go
has 562 lines of code (exceeds 500 allowed). Consider refactoring. Open
package nem12
import (
"encoding/csv"
"errors"
Method parser.cacheValues
has 104 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *parser) cacheValues(rec Record) (err error) { //nolint:cyclop,funlen,gocognit,gocyclo
// Reset the values first.
p.resetDay()
var (
Method parser.readDay
has 27 return statements (exceeds 4 allowed). Open
func (p *parser) readDay() (set *IntervalSet, err error) { //nolint:cyclop,gocyclo
defer func() {
if err != nil && !errors.Is(err, io.EOF) {
err = p.error(err)
}
Function newIntervalEvent
has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring. Open
func newIntervalEvent(rec Record) (*intervalEvent, error) {
var (
start int
finish int
qm QualityMethod
- 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 Field.Validate
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (f Field) Validate() error { //nolint:cyclop,gocyclo
switch f.Type {
case FieldRecordIndicator:
return validateFieldRecordIndicator(f.Value)
case FieldVersionHeader:
Function newIntervalEvent
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
func newIntervalEvent(rec Record) (*intervalEvent, error) {
var (
start int
finish int
qm QualityMethod
Method parser.cacheValues
has 12 return statements (exceeds 4 allowed). Open
func (p *parser) cacheValues(rec Record) (err error) { //nolint:cyclop,funlen,gocognit,gocyclo
// Reset the values first.
p.resetDay()
var (
Avoid deeply nested control flow statements. Open
if err != nil {
return nil, err
}
Avoid deeply nested control flow statements. Open
if err != nil {
return nil, err
}
Avoid deeply nested control flow statements. Open
if err != nil {
return nil, err
}
Method QualityMethod.Validate
has 7 return statements (exceeds 4 allowed). Open
func (qm QualityMethod) Validate() error {
strLen := len(qm)
if strLen == 0 {
return ErrQualityMethodNil
Avoid deeply nested control flow statements. Open
if err != nil {
return nil, err
}
Avoid deeply nested control flow statements. Open
if err != nil {
return nil, err
}
Avoid deeply nested control flow statements. Open
if err != nil {
return nil, err
}
Avoid deeply nested control flow statements. Open
if err != nil {
return nil, err
}
Function newIntervalEvent
has 7 return statements (exceeds 4 allowed). Open
func newIntervalEvent(rec Record) (*intervalEvent, error) {
var (
start int
finish int
qm QualityMethod