cloudsmith-io/cloudsmith-cli

View on GitHub
cloudsmith_cli/cli/commands/entitlements.py

Summary

Maintainability
F
3 days
Test Coverage
F
39%

File entitlements.py has 670 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""CLI/Commands - Entitlements."""

import functools
from operator import itemgetter

Severity: Major
Found in cloudsmith_cli/cli/commands/entitlements.py - About 1 day to fix

    Function print_entitlements_with_restrictions has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

    def print_entitlements_with_restrictions(
        opts, data, page_info=None, show_list_info=True
    ):
        # pylint: disable=too-many-locals
        """Print entitlements (with restrictions) as a table or output in another format."""
    Severity: Minor
    Found in cloudsmith_cli/cli/commands/entitlements.py - About 6 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 restrict has 12 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def restrict(
    Severity: Major
    Found in cloudsmith_cli/cli/commands/entitlements.py - About 1 hr to fix

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

      def restrict(
          ctx,
          opts,
          owner_repo_identifier,
          refresh_token,
      Severity: Minor
      Found in cloudsmith_cli/cli/commands/entitlements.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 list_entitlements has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def list_entitlements(ctx, opts, owner_repo, page, page_size, show_tokens):
      Severity: Minor
      Found in cloudsmith_cli/cli/commands/entitlements.py - About 45 mins to fix

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

        def create(ctx, opts, owner_repo, show_tokens, name, token):
        Severity: Minor
        Found in cloudsmith_cli/cli/commands/entitlements.py - About 45 mins to fix

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

          def print_entitlements(opts, data, page_info=None, show_list_info=True):
              """Print entitlements as a table or output in another format."""
              if utils.maybe_print_as_json(opts, data, page_info):
                  return
          
          
          Severity: Minor
          Found in cloudsmith_cli/cli/commands/entitlements.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 update has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def update(ctx, opts, owner_repo_identifier, show_tokens, name, token):
          Severity: Minor
          Found in cloudsmith_cli/cli/commands/entitlements.py - About 45 mins to fix

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

            def sync(ctx, opts, owner_repo, show_tokens, source, yes):
            Severity: Minor
            Found in cloudsmith_cli/cli/commands/entitlements.py - About 45 mins to fix

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

              def refresh(ctx, opts, owner_repo_identifier, show_tokens, yes):
              Severity: Minor
              Found in cloudsmith_cli/cli/commands/entitlements.py - About 35 mins to fix

                There are no issues that match your filters.

                Category
                Status