elliotchance/gedcom

View on GitHub

Showing 58 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

    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

            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

                  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

                      Method IndividualListPage.WriteHTMLTo has 65 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (c *IndividualListPage) WriteHTMLTo(w io.Writer) (int64, error) {
                          table := []core.Component{
                              core.NewTableHead("Name", "Birth", "Death"),
                          }
                      
                      
                      Severity: Minor
                      Found in html/individual_list_page.go - About 1 hr to fix

                        Method Publisher.Places has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (publisher *Publisher) Places() map[string]*place {
                            if publisher.placesMap == nil {
                                publisher.placesMap = map[string]*place{}
                        
                                // Get all of the unique place names.
                        Severity: Minor
                        Found in html/publish.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

                        Method Number.UpperRoman has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (n Number) UpperRoman() (string, error) {
                            // Catch edge cases first.
                            switch {
                            case n == 0:
                                return "N", nil
                        Severity: Minor
                        Found in number.go - About 1 hr to fix

                          Method IndividualEvents.WriteHTMLTo has 57 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (c *IndividualEvents) WriteHTMLTo(w io.Writer) (int64, error) {
                              var events []core.Component
                          
                              for _, event := range c.individual.AllEvents() {
                                  date, place := gedcom.DateAndPlace(event)
                          Severity: Minor
                          Found in html/individual_events.go - About 1 hr to fix

                            Method DiffPage.WriteHTMLTo has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (c *DiffPage) WriteHTMLTo(w io.Writer) (int64, error) {
                                if c.progress != nil {
                                    c.progress <- gedcom.Progress{
                                        Total: int64(len(c.comparisons)),
                                    }
                            Severity: Minor
                            Found in html/diff_page.go - About 1 hr to fix

                              Method IndividualNode.incorrectEventOrderWarnings has 54 lines of code (exceeds 50 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 1 hr to fix

                                Method FamilyNode.siblingsBornTooCloseWarnings has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                                Open

                                func (node *FamilyNode) siblingsBornTooCloseWarnings() (warnings Warnings) {
                                    pairs := IndividualNodePairs{}
                                    nineMonths := time.Duration(274 * 24 * time.Hour)
                                    twoDays := time.Duration(2 * 24 * time.Hour)
                                
                                
                                Severity: Minor
                                Found in family_node.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

                                Severity
                                Category
                                Status
                                Source
                                Language