hackedteam/vector-edk

View on GitHub

Showing 9,525 of 13,510 total issues

Function __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, fixer_names, options=None, explicit=None):
        """Initializer.

        Args:
            fixer_names: a list of fixers to import
Severity: Minor
Found in vector-uefi/fd/efi/StdLib/lib/python.27/lib2to3/refactor.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

                        for c1, r1 in generate_matches(alt, nodes[c0:]):
                            if c1 > 0:
                                r = {}
                                r.update(r0)
                                r.update(r1)
Severity: Major
Found in vector-uefi/fd/efi/StdLib/lib/python.27/lib2to3/pytree.py - About 45 mins to fix

    Function is_probably_builtin has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def is_probably_builtin(node):
        """
        Check that something isn't an attribute or function name etc.
        """
        prev = node.prev_sibling
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/lib2to3/fixer_util.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 optval is not None:
                                if vi in ('=', ':') and ';' in optval:
                                    # ';' is a comment delimiter only if it follows
                                    # a spacing character
                                    pos = optval.find(';')
    Severity: Major
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/ConfigParser.py - About 45 mins to fix

      Function refactor_stdin has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def refactor_stdin(self, doctests_only=False):
              input = sys.stdin.read()
              if doctests_only:
                  self.log_debug("Refactoring doctests in stdin")
                  output = self.refactor_docstring(input, "<stdin>")
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/lib2to3/refactor.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 not fixer in results:
                                  results[fixer] = []
                              results[fixer].append(current_ast_node)
      Severity: Major
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/lib2to3/btm_matcher.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if member_name in change[1]:
                                    if change[0] not in mod_dict:
                                        modules.append(change[0])
                                    mod_dict.setdefault(change[0], []).append(member)
        
        Severity: Major
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/lib2to3/fixes/fix_urllib.py - About 45 mins to fix

          Function fixup_parse_tree has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def fixup_parse_tree(cls_node):
              """ one-line classes don't get a suite in the parse tree so we add
                  one to normalize the tree
              """
              for node in cls_node.children:
          Severity: Minor
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/lib2to3/fixes/fix_metaclass.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

          Function transform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def transform(self, node, results):
                  head = results["head"]
                  method = results["method"][0] # Extract node for method name
                  tail = results["tail"]
                  syms = self.syms
          Severity: Minor
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/lib2to3/fixes/fix_dict.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

          Function _extract_member has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def _extract_member(self, member, targetpath, pwd):
                  """Extract the ZipInfo object 'member' to a physical
                     file on the path targetpath.
                  """
                  # build the destination pathname, replacing
          Severity: Minor
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/zipfile.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.debug:
                                      print "Adding", arcname
                                  self.write(fname, arcname)
          Severity: Major
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/zipfile.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if reductor:
                                    rv = reductor(2)
                                else:
                                    reductor = getattr(x, "__reduce__", None)
                                    if reductor:
            Severity: Major
            Found in vector-uefi/fd/efi/StdLib/lib/python.27/copy.py - About 45 mins to fix

              Function rec_test has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def rec_test(sequence, test_func):
                  """Tests test_func on all items of sequence and items of included
                  sub-iterables"""
                  for x in sequence:
                      if isinstance(x, (list, tuple)):
              Severity: Minor
              Found in vector-uefi/fd/efi/StdLib/lib/python.27/lib2to3/btm_utils.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

                                      for fixer in current_ac_node.fixers:
                                          if not fixer in results.keys():
                                              results[fixer] = []
                                          results[fixer].append(current_ast_node)
              
              Severity: Major
              Found in vector-uefi/fd/efi/StdLib/lib/python.27/lib2to3/btm_matcher.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if os.path.isfile(os.path.join(path, "__init__.py")):
                                            # This is a package directory, add it
                                            self.writepy(path, basename)  # Recursive call
                                    elif ext == ".py":
                Severity: Major
                Found in vector-uefi/fd/efi/StdLib/lib/python.27/zipfile.py - About 45 mins to fix

                  Function insertion_sort has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  Severity: Minor
                  Found in vector-uefi/fd/efi/StdLib/lib/python.27/encodings/punycode.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

                  Function read has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def read(self, n=-1):
                          """Read and return up to n bytes.
                          If the argument is omitted, None, or negative, data is read and returned until EOF is reached..
                          """
                          buf = ''
                  Severity: Minor
                  Found in vector-uefi/fd/efi/StdLib/lib/python.27/zipfile.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

                  Function ToASCII has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def ToASCII(label):
                      try:
                          # Step 1: try ASCII
                          label = label.encode("ascii")
                      except UnicodeError:
                  Severity: Minor
                  Found in vector-uefi/fd/efi/StdLib/lib/python.27/encodings/idna.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 isinstance(stmt, pytree.Node):
                                              break
                  
                                      # The assignment is different if old_N is a tuple or list
                                      # In that case, the assignment is old_N = new_N.args
                  Severity: Major
                  Found in vector-uefi/fd/efi/StdLib/lib/python.27/lib2to3/fixes/fix_except.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if self.debug:
                                                print "Adding", arcname
                                            self.write(fname, arcname)
                    Severity: Major
                    Found in vector-uefi/fd/efi/StdLib/lib/python.27/zipfile.py - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language