elliotchance/gedcom

View on GitHub

Showing 58 of 640 total issues

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

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

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

    func NewIndividualCompare(comparison *gedcom.IndividualComparison, filterFlags *gedcom.FilterFlags, progress chan gedcom.Progress, compareOptions *gedcom.IndividualNodesCompareOptions, visibility LivingVisibility) *IndividualCompare {
    Severity: Minor
    Found in html/individual_compare.go - About 35 mins to fix

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

      func runNameToDateRatio(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 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

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

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

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

            func runIndividualWeight(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 NewStatisticsPage has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

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

                Method HTMLFormatter.Write has 5 return statements (exceeds 4 allowed).
                Open

                func (f *HTMLFormatter) Write(result interface{}) error {
                    pageTitle := "gedcom"
                
                    // Nil should be treated as a blank document.
                    if gedcom.IsNil(result) {
                Severity: Major
                Found in q/html_formatter.go - About 35 mins to fix

                  Method Publisher.Places has 5 return statements (exceeds 4 allowed).
                  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: Major
                  Found in html/publish.go - About 35 mins to fix

                    Method ResidenceNode.Equals has 5 return statements (exceeds 4 allowed).
                    Open

                    func (node *ResidenceNode) Equals(node2 Node) bool {
                        if IsNil(node) {
                            return false
                        }
                    
                    
                    Severity: Major
                    Found in residence_node.go - About 35 mins to fix

                      Method EventNode.Equals has 5 return statements (exceeds 4 allowed).
                      Open

                      func (node *EventNode) Equals(node2 Node) bool {
                          if IsNil(node) {
                              return false
                          }
                      
                      
                      Severity: Major
                      Found in event_node.go - About 35 mins to fix

                        Method UniqueIDNode.Equals has 5 return statements (exceeds 4 allowed).
                        Open

                        func (node *UniqueIDNode) Equals(node2 Node) bool {
                            if IsNil(node) {
                                return false
                            }
                        
                        
                        Severity: Major
                        Found in unique_id_node.go - About 35 mins to fix

                          Method GEDCOMFormatter.Write has 5 return statements (exceeds 4 allowed).
                          Open

                          func (f *GEDCOMFormatter) Write(result interface{}) error {
                              // Nil should be treated as a blank document.
                              if gedcom.IsNil(result) {
                                  return nil
                              }
                          Severity: Major
                          Found in q/gedcom_formatter.go - About 35 mins to fix

                            Method SimpleNode.Equals has 5 return statements (exceeds 4 allowed).
                            Open

                            func (node *SimpleNode) Equals(node2 Node) bool {
                                if node == nil {
                                    return false
                                }
                            
                            
                            Severity: Major
                            Found in simple_node.go - About 35 mins to fix

                              Method AccessorExpr.Evaluate has 5 return statements (exceeds 4 allowed).
                              Open

                              func (e *AccessorExpr) Evaluate(engine *Engine, input interface{}, args []*Statement) (interface{}, error) {
                                  in := reflect.ValueOf(input)
                                  accessor := e.Query[1:]
                              
                                  if input == nil {
                              Severity: Major
                              Found in q/accessor_expr.go - About 35 mins to fix

                                Method IndividualEvents.WriteHTMLTo has a Cognitive Complexity of 22 (exceeds 20 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 35 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 DeepEqual has 5 return statements (exceeds 4 allowed).
                                Open

                                func DeepEqual(left, right Node) bool {
                                    if IsNil(left) {
                                        return false
                                    }
                                
                                
                                Severity: Major
                                Found in equal.go - About 35 mins to fix

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

                                  func (o *IndividualNodesCompareOptions) collectResults(results chan *IndividualComparison, totals chan int64) chan *IndividualComparison {
                                      // See description in createJobs().
                                      similarities := make(chan *IndividualComparison, 1000)
                                  
                                      go func() {
                                  Severity: Minor
                                  Found in individual_nodes.go - About 25 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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language