rdfio/rdf2smw

View on GitHub

Showing 70 of 70 total issues

Method TripleAggregateToWikiPageConverter.Run has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring.
Open

func (p *TripleAggregateToWikiPageConverter) Run() {
    defer close(p.OutPage)

    predPageIndex := make(map[string]*WikiPage)

Severity: Minor
Found in components/triplestowikipageconv.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

Method MWXMLCreator.Run has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
Open

func (p *MWXMLCreator) Run() {
    tplPropertyIdx := make(map[string]map[string]int)

    defer close(p.OutTemplates)
    defer close(p.OutProperties)
Severity: Minor
Found in components/mwxmlcreator.go - About 3 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

Method MWXMLCreator.Run has 72 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (p *MWXMLCreator) Run() {
    tplPropertyIdx := make(map[string]map[string]int)

    defer close(p.OutTemplates)
    defer close(p.OutProperties)
Severity: Minor
Found in components/mwxmlcreator.go - About 1 hr to fix

    Method TripleAggregateToWikiPageConverter.Run has 67 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (p *TripleAggregateToWikiPageConverter) Run() {
        defer close(p.OutPage)
    
        predPageIndex := make(map[string]*WikiPage)
    
    
    Severity: Minor
    Found in components/triplestowikipageconv.go - About 1 hr to fix

      Method TripleAggregateToWikiPageConverter.determineType has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
      Open

      func (p *TripleAggregateToWikiPageConverter) determineType(uriAggr *TripleAggregate) int {
          if uriAggr != nil {
              if uriAggr.Triples != nil {
                  for _, tr := range uriAggr.Triples {
                      for _, propType := range propertyTypes {
      Severity: Minor
      Found in components/triplestowikipageconv.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 main has 56 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func main() {
          //flowbase.InitLogDebug()
      
          inFileName := flag.String("in", "", "The input file name")
          outFileName := flag.String("out", "", "The output file name")
      Severity: Minor
      Found in main.go - About 1 hr to fix

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

                for triple, err := dec.Decode(); err != io.EOF; triple, err = dec.Decode() {
                    if err != nil {
                        log.Fatal("Could not encode to triple: ", err.Error())
                    } else if triple.Subj != nil && triple.Pred != nil && triple.Obj != nil {
                        p.OutTriple <- triple
        Severity: Major
        Found in components/ttlfilereader.go and 1 other location - About 1 hr to fix
        components/tripleparser.go on lines 28..36

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

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

                for triple, err := dec.Decode(); err != io.EOF; triple, err = dec.Decode() {
                    if err != nil {
                        log.Fatal("Could not encode to triple: ", err.Error())
                    } else if triple.Subj != nil && triple.Pred != nil && triple.Obj != nil {
                        p.Out <- triple
        Severity: Major
        Found in components/tripleparser.go and 1 other location - About 1 hr to fix
        components/ttlfilereader.go on lines 54..62

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

        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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        func escapeWikiChars(inStr string) string {
            outStr := str.Replace(inStr, "[", "(", -1)
            outStr = str.Replace(outStr, "]", ")", -1)
            outStr = str.Replace(outStr, "|", ",", -1)
            outStr = str.Replace(outStr, "=", "-", -1)
        Severity: Minor
        Found in components/mwxmlcreator.go and 1 other location - About 45 mins to fix
        components/iptypes.go on lines 103..111

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

        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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        func (f *Fact) escapeWikiChars(inStr string) string {
            outStr := str.Replace(inStr, "[", "(", -1)
            outStr = str.Replace(outStr, "]", ")", -1)
            outStr = str.Replace(outStr, "|", ",", -1)
            outStr = str.Replace(outStr, "=", "-", -1)
        Severity: Minor
        Found in components/iptypes.go and 1 other location - About 45 mins to fix
        components/mwxmlcreator.go on lines 165..173

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

        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

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

        func NewWikiPage(title string, facts []*Fact, categories []*Category, specificCategory *Category, pageType int) *WikiPage {
        Severity: Minor
        Found in components/iptypes.go - About 35 mins to fix

          var valueUriType should be valueURIType
          Open

                          valueUriType := p.determineType(valueAggr)
          Severity: Minor
          Found in components/triplestowikipageconv.go by golint

          exported function NewSMWTemplateCallFormatter should have comment or be unexported
          Open

          func NewSMWTemplateCallFormatter() *SMWTemplateCallFormatter {
          Severity: Minor
          Found in components/smwtplformatter.go by golint

          comment on exported function NewFanOutTripleAggregate should be of the form "NewFanOutTripleAggregate ..."
          Open

          // NewFanOut creates a new FanOut process
          Severity: Minor
          Found in components/tripleaggrfanout.go by golint

          exported method TripleAggregateToWikiPageConverter.Run should have comment or be unexported
          Open

          func (p *TripleAggregateToWikiPageConverter) Run() {
          Severity: Minor
          Found in components/triplestowikipageconv.go by golint

          exported type Fact should have comment or be unexported
          Open

          type Fact struct {
          Severity: Minor
          Found in components/iptypes.go by golint

          exported function NewMWXMLCreator should have comment or be unexported
          Open

          func NewMWXMLCreator(useTemplates bool) *MWXMLCreator {
          Severity: Minor
          Found in components/mwxmlcreator.go by golint

          exported function NewResourceIndexFanOut should have comment or be unexported
          Open

          func NewResourceIndexFanOut() *ResourceIndexFanOut {
          Severity: Minor
          Found in components/residxfanout.go by golint

          exported type StringFileWriter should have comment or be unexported
          Open

          type StringFileWriter struct {
          Severity: Minor
          Found in components/strfilewriter.go by golint

          exported method TripleAggregatePrinter.Run should have comment or be unexported
          Open

          func (p *TripleAggregatePrinter) Run() {
          Severity: Minor
          Found in components/tripleaggrprinter.go by golint
          Severity
          Category
          Status
          Source
          Language