sonntagsgesicht/goma

View on GitHub

Showing 14 of 14 total issues

Function match has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    def match(self, match_details, mapping_list, start_col=0):
        """ matching based on prioritizing entries in the right column of the
            mapping list

        Parameters:
Severity: Minor
Found in goma/prioritymatch.py - About 5 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

Function match has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    def match(self, match_details, mapping_list):
        """ matching based on exact entries of all columns of the
            mapping list

        Parameters:
Severity: Minor
Found in goma/exactmatch.py - 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

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

                for c in range(0, len(match_details)):
                    if match_details[c][0] == attr:
                        detail_value = match_details[c][1]
                        break
Severity: Major
Found in goma/prioritymatch.py and 1 other location - About 2 hrs to fix
goma/exactmatch.py on lines 67..70

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

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

                for c in range(0, len(match_details)):
                    if match_details[c][0] == attr:
                        detail_value = match_details[c][1]
                        break
Severity: Major
Found in goma/exactmatch.py and 1 other location - About 2 hrs to fix
goma/prioritymatch.py on lines 94..97

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

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

if os.path.exists(rst_prolog_file):
    f = open(rst_prolog_file, 'r')
    rst_prolog += os.linesep + f.read()
    f.close()
Severity: Major
Found in doc/sphinx/conf.py and 1 other location - About 1 hr to fix
doc/sphinx/conf.py on lines 124..127

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

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

if os.path.exists(rst_epilog_file):
    f = open(rst_epilog_file, 'r')
    rst_epilog += os.linesep + f.read()
    f.close()
Severity: Major
Found in doc/sphinx/conf.py and 1 other location - About 1 hr to fix
doc/sphinx/conf.py on lines 118..121

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

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 _repl_relation_operator has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def _repl_relation_operator(self, relation_symbol):
        if relation_symbol == '[': return '>='
        if relation_symbol == '(': return '>'
        if relation_symbol == ']': return '<='
        if relation_symbol == ')': return '<'
Severity: Minor
Found in goma/basematch.py - 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

Avoid deeply nested control flow statements.
Open

                        if self._apply_relation_match(mapping_list[i][j], detail_value):
                            rows.append(i)
                            match = True
                        else:
                            match = False
Severity: Major
Found in goma/prioritymatch.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if self._apply_relation_match(mapping_list[i][j], detail_value):
                                matches += 1
                            else:
                                break
                        elif not detail_value:
    Severity: Major
    Found in goma/exactmatch.py - About 45 mins to fix

      Avoid too many return statements within this function.
      Open

              return relation_symbol
      Severity: Major
      Found in goma/basematch.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                if relation_symbol in ['<=', '=<']: return '<='
        Severity: Major
        Found in goma/basematch.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  if relation_symbol == '!=': return '!='
          Severity: Major
          Found in goma/basematch.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    if relation_symbol in ['>=', '=>']: return '>='
            Severity: Major
            Found in goma/basematch.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      if relation_symbol == '==': return '=='
              Severity: Major
              Found in goma/basematch.py - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language