ergonomica/ergonomica

View on GitHub
ergonomica/lib/lang/interpreter.py

Summary

Maintainability
F
6 days
Test Coverage

Function eval has a Cognitive Complexity of 141 (exceeds 5 allowed). Consider refactoring.
Open

def eval(x, ns, at_top = False):
    global namespace, PRINT_OVERRIDE, ENV

    if at_top:
        PRINT_OVERRIDE = False
Severity: Minor
Found in ergonomica/lib/lang/interpreter.py - About 2 days 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

Cyclomatic complexity is too high in function eval. (47)
Open

def eval(x, ns, at_top = False):
    global namespace, PRINT_OVERRIDE, ENV

    if at_top:
        PRINT_OVERRIDE = False
Severity: Minor
Found in ergonomica/lib/lang/interpreter.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Function pipe has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

def pipe(blocksizes, *functions):

    global ENV
    
    blocksizes = list(blocksizes)
Severity: Minor
Found in ergonomica/lib/lang/interpreter.py - About 6 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

File interpreter.py has 413 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import absolute_import, print_function

Severity: Minor
Found in ergonomica/lib/lang/interpreter.py - About 5 hrs to fix

    Cyclomatic complexity is too high in function pipe. (13)
    Open

    def pipe(blocksizes, *functions):
    
        global ENV
        
        blocksizes = list(blocksizes)
    Severity: Minor
    Found in ergonomica/lib/lang/interpreter.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function _ast_to_string. (6)
    Open

    def _ast_to_string(tokens, depth = 0):
        if depth == 0:
            return " ".join([(_ast_to_string(x, depth + 1) if isinstance(x, list) else str(x)) for x in tokens])
        else:
            return "(" + " ".join([(_ast_to_string(x, depth + 1) if isinstance(x, list) else str(x)) for x in tokens]) + ")"
    Severity: Minor
    Found in ergonomica/lib/lang/interpreter.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function ergo. (6)
    Open

    def ergo(stdin, namespace=namespace):
        if stdin.strip() == "":
            return None
        try:
            return eval(parse(tokenize(stdin)), namespace, True)
    Severity: Minor
    Found in ergonomica/lib/lang/interpreter.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function atom. (6)
    Open

    def atom(token, no_symbol=False):
        try:
            return int(token)
        except ValueError:
            try: return float(token)
    Severity: Minor
    Found in ergonomica/lib/lang/interpreter.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function stdout_to_string. (6)
    Open

    def stdout_to_string(stdout):
        """
        Convert the standard output of a function (STDOUT)
        """
        
    Severity: Minor
    Found in ergonomica/lib/lang/interpreter.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function atom has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def atom(token, no_symbol=False):
        try:
            return int(token)
        except ValueError:
            try: return float(token)
    Severity: Minor
    Found in ergonomica/lib/lang/interpreter.py - About 55 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 _ast_to_string has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def _ast_to_string(tokens, depth = 0):
        if depth == 0:
            return " ".join([(_ast_to_string(x, depth + 1) if isinstance(x, list) else str(x)) for x in tokens])
        else:
            return "(" + " ".join([(_ast_to_string(x, depth + 1) if isinstance(x, list) else str(x)) for x in tokens]) + ")"
    Severity: Minor
    Found in ergonomica/lib/lang/interpreter.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 item in ["if", "elif"]:
                            if eval(x[i + 1], ns):
                                exp = x[i + 2]
                                break
                            i += 3
    Severity: Major
    Found in ergonomica/lib/lang/interpreter.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if percentage != prev_percentage:
                              # then we need to re-write the bar
                              bar = ("[ergo: pipe]: " + ENV.pipe_format_string.replace('<operations_completed>', str(len(functions)))
                                                                                        .replace('<progress>', ENV.pipe_progress_char * int(floor(percentage / 100.0 * ENV.pipe_progress_length))
                                                                                                               + ' ' * (ENV.pipe_progress_length - int(floor(percentage / 100.0 * ENV.pipe_progress_length))))
      Severity: Major
      Found in ergonomica/lib/lang/interpreter.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if i == len(x):
                                break
                            item = x[i]
        Severity: Major
        Found in ergonomica/lib/lang/interpreter.py - About 45 mins to fix

          Function stdout_to_string has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          def stdout_to_string(stdout):
              """
              Convert the standard output of a function (STDOUT)
              """
              
          Severity: Minor
          Found in ergonomica/lib/lang/interpreter.py - 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

          Avoid too many return statements within this function.
          Open

                          return None
          Severity: Major
          Found in ergonomica/lib/lang/interpreter.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return out
            Severity: Major
            Found in ergonomica/lib/lang/interpreter.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return []
              Severity: Major
              Found in ergonomica/lib/lang/interpreter.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                                return cur[0]
                Severity: Major
                Found in ergonomica/lib/lang/interpreter.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                              return r
                  Severity: Major
                  Found in ergonomica/lib/lang/interpreter.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return None
                    Severity: Major
                    Found in ergonomica/lib/lang/interpreter.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                      return function(argspec, body, ns)
                      Severity: Major
                      Found in ergonomica/lib/lang/interpreter.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return eval(x[0], ns)(*[eval(i, ns) for i in x[1:]])
                        Severity: Major
                        Found in ergonomica/lib/lang/interpreter.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                          return Symbol(token)
                          Severity: Major
                          Found in ergonomica/lib/lang/interpreter.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                            return eval(body_expression, copied_ns)
                            Severity: Major
                            Found in ergonomica/lib/lang/interpreter.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                                              return cur
                              Severity: Major
                              Found in ergonomica/lib/lang/interpreter.py - About 30 mins to fix

                                Function ergo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def ergo(stdin, namespace=namespace):
                                    if stdin.strip() == "":
                                        return None
                                    try:
                                        return eval(parse(tokenize(stdin)), namespace, True)
                                Severity: Minor
                                Found in ergonomica/lib/lang/interpreter.py - 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

                                Function arglist has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def arglist(_function):
                                    if isinstance(_function, function):
                                        return _function.args
                                    # they don't have args attributes since they're not actual Python functions
                                    if isinstance(_function, types.BuiltinFunctionType):
                                Severity: Minor
                                Found in ergonomica/lib/lang/interpreter.py - 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

                                TODO found
                                Open

                                                # TODO: instead of checking for a FileNotFoundError, check if the command is in the user's PATH.
                                Severity: Minor
                                Found in ergonomica/lib/lang/interpreter.py by fixme

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

                                        return " ".join([(_ast_to_string(x, depth + 1) if isinstance(x, list) else str(x)) for x in tokens])
                                Severity: Major
                                Found in ergonomica/lib/lang/interpreter.py and 1 other location - About 1 hr to fix
                                ergonomica/lib/lang/interpreter.py on lines 115..115

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

                                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

                                        return "(" + " ".join([(_ast_to_string(x, depth + 1) if isinstance(x, list) else str(x)) for x in tokens]) + ")"
                                Severity: Major
                                Found in ergonomica/lib/lang/interpreter.py and 1 other location - About 1 hr to fix
                                ergonomica/lib/lang/interpreter.py on lines 113..113

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

                                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 len(x) == 3:
                                                (_, name, body) = x
                                                name = Symbol(name)
                                                ns[name] = eval(body, ns)
                                                return None
                                Severity: Major
                                Found in ergonomica/lib/lang/interpreter.py and 1 other location - About 1 hr to fix
                                ergonomica/lib/lang/interpreter.py on lines 472..476

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

                                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

                                                            p = subprocess.Popen([x[0]] + expand_typed_args([eval(i, ns) for i in x[1:]]), stdout=subprocess.PIPE, universal_newlines=True)
                                Severity: Major
                                Found in ergonomica/lib/lang/interpreter.py and 1 other location - About 1 hr to fix
                                ergonomica/lib/lang/interpreter.py on lines 524..524

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

                                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

                                                            r = os.system(" ".join([quote(y) for y in [x[0]] + expand_typed_args([eval(i, ns) for i in x[1:]])]))
                                Severity: Major
                                Found in ergonomica/lib/lang/interpreter.py and 1 other location - About 1 hr to fix
                                ergonomica/lib/lang/interpreter.py on lines 532..532

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

                                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

                                        elif x[0] == "global":
                                            (_, name, body) = x
                                            name = Symbol(name)
                                            namespace[name] = eval(body, ns)
                                            return None
                                Severity: Major
                                Found in ergonomica/lib/lang/interpreter.py and 1 other location - About 1 hr to fix
                                ergonomica/lib/lang/interpreter.py on lines 453..457

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

                                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

                                There are no issues that match your filters.

                                Category
                                Status