elliotchance/gedcom

View on GitHub

Showing 640 of 640 total issues

Function runDiffCommand has 203 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func runDiffCommand() {
    var optionLeftGedcomFile string
    var optionRightGedcomFile string
    var optionOutputFile string
    var optionShow string // see optionShow constants.
Severity: Major
Found in cmd/gedcom/diff.go - About 7 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    package gedcom
    
    // HusbandNode is an individual in the family role of a married man or father.
    type HusbandNode struct {
        *SimpleNode
    Severity: Major
    Found in husband_node.go and 1 other location - About 6 hrs to fix
    wife_node.go on lines 1..56

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 433.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    package gedcom
    
    // WifeNode is an individual in the role as a mother and/or married woman.
    type WifeNode struct {
        *SimpleNode
    Severity: Major
    Found in wife_node.go and 1 other location - About 6 hrs to fix
    husband_node.go on lines 1..56

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 433.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    IndividualNode has 44 methods (exceeds 20 allowed). Consider refactoring.
    Open

    type IndividualNode struct {
        *simpleDocumentNode
        cachedFamilies, cachedSpouses bool
        families                      FamilyNodes
        spouses                       []*IndividualNode
    Severity: Minor
    Found in individual_node.go - About 6 hrs to fix

      Method IndividualCompare.writeHTMLTo has a Cognitive Complexity of 45 (exceeds 20 allowed). Consider refactoring.
      Open

      func (c *IndividualCompare) writeHTMLTo(w io.Writer) (int64, error) {
          left := c.comparison.Left
          right := c.comparison.Right
      
          c.addProgress()
      Severity: Minor
      Found in html/individual_compare.go - About 4 hrs 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

      File individual_node.go has 573 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      package gedcom
      
      import (
          "fmt"
          "strings"
      Severity: Minor
      Found in individual_node.go - About 3 hrs to fix

        Method IndividualCompare.writeHTMLTo has 110 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (c *IndividualCompare) writeHTMLTo(w io.Writer) (int64, error) {
            left := c.comparison.Left
            right := c.comparison.Right
        
            c.addProgress()
        Severity: Major
        Found in html/individual_compare.go - About 3 hrs to fix

          Function runTuneCommand has 91 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func runTuneCommand() {
              tuneFlags := &TuneFlags{}
          
              // Input files. Must be provided.
              flag.StringVar(&tuneFlags.optionGedcomFile1, "gedcom1", "", "First GEDCOM file.")
          Severity: Major
          Found in cmd/gedcom/tune.go - About 2 hrs to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func (node *FamilyNode) SetWife(individual *IndividualNode) *FamilyNode {
                if IsNil(individual) {
                    wife := node.Wife().Individual()
                    if IsNil(wife) {
                        return node
            Severity: Major
            Found in family_node.go and 1 other location - About 2 hrs to fix
            family_node.go on lines 140..164

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 218.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func (node *FamilyNode) SetHusband(individual *IndividualNode) *FamilyNode {
                if IsNil(individual) {
                    husband := node.Husband().Individual()
                    if IsNil(husband) {
                        return node
            Severity: Major
            Found in family_node.go and 1 other location - About 2 hrs to fix
            family_node.go on lines 166..190

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 218.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            package gedcom
            
            // BirthNode is the event of entering into life.
            type BirthNode struct {
                *SimpleNode
            Severity: Major
            Found in birth_node.go and 1 other location - About 2 hrs to fix
            death_node.go on lines 1..51

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 213.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            package gedcom
            
            // DeathNode is the event when mortal life terminates.
            type DeathNode struct {
                *SimpleNode
            Severity: Major
            Found in death_node.go and 1 other location - About 2 hrs to fix
            birth_node.go on lines 1..51

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 213.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Parser has 22 methods (exceeds 20 allowed). Consider refactoring.
            Open

            type Parser struct {
                tokens *Tokens
            }
            Severity: Minor
            Found in q/parser.go - About 2 hrs to fix

              Method IndividualNode.incorrectEventOrderWarnings has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
              Open

              func (node *IndividualNode) incorrectEventOrderWarnings() (warnings Warnings) {
                  // Event order describes the boundaries of groups of events. That is to say
                  // that any baptism or LDS baptism events must be after a birth event but
                  // also much be before the any death event.
                  eventOrder := []*struct {
              Severity: Minor
              Found in individual_node.go - About 2 hrs 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 runPublishCommand has 75 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func runPublishCommand() {
                  var optionGedcomFile string
                  var optionOutputDir string
                  var optionGoogleAnalyticsID string
                  var optionLivingVisibility string
              Severity: Minor
              Found in cmd/gedcom/publish.go - About 2 hrs to fix

                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

                  Your code does not pass gofmt in 21 places. Go fmt your code!
                  Open

                  package q
                  Severity: Minor
                  Found in q/parser.go by gofmt

                  Method PublishHeader.WriteHTMLTo has 68 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (c *PublishHeader) WriteHTMLTo(w io.Writer) (int64, error) {
                      items := []*core.NavItem{}
                  
                      if c.options.ShowIndividuals {
                          badge := core.NewCountBadge(len(c.document.Individuals()))
                  Severity: Minor
                  Found in html/publish_header.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
                      Severity
                      Category
                      Status
                      Source
                      Language