hackedteam/vector-edk

View on GitHub
AppPkg/Applications/Python/Python-2.7.2/Lib/ast.py

Summary

Maintainability
F
2 wks
Test Coverage

Function generic_visit has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def generic_visit(self, node):
        for field, old_value in iter_fields(node):
            old_value = getattr(node, field, None)
            if isinstance(old_value, list):
                new_values = []
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/ast.py - About 2 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 literal_eval has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def literal_eval(node_or_string):
    """
    Safely evaluate an expression node or a string containing a Python
    expression.  The string or node provided may only consist of the following
    Python literal structures: strings, numbers, tuples, lists, dicts, booleans,
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/ast.py - About 2 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 ast.py has 266 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
"""
    ast
    ~~~
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/ast.py - About 2 hrs to fix

    Function fix_missing_locations has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def fix_missing_locations(node):
        """
        When you compile a node tree with compile(), the compiler expects lineno and
        col_offset attributes for every node that supports them.  This is rather
        tedious to fill in for generated nodes, so this helper adds these attributes
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/ast.py - 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 dump has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def dump(node, annotate_fields=True, include_attributes=False):
        """
        Return a formatted dump of the tree in *node*.  This is mainly useful for
        debugging purposes.  The returned string will show the names and the values
        for fields.  This makes the code impossible to evaluate, so if evaluation is
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/ast.py - 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 generic_visit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def generic_visit(self, node):
            """Called if no explicit visitor function exists for a node."""
            for field, value in iter_fields(node):
                if isinstance(value, list):
                    for item in value:
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/ast.py - 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 iter_child_nodes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def iter_child_nodes(node):
        """
        Yield all direct child nodes of *node*, that is, all fields that are nodes
        and all items of fields that are lists of nodes.
        """
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/ast.py - 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

    Avoid deeply nested control flow statements.
    Open

                            if value is None:
                                continue
                            elif not isinstance(value, AST):
                                new_values.extend(value)
                                continue
    Severity: Major
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/ast.py - About 45 mins to fix

      Consider simplifying this complex logical expression.
      Open

              if isinstance(node, Str):
                  return node.s
              elif isinstance(node, Num):
                  return node.n
              elif isinstance(node, Tuple):
      Severity: Major
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/ast.py - About 40 mins to fix

        Avoid too many return statements within this function.
        Open

                        return left + right
        Severity: Major
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/ast.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return dict((_convert(k), _convert(v)) for k, v
          Severity: Major
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/ast.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return left - right
            Severity: Major
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/ast.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return _safe_names[node.id]
              Severity: Major
              Found in AppPkg/Applications/Python/Python-2.7.2/Lib/ast.py - About 30 mins to fix

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

                Severity: Major
                Found in AppPkg/Applications/Python/Python-2.7.2/Lib/ast.py and 1 other location - About 2 wks to fix
                vector-uefi/fd/efi/StdLib/lib/python.27/ast.py on lines 0..311

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

                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