cloudsmith-io/cloudsmith-cli

View on GitHub

Showing 97 of 166 total issues

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

def _print_metrics_table(opts, data):
    """Print metrics as a table."""
    category_keys = {"Bandwidth": "bandwidth", "Downloads": "downloads"}

    metrics_keys = {
Severity: Minor
Found in cloudsmith_cli/cli/commands/metrics/packages.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 validate_upload_file has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def validate_upload_file(ctx, opts, owner, repo, filepath, skip_errors):
Severity: Minor
Found in cloudsmith_cli/cli/commands/push.py - About 45 mins to fix

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

    def packages(ctx, opts, owner_repo, page, page_size, query):
    Severity: Minor
    Found in cloudsmith_cli/cli/commands/list_.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 handle_api_exceptions has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def handle_api_exceptions(
        Severity: Minor
        Found in cloudsmith_cli/cli/exceptions.py - About 45 mins to fix

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

          def update_entitlement(owner, repo, identifier, name, token, show_tokens):
          Severity: Minor
          Found in cloudsmith_cli/core/api/entitlements.py - About 45 mins to fix

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

            def usage(ctx, opts, owner_repo, packages, start, finish):
            Severity: Minor
            Found in cloudsmith_cli/cli/commands/metrics/packages.py - About 45 mins to fix

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

              def _print_metrics_table(opts, data):
                  """Print metrics as a table."""
                  category_keys = {"Bandwidth": "bandwidth", "Downloads": "downloads"}
              
                  metrics_keys = {
              Severity: Minor
              Found in cloudsmith_cli/cli/commands/metrics/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 rate_limit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def rate_limit(client, headers):
                  """Pause the process based on suggested rate interval."""
                  if not client or not headers:
                      return False
              
              
              Severity: Minor
              Found in cloudsmith_cli/core/ratelimits.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 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 get_package_formats has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                def get_package_formats():
                    """Get the list of available package formats and parameters."""
                
                    # pylint: disable=fixme
                    # HACK: This obviously isn't great, and it is subject to change as
                Severity: Minor
                Found in cloudsmith_cli/core/api/packages.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 usage has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def usage(ctx, opts, owner_repo, tokens, start, finish):
                Severity: Minor
                Found in cloudsmith_cli/cli/commands/metrics/entitlements.py - About 45 mins to fix

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

                  def make_table(headers=None, rows=None):
                      """Make a table from headers and rows."""
                      if callable(headers):
                          headers = headers()
                      if callable(rows):
                  Severity: Minor
                  Found in cloudsmith_cli/cli/table.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 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 validate_slashes has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def validate_slashes(
                  Severity: Minor
                  Found in cloudsmith_cli/cli/validators.py - About 45 mins to fix

                    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 print_upstreams has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def print_upstreams(upstreams, upstream_fmt):
                          """Print upstreams as a table or output in another format."""
                      
                          def build_row(u):
                              row = [
                      Severity: Minor
                      Found in cloudsmith_cli/cli/commands/upstream.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 resync_package has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def resync_package(ctx, opts, owner, repo, slug, skip_errors):
                      Severity: Minor
                      Found in cloudsmith_cli/cli/commands/resync.py - About 45 mins to fix

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

                        def get(ctx, opts, owner_repo, page, page_size):
                        Severity: Minor
                        Found in cloudsmith_cli/cli/commands/repos.py - About 35 mins to fix

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

                          def remove_quarantine(ctx, opts, owner_repo_package, page, page_size):
                          Severity: Minor
                          Found in cloudsmith_cli/cli/commands/quarantine.py - About 35 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language