pyapp-org/pyapp

View on GitHub

Showing 61 of 65 total issues

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

    def _extract_args(self, func):
        """Extract args from signature and turn into command line args."""
        sig = inspect.signature(func)

        # Backwards compatibility
Severity: Minor
Found in src/pyapp/app/arguments.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 retrieve_file has a Cognitive Complexity of 9 (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 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 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 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(  # noqa: PLR0913
Severity: Major
Found in src/pyapp/conf/helpers/__init__.py - About 50 mins to fix

    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

    Function wrap_text has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def wrap_text(
    Severity: Minor
    Found in src/pyapp/utils/__init__.py - About 45 mins to fix

      Function checks has a Cognitive Complexity of 8 (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/providers.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 command has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def command(
      Severity: Minor
      Found in src/pyapp/app/arguments.py - About 45 mins to fix

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

            def __init__(  # noqa: PLR0913
        Severity: Minor
        Found in src/pyapp/checks/report.py - About 45 mins to fix

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

              def __init__(  # noqa: PLR0913
          Severity: Minor
          Found in src/pyapp/multiprocessing.py - About 45 mins to fix

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

            def import_root_module(stack_offset: int = 2):
                """
                Identify and import the root module.
                """
                stack = inspect.stack()
            Severity: Minor
            Found in src/pyapp/utils/inspect.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 __new__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __new__(cls, name: str, bases, dct: Dict[str, Any], *, prefix: str = ""):
            Severity: Minor
            Found in src/pyapp/typed_settings.py - About 35 mins to fix

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

                  def __init__(
              Severity: Minor
              Found in src/pyapp/extensions/report.py - About 35 mins to fix

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

                    def a_or_b(
                Severity: Minor
                Found in src/pyapp/feature_flags.py - About 35 mins to fix

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

                      def command(
                          self,
                          handler: Handler = None,
                          *,
                          name: str = None,
                  Severity: Minor
                  Found in src/pyapp/app/arguments.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 document_members has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def document_members(self, all_members=False):
                          """Update the document members section to include settings."""
                          collection = SettingsCollection(self.object).process()
                  
                          # Define a code highlight role
                  Severity: Minor
                  Found in src/pyapp/documentation/sphinx.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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __init__(  # noqa: PLR0913
                          self,
                          root_module=None,
                          *,
                          prog: str = None,
                  Severity: Minor
                  Found in src/pyapp/app/__init__.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 type_
                  Severity: Major
                  Found in src/pyapp/app/arguments.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return None
                    Severity: Major
                    Found in src/pyapp/documentation/settings.py - About 30 mins to fix

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

                          def __init__(  # noqa: PLR0913
                              self,
                              setting: str,
                              *,
                              defaults: Dict[str, Any] = None,
                      Severity: Minor
                      Found in src/pyapp/conf/helpers/__init__.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