elliotchance/gedcom

View on GitHub

Showing 640 of 640 total issues

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

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

        func NewIndividualListPage(document *gedcom.Document, selectedLetter rune, googleAnalyticsID string, options *PublishShowOptions, indexLetters []rune, placesMap map[string]*place) *IndividualListPage {
            return &IndividualListPage{
                document:          document,
                selectedLetter:    selectedLetter,
                googleAnalyticsID: googleAnalyticsID,
        Severity: Minor
        Found in html/individual_list_page.go and 2 other locations - About 35 mins to fix
        html/place_page.go on lines 19..28
        html/publish_header.go on lines 31..40

        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 103.

        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 3 locations. Consider refactoring.
        Open

        func NewPlacePage(document *gedcom.Document, placeKey string, googleAnalyticsID string, options *PublishShowOptions, indexLetters []rune, placesMap map[string]*place) *PlacePage {
            return &PlacePage{
                document:          document,
                placeKey:          placeKey,
                googleAnalyticsID: googleAnalyticsID,
        Severity: Minor
        Found in html/place_page.go and 2 other locations - About 35 mins to fix
        html/individual_list_page.go on lines 22..31
        html/publish_header.go on lines 31..40

        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 103.

        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 3 locations. Consider refactoring.
        Open

        func NewPublishHeader(document *gedcom.Document, extraTab string, selectedTab string, options *PublishShowOptions, indexLetters []rune, placesMap map[string]*place) *PublishHeader {
            return &PublishHeader{
                document:     document,
                extraTab:     extraTab,
                selectedTab:  selectedTab,
        Severity: Minor
        Found in html/publish_header.go and 2 other locations - About 35 mins to fix
        html/individual_list_page.go on lines 22..31
        html/place_page.go on lines 19..28

        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 103.

        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

        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

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

        // Dates
        Severity: Minor
        Found in date.go by gofmt

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

        package gedcom
        Severity: Minor
        Found in individual_nodes.go by gofmt

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

        package gedcom
        Severity: Minor
        Found in util.go by gofmt

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

        package gedcom
        Severity: Minor
        Found in family_node.go by gofmt

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

        // Package gedcom contains functionality for encoding, decoding, traversing,
        Severity: Minor
        Found in doc.go by gofmt

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

        package gedcom
        Severity: Minor
        Found in date_node.go by gofmt

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

        package gedcom
        Severity: Minor
        Found in individual_node.go by gofmt

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

        package gedcom
        Severity: Minor
        Found in unique_id_node.go by gofmt

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

        package gedcom
        Severity: Minor
        Found in name_format.go by gofmt

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

        package gedcom
        Severity: Minor
        Found in uuid.go by gofmt

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

        package gedcom
        Severity: Minor
        Found in jaro.go by gofmt

        exported type ChildNodes should have comment or be unexported
        Open

        type ChildNodes []*ChildNode
        Severity: Minor
        Found in child_nodes.go by golint
        Severity
        Category
        Status
        Source
        Language