hackedteam/vector-edk

View on GitHub
vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py

Summary

Maintainability
F
5 mos
Test Coverage

File argparse.py has 1620 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Author: Steven J. Bethard <steven.bethard@gmail.com>.

"""Command-line parsing library

This module is an optparse-inspired command-line parsing library that:
Severity: Major
Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 4 days to fix

    Function _parse_known_args has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
    Open

        def _parse_known_args(self, arg_strings, namespace):
            # replace arg strings that are file references
            if self.fromfile_prefix_chars is not None:
                arg_strings = self._read_args_from_files(arg_strings)
    
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 1 day 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 _format_actions_usage has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

        def _format_actions_usage(self, actions, groups):
            # find group indices and identify actions in groups
            group_actions = set()
            inserts = {}
            for group in groups:
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 7 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 _format_usage has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

        def _format_usage(self, usage, actions, groups, prefix):
            if prefix is None:
                prefix = _('usage: ')
    
            # if usage is specified, use that
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 7 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

    ArgumentParser has 29 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ArgumentParser(_AttributeHolder, _ActionsContainer):
        """Object for parsing command line strings into Python objects.
    
        Keyword Arguments:
            - prog -- The name of the program (default: sys.argv[0])
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 3 hrs to fix

      Function parse_known_args has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_known_args(self, args=None, namespace=None):
              # args default to the system args
              if args is None:
                  args = _sys.argv[1:]
      
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - 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

      HelpFormatter has 24 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class HelpFormatter(object):
          """Formatter for generating usage messages and argument help strings.
      
          Only the name of this class is considered a public API. All the methods
          provided by the class are considered an implementation detail.
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 2 hrs to fix

        Function _get_values has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def _get_values(self, action, arg_strings):
                # for everything but PARSER args, strip out '--'
                if action.nargs not in [PARSER, REMAINDER]:
                    arg_strings = [s for s in arg_strings if s != '--']
        
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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 _get_optional_kwargs has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def _get_optional_kwargs(self, *args, **kwargs):
                # determine short and long option strings
                option_strings = []
                long_option_strings = []
                for option_string in args:
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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 _get_option_tuples has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def _get_option_tuples(self, option_string):
                result = []
        
                # option strings starting with two prefix characters are only
                # split at the '='
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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 add_argument has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def add_argument(self, *args, **kwargs):
                """
                add_argument(dest, ..., name=value, ...)
                add_argument(option_string, option_string, ..., name=value, ...)
                """
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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 _read_args_from_files has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def _read_args_from_files(self, arg_strings):
                # expand arguments referencing files
                new_arg_strings = []
                for arg_string in arg_strings:
        
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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 _parse_optional has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def _parse_optional(self, arg_string):
                # if it's an empty string, it was meant to be a positional
                if not arg_string:
                    return None
        
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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 __init__ has 12 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self,
        Severity: Major
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 1 hr to fix

          Function _add_container_actions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def _add_container_actions(self, container):
                  # collect groups by titles
                  title_group_map = {}
                  for group in self._action_groups:
                      if group.title in title_group_map:
          Severity: Minor
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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 __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self,
          Severity: Major
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 1 hr to fix

            Function __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self,
            Severity: Major
            Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 1 hr to fix

              Function __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self,
              Severity: Major
              Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 1 hr to fix

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

                    def __init__(self,
                                 prog=None,
                                 usage=None,
                                 description=None,
                                 epilog=None,
                Severity: Minor
                Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(self,
                Severity: Major
                Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 50 mins to fix

                  Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def __init__(self,
                  Severity: Major
                  Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 50 mins to fix

                    Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(self,
                    Severity: Major
                    Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 50 mins to fix

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

                          def _format_action(self, action):
                              # determine the required width and the entry label
                              help_position = min(self._action_max_length + 2,
                                                  self._max_help_position)
                              help_width = self._width - help_position
                      Severity: Minor
                      Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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 _format_action_invocation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _format_action_invocation(self, action):
                              if not action.option_strings:
                                  metavar, = self._metavar_formatter(action, action.dest)(1)
                                  return metavar
                      
                      Severity: Minor
                      Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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 _get_nargs_pattern has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _get_nargs_pattern(self, action):
                              # in all examples below, we have to allow for '--' args
                              # which are represented as '-' in the pattern
                              nargs = action.nargs
                      
                      Severity: Minor
                      Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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(action.default, basestring):
                                                  default = self._get_value(action, default)
                                              setattr(namespace, action.dest, default)
                      Severity: Major
                      Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 45 mins to fix

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

                            def __init__(self,
                        Severity: Minor
                        Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 35 mins to fix

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

                              def add_usage(self, usage, actions, groups, prefix=None):
                          Severity: Minor
                          Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 35 mins to fix

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

                                def _format_usage(self, usage, actions, groups, prefix):
                            Severity: Minor
                            Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 35 mins to fix

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

                                  def __init__(self,
                              Severity: Minor
                              Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 35 mins to fix

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

                                    def __init__(self,
                                Severity: Minor
                                Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 35 mins to fix

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

                                      def __init__(self,
                                  Severity: Minor
                                  Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 35 mins to fix

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

                                        def __call__(self, parser, namespace, values, option_string=None):
                                    Severity: Minor
                                    Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 35 mins to fix

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

                                              def format_help(self):
                                                  # format the indented section
                                                  if self.parent is not None:
                                                      self.formatter._indent()
                                                  join = self.formatter._join_parts
                                      Severity: Minor
                                      Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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

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

                                          def _get_help_string(self, action):
                                              help = action.help
                                              if '%(default)' not in action.help:
                                                  if action.default is not SUPPRESS:
                                                      defaulting_nargs = [OPTIONAL, ZERO_OR_MORE]
                                      Severity: Minor
                                      Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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

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

                                          def _add_action(self, action):
                                              # resolve any conflicts
                                              self._check_conflict(action)
                                      
                                              # add to actions list
                                      Severity: Minor
                                      Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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

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

                                          def _expand_help(self, action):
                                              params = dict(vars(action), prog=self._prog)
                                              for name in list(params):
                                                  if params[name] is SUPPRESS:
                                                      del params[name]
                                      Severity: Minor
                                      Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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

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

                                          def _format_args(self, action, default_metavar):
                                              get_metavar = self._metavar_formatter(action, default_metavar)
                                              if action.nargs is None:
                                                  result = '%s' % get_metavar(1)
                                              elif action.nargs == OPTIONAL:
                                      Severity: Minor
                                      Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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 vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                return None, arg_string, None
                                        Severity: Major
                                        Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                          return action, option_string, explicit_arg
                                          Severity: Major
                                          Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                        return option_tuple
                                            Severity: Major
                                            Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                              return None
                                              Severity: Major
                                              Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                            return None
                                                Severity: Major
                                                Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 30 mins to fix

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

                                                      def _metavar_formatter(self, action, default_metavar):
                                                          if action.metavar is not None:
                                                              result = action.metavar
                                                          elif action.choices is not None:
                                                              choice_strs = [str(choice) for choice in action.choices]
                                                  Severity: Minor
                                                  Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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 __call__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                      def __call__(self, string):
                                                          # the special argument "-" means sys.std{in,out}
                                                          if string == '-':
                                                              if 'r' in self._mode:
                                                                  return _sys.stdin
                                                  Severity: Minor
                                                  Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.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

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

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

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

                                                  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