elliotchance/gedcom

View on GitHub
decoder.go

Summary

Maintainability
B
5 hrs
Test Coverage

Method Decoder.Decode has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
Open

func (dec *Decoder) Decode() (*Document, error) {
    document := NewDocument()
    indents := Nodes{}
    var family *FamilyNode

Severity: Minor
Found in decoder.go - About 1 hr to fix

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

func newNodeWithChildren(document *Document, family *FamilyNode, tag Tag, value, pointer string, children Nodes) Node {
    var node Node

    switch tag {
    case TagBaptism:
Severity: Minor
Found in decoder.go - About 1 hr to fix

    Method Decoder.Decode has 66 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (dec *Decoder) Decode() (*Document, error) {
        document := NewDocument()
        indents := Nodes{}
        var family *FamilyNode
    
    
    Severity: Minor
    Found in decoder.go - About 1 hr to fix

      Function newNodeWithChildren has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func newNodeWithChildren(document *Document, family *FamilyNode, tag Tag, value, pointer string, children Nodes) Node {
      Severity: Minor
      Found in decoder.go - About 35 mins to fix

        Your code does not pass gofmt in 1 place. Go fmt your code!
        Open

        // Decoding a Document
        Severity: Minor
        Found in decoder.go by gofmt

        package comment should be of the form "Package gedcom ..."
        Open

        // Decoding a Document
        Severity: Minor
        Found in decoder.go by golint

        comment on exported function NewDecoder should be of the form "NewDecoder ..."
        Open

        // Create a new decoder to parse a reader that contain GEDCOM data.
        Severity: Minor
        Found in decoder.go by golint

        There are no issues that match your filters.

        Category
        Status