decoder.go
Method Decoder.Decode
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
Open
func (dec *Decoder) Decode() (*Document, error) {
document := NewDocument()
indents := Nodes{}
var family *FamilyNode
- 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 newNodeWithChildren
has 69 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func newNodeWithChildren(document *Document, family *FamilyNode, tag Tag, value, pointer string, children Nodes) Node {
var node Node
switch tag {
case TagBaptism:
Method Decoder.Decode
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (dec *Decoder) Decode() (*Document, error) {
document := NewDocument()
indents := Nodes{}
var family *FamilyNode
Function newNodeWithChildren
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func newNodeWithChildren(document *Document, family *FamilyNode, tag Tag, value, pointer string, children Nodes) Node {
Your code does not pass gofmt in 1 place. Go fmt your code! Open
Open
// Decoding a Document
- Exclude checks
comment on exported function NewDecoder should be of the form "NewDecoder ..." Open
Open
// Create a new decoder to parse a reader that contain GEDCOM data.
- Exclude checks
package comment should be of the form "Package gedcom ..." Open
Open
// Decoding a Document
- Exclude checks