elliotchance/gedcom

View on GitHub

Showing 58 of 640 total issues

Method PartnersAndChildren.WriteHTMLTo has 51 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (c *PartnersAndChildren) WriteHTMLTo(w io.Writer) (int64, error) {
    heading := core.NewHeading(2, "", core.NewText("Spouses & Children"))
    column := core.NewColumn(core.EntireRow, heading)

    rows := []core.Component{
Severity: Minor
Found in html/partners_and_children.go - About 1 hr to fix

    Method IndividualNodesCompareOptions.calculateWinners has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
    Open

    func (o *IndividualNodesCompareOptions) calculateWinners(a, b IndividualNodes, similarityResults chan *IndividualComparison, options SimilarityOptions) chan *IndividualComparison {
        // See description in createJobs().
        winners := make(chan *IndividualComparison, 1000)
    
        go func() {
    Severity: Minor
    Found in individual_nodes.go - About 55 mins 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 NewDiffPage has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func NewDiffPage(comparisons gedcom.IndividualComparisons, filterFlags *gedcom.FilterFlags, googleAnalyticsID string, show, sort string, progress chan gedcom.Progress, compareOptions *gedcom.IndividualNodesCompareOptions, visibility LivingVisibility) *DiffPage {
    Severity: Major
    Found in html/diff_page.go - About 50 mins to fix

      Function runDiffCommand has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
      Open

      func runDiffCommand() {
          var optionLeftGedcomFile string
          var optionRightGedcomFile string
          var optionOutputFile string
          var optionShow string // see optionShow constants.
      Severity: Minor
      Found in cmd/gedcom/diff.go - About 45 mins 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 LastExpr.Evaluate has 7 return statements (exceeds 4 allowed).
      Open

      func (e *LastExpr) Evaluate(engine *Engine, input interface{}, args []*Statement) (interface{}, error) {
          in := reflect.ValueOf(input)
      
          if len(args) != 1 {
              return nil, errors.New("function Last() must take a single argument")
      Severity: Major
      Found in q/last_expr.go - About 45 mins to fix

        Function NewPublishHeader has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func NewPublishHeader(document *gedcom.Document, extraTab string, selectedTab string, options *PublishShowOptions, indexLetters []rune, placesMap map[string]*place) *PublishHeader {
        Severity: Minor
        Found in html/publish_header.go - About 45 mins to fix

          Function NewIndividualListPage has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func NewIndividualListPage(document *gedcom.Document, selectedLetter rune, googleAnalyticsID string, options *PublishShowOptions, indexLetters []rune, placesMap map[string]*place) *IndividualListPage {
          Severity: Minor
          Found in html/individual_list_page.go - About 45 mins to fix

            Function NewPlacePage has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func NewPlacePage(document *gedcom.Document, placeKey string, googleAnalyticsID string, options *PublishShowOptions, indexLetters []rune, placesMap map[string]*place) *PlacePage {
            Severity: Minor
            Found in html/place_page.go - About 45 mins to fix

              Function NewSourcePage has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func NewSourcePage(document *gedcom.Document, source *gedcom.SourceNode, googleAnalyticsID string, options *PublishShowOptions, indexLetters []rune, placesMap map[string]*place) *SourcePage {
              Severity: Minor
              Found in html/source_page.go - About 45 mins to fix

                Function NewIndividualPage has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                func NewIndividualPage(document *gedcom.Document, individual *gedcom.IndividualNode, googleAnalyticsID string, options *PublishShowOptions, indexLetters []rune, placesMap map[string]*place) *IndividualPage {
                Severity: Minor
                Found in html/individual_page.go - About 45 mins to fix

                  Method FirstExpr.Evaluate has 6 return statements (exceeds 4 allowed).
                  Open

                  func (e *FirstExpr) Evaluate(engine *Engine, input interface{}, args []*Statement) (interface{}, error) {
                      in := reflect.ValueOf(input)
                  
                      if len(args) != 1 {
                          return nil, fmt.Errorf("function First() must take a single argument")
                  Severity: Major
                  Found in q/first_expr.go - About 40 mins to fix

                    Method BinaryExpr.Evaluate has 6 return statements (exceeds 4 allowed).
                    Open

                    func (e *BinaryExpr) Evaluate(engine *Engine, input interface{}, args []*Statement) (interface{}, error) {
                        in := reflect.ValueOf(input)
                    
                        // If it is a slice we need to Evaluate each one.
                        if in.Kind() == reflect.Slice {
                    Severity: Major
                    Found in q/binary_expr.go - About 40 mins to fix

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

                      func runMinimumSimilarity(gedcom1 *gedcom.Document, gedcom2 *gedcom.Document, idealScore int, options gedcom.SimilarityOptions, tuneFlags *TuneFlags) {
                      Severity: Minor
                      Found in cmd/gedcom/tune.go - About 35 mins to fix

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

                        func runMaxYears(gedcom1 *gedcom.Document, gedcom2 *gedcom.Document, idealScore int, options gedcom.SimilarityOptions, tuneFlags *TuneFlags) {
                        Severity: Minor
                        Found in cmd/gedcom/tune.go - About 35 mins to fix

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

                          func NewSourceListPage(document *gedcom.Document, googleAnalyticsID string, options *PublishShowOptions, indexLetters []rune, placesMap map[string]*place) *SourceListPage {
                          Severity: Minor
                          Found in html/source_list_page.go - About 35 mins to fix

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

                            func NewFamilyListPage(document *gedcom.Document, googleAnalyticsID string, options *PublishShowOptions, indexLetters []rune, placesMap map[string]*place) *FamilyListPage {
                            Severity: Minor
                            Found in html/family_list_page.go - About 35 mins to fix

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

                              func runJaroPrefixSize(gedcom1 *gedcom.Document, gedcom2 *gedcom.Document, idealScore int, options gedcom.SimilarityOptions, tuneFlags *TuneFlags) {
                              Severity: Minor
                              Found in cmd/gedcom/tune.go - About 35 mins to fix

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

                                func NewIndividualEvent(date, place string, description core.Component, individual *gedcom.IndividualNode, event gedcom.Node, placesMap map[string]*place) *IndividualEvent {
                                Severity: Minor
                                Found in html/individual_event.go - About 35 mins to fix

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

                                  func runJaroBoost(gedcom1 *gedcom.Document, gedcom2 *gedcom.Document, idealScore int, options gedcom.SimilarityOptions, tuneFlags *TuneFlags) {
                                  Severity: Minor
                                  Found in cmd/gedcom/tune.go - About 35 mins to fix

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

                                    func filter(root Node, fn FilterFunction, entityMap entityMap, document *Document, family *FamilyNode) Node {
                                    Severity: Minor
                                    Found in filter.go - About 35 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language