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.
IndividualNode
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
type IndividualNode struct {
*simpleDocumentNode
cachedFamilies, cachedSpouses bool
families FamilyNodes
spouses []*IndividualNode
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()
- Read upRead up
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"
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()
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.")
Parser
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
type Parser struct {
tokens *Tokens
}
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 {
- Read upRead up
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
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
- Read upRead up
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:
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()))
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
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"),
}
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.
- Read upRead up
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
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)
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)),
}
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 {
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)
- Read upRead up
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"