Stibbons/dopplerr

View on GitHub

Showing 33 of 38 total issues

Avoid deeply nested control flow statements.
Open

                    if not isinstance(items, list):
                        if not ignore_errors:
                            raise KeyError("Invalid '{}' selector: '{}' is not a list, is: {}"
                                           .format(xpath, key, type(items)))
                        return default
Severity: Major
Found in cfgtree/dictxpath.py - About 45 mins to fix

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

    def set_node_by_xpath(mapping, xpath, value, extend=False, setter_attr=None):
    Severity: Minor
    Found in cfgtree/dictxpath.py - About 35 mins to fix

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

          def __init__(self, l=None, s=None, h=None, r=False, d=_UNDEFINED):
      Severity: Minor
      Found in cfgtree/types.py - About 35 mins to fix

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

                    def __init__(self, fmt=None, datefmt=None, term_width=-1, split=True, log_colors=None):
        Severity: Minor
        Found in dopplerr/logging.py - About 35 mins to fix

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

          def get_node_by_xpath(mapping, xpath, default=None, ignore_errors=False,
          Severity: Minor
          Found in cfgtree/dictxpath.py - About 35 mins to fix

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

                def _load_cfg_dict(self, cfg, xpath=None):
                    for k, v in cfg.items():
                        xp = self.mkxpath(xpath, k)
                        if isinstance(v, dict):
                            self._load_cfg_dict(v, xp)
            Severity: Minor
            Found in cfgtree/cfgtree.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 default
            Severity: Major
            Found in cfgtree/dictxpath.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return default
              Severity: Major
              Found in cfgtree/dictxpath.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return mapping
                Severity: Major
                Found in cfgtree/dictxpath.py - About 30 mins to fix

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

                  def delete_node_by_xpath(mapping, xpath, ignore_errors=False):
                      '''Delete the node pointed to by xpath from mapping.
                  
                      Args:
                          mapping: nested dictionary.
                  Severity: Minor
                  Found in cfgtree/dictxpath.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 _load_cmd_line_arg has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _load_cmd_line_arg(self):
                          """
                          Inject parameters provider by the user in the command line.
                          """
                          argv = sys.argv[1:]
                  Severity: Minor
                  Found in cfgtree/cfgtree.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 refresh_from_cfg has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def refresh_from_cfg(self):
                          """
                          Refresh derived values from cfg.
                          """
                          cfg = DopplerrConfig()
                  Severity: Minor
                  Found in dopplerr/status.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 appy_path_mapping has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def appy_path_mapping(self, folder):
                          if not DopplerrConfig().get_cfg_value("general.mapping"):
                              return folder
                          if folder.startswith("/"):
                              absolute = True
                  Severity: Minor
                  Found in dopplerr/request_filter.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

                  Severity
                  Category
                  Status
                  Source
                  Language