pyapp-org/pyapp

View on GitHub

Showing 33 of 53 total issues

File __init__.py has 452 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Application
~~~~~~~~~~~

*Application with bindings for commands*
Severity: Minor
Found in src/pyapp/app/__init__.py - About 6 hrs to fix

    File arguments.py has 393 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    Any command associated with a pyApp application can be expanded with arguments.
    Arguments are a set of decorators that utilise ``argparse`` to simplify the
    process of accepting and validating input/flags for commands.
    
    
    Severity: Minor
    Found in src/pyapp/app/arguments.py - About 5 hrs to fix

      Function _handle_generics has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def _handle_generics(
              origin, type_, positional: bool, kwargs: Dict[str, Any]
          ) -> type:
              """
              Handle generic types
      Severity: Minor
      Found in src/pyapp/app/arguments.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 plugins.py has 270 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """
      *Configuration based Instance factories*
      
      Inversion of control style plugin factories that return an object instance
      based on a named definition from configuration. Makes use of
      Severity: Minor
      Found in src/pyapp/conf/helpers/plugins.py - About 2 hrs to fix

        File report.py has 255 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """
        Checks Report
        ~~~~~~~~~~~~~
        
        Generates and execute a report after executing checks.
        Severity: Minor
        Found in src/pyapp/checks/report.py - About 2 hrs to fix

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

              def __init__(
          Severity: Major
          Found in src/pyapp/app/__init__.py - About 1 hr to fix

            Function check_instance has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def check_instance(self, instance_definitions, name, **_):
                    """
                    Checks for individual instances.
                    """
                    definition = instance_definitions[name]
            Severity: Minor
            Found in src/pyapp/conf/helpers/plugins.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 run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def run(
                    self, message_level: int = logging.INFO, tags: Sequence[str] = None
                ) -> bool:
                    """
                    Run the report
            Severity: Minor
            Found in src/pyapp/checks/report.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__(
            Severity: Major
            Found in src/pyapp/app/arguments.py - About 1 hr to fix

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

                  def _resolve_instance_definition(self, name):
                      alias_names = {name}
                      while True:
                          try:
                              type_name, kwargs = self._instance_definitions[name]
              Severity: Minor
              Found in src/pyapp/conf/helpers/plugins.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 inject has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              def inject(func: FunctionType = None, *, from_registry: FactoryRegistry = None):
                  """
                  Mark a function to have arguments injected.
              
                  A specific registry can be provided, else the global registry is used.
              Severity: Minor
              Found in src/pyapp/injection.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 from_parameter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def from_parameter(cls, name: str, parameter: inspect.Parameter) -> "Argument":
                      # pylint: disable=too-many-branches,too-many-statements
                      """
                      Generate an argument from a inspection parameter
              
              
              Severity: Minor
              Found in src/pyapp/app/arguments.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 run_checks_iter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def run_checks_iter(self, tags: Iterable[str] = None, pre_callback=None):
                      """
                      Iterate through all registered checks and run each to return messages.
              
                      :param tags: Iterable of tags to filter checks by.
              Severity: Minor
              Found in src/pyapp/checks/registry.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 retrieve_file has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def retrieve_file(url: URL) -> Tuple[TextIO, str]:
                  """
                  Fetch a file from a URL (handling SSL).
              
                  This is based off `urllib.request.urlretrieve`.
              Severity: Minor
              Found in src/pyapp/conf/loaders/http_loader.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 checks has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def checks(self, **kwargs):
                      """
                      Run checks to ensure settings are valid, secondly run checks against
                      individual definitions in settings.
                      """
              Severity: Minor
              Found in src/pyapp/conf/helpers/plugins.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 _handle_types has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _handle_types(
                      type_, positional: bool, kwargs: Dict[str, Any]
                  ) -> Optional[type]:
                      """
                      Handle types
              Severity: Minor
              Found in src/pyapp/app/arguments.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 check_definition has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def check_definition(
                      self, config_definitions: Dict[str, Dict[str, Any]], name: str, **_
                  ):
                      """
                      Checks for individual definitions.
              Severity: Minor
              Found in src/pyapp/conf/helpers/__init__.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 execute_report has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def execute_report(
              Severity: Major
              Found in src/pyapp/checks/report.py - About 1 hr to fix

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

                    def checks(self, **kwargs):
                        """
                        Run checks to ensure settings are valid, secondly run checks against
                        individual definitions in settings.
                
                
                Severity: Minor
                Found in src/pyapp/conf/helpers/__init__.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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __init__(self, **kwargs):
                        enum = kwargs.pop("type", None)
                        if enum is None:
                            raise ValueError("type must be assigned an Enum when using EnumAction")
                        if not issubclass(enum, Enum):
                Severity: Minor
                Found in src/pyapp/app/argument_actions.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