Stibbons/dopplerr

View on GitHub

Showing 38 of 38 total issues

Function setup_logging has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
Open

def setup_logging(outputtype=OutputType.PLAIN,
                  debug=False,
                  unbuffered=False,
                  logfile=None,
                  dev_allow_colors=True,
Severity: Minor
Found in dopplerr/logging.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 get_node_by_xpath has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

def get_node_by_xpath(mapping, xpath, default=None, ignore_errors=False,
                      handle_list_selector=False):
    '''Return the node pointed to by xpath from mapping.

    Args:
Severity: Minor
Found in cfgtree/dictxpath.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 main has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def main():
    outputtype = OutputType.PLAIN
    if "--debug-config" in sys.argv:
        default_level = logging.DEBUG
    else:
Severity: Minor
Found in dopplerr/main.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 logging.py has 261 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding: utf-8

# Standard Libraries
import logging
import os
Severity: Minor
Found in dopplerr/logging.py - About 2 hrs to fix

    Function _inject_cfg_in_parser has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def _inject_cfg_in_parser(self, parser, xpath=None, root=None):
            """
            Configure the argument parser according to cfgtree.
            """
            if root is None:
    Severity: Minor
    Found in cfgtree/cfgtree.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 styleLoaders has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports.styleLoaders = function (options) {
      options = options || {}
    
      function generateLoaders (loaders) {
        if (options.postcss) {
    Severity: Minor
    Found in frontend/build/css-utils.js - 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 styleLoaders has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports.styleLoaders = function (options) {
      options = options || {}
    
      function generateLoaders (loaders) {
        if (options.postcss) {
    Severity: Minor
    Found in frontend/build/css-utils.js - About 1 hr to fix

      Function _refine_file has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def _refine_file(video_file) -> List[SeriesEpisodeInfo]:
              log.debug("Refining file %s", video_file)
              try:
                  video = Video.fromname(video_file)
              except ValueError:
      Severity: Minor
      Found in dopplerr/tasks/subtasks/subliminal.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 setup_logging has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def setup_logging(outputtype=OutputType.PLAIN,
      Severity: Major
      Found in dopplerr/logging.py - About 1 hr to fix

        Function find_config_storage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def find_config_storage(self):
                configfile = self.json_configstorage_default_filename
                if self.json_configstorage_environ_var_name in os.environ:
                    configfile = os.environ[self.json_configstorage_environ_var_name]
                    log.debug("%s defined: %s", self.json_configstorage_environ_var_name, configfile)
        Severity: Minor
        Found in cfgtree/storages.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 _load_environment_variables has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def _load_environment_variables(self, xpath, root):
                """
                Inject value from environment variable.
                """
                for name, item in root.items():
        Severity: Minor
        Found in cfgtree/cfgtree.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 _find_cfg_for_cmd_line_name has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def _find_cfg_for_cmd_line_name(self, cmd_line_name, root=None):
                if root is None:
                    root = self.cfgtree
                for v in root.values():
                    if isinstance(v, dict):
        Severity: Minor
        Found in cfgtree/cfgtree.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 main has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def main():
            outputtype = OutputType.PLAIN
            if "--debug-config" in sys.argv:
                default_level = logging.DEBUG
            else:
        Severity: Minor
        Found in dopplerr/main.py - About 1 hr to fix

          Function update_series_media has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def update_series_media(self,
          Severity: Major
          Found in dopplerr/db.py - About 1 hr to fix

            Function _inject_names has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def _inject_names(self, root=None, xpath=None):
                    """
                    Inject configuration item name defined in the cfgtree dict inside each `_Cfg`.
                    """
                    if root is None:
            Severity: Minor
            Found in cfgtree/cfgtree.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 _dict has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def _dict(self, root=None, safe=False):
                    """
                    Return the configuration as a dictionnary.
                    """
                    if root is None:
            Severity: Minor
            Found in cfgtree/cfgtree.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 add_swagger has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def add_swagger(app, json_route, html_route, title="default", version="1.0", base_path=None):
            Severity: Minor
            Found in dopplerr/routes.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if key not in mapping:
                                      if not ignore_errors:
                                          raise KeyError("Invalid '{}' index selector: '{}' does not match "
                                                         "anything. Available keys: {!r}".format(
                                                             xpath, key, list(mapping.keys())))
              Severity: Major
              Found in cfgtree/dictxpath.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if len(items) <= index:
                                        if not ignore_errors:
                                            raise KeyError("Invalid '{}' selector: item index '{}' of '{}' is "
                                                           "outside of the list boundaries. Length is: {}".format(
                                                               xpath, index, key, len(items)))
                Severity: Major
                Found in cfgtree/dictxpath.py - About 45 mins to fix

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

                  def set_node_by_xpath(mapping, xpath, value, extend=False, setter_attr=None):
                      '''Set the node pointed to by xpath from mapping.
                  
                      Args:
                          mapping: nested dictionary.
                  Severity: Minor
                  Found in cfgtree/dictxpath.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

                  Severity
                  Category
                  Status
                  Source
                  Language