cloudsmith-io/cloudsmith-cli

View on GitHub

Showing 98 of 172 total issues

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

def list_repos(owner=None, **kwargs):
    """List repositories in a namespace."""
    client = get_repos_api()

    api_kwargs = {}
Severity: Minor
Found in cloudsmith_cli/core/api/repos.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 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 distros has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def distros(ctx, opts, package_format):
        """List available distributions."""
        # Use stderr for messages if the output is something else (e.g.  # JSON)
        use_stderr = opts.output != "pretty"
    
    
    Severity: Minor
    Found in cloudsmith_cli/cli/commands/list_.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 create_requests_session has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def create_requests_session(
    Severity: Major
    Found in cloudsmith_cli/core/rest.py - About 1 hr to fix

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

      def validate_api_headers(param, value):
          """Validate that API headers is a CSV of k=v pairs."""
          # pylint: disable=unused-argument
          if not value:
              return None
      Severity: Minor
      Found in cloudsmith_cli/cli/validators.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 upload_files_and_create_package has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

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

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

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

          def validate_slashes(
              param, value, minimum=2, maximum=None, form=None, allow_blank=False
          ):
              """Ensure that parameter has slashes and minimum parts."""
              try:
          Severity: Minor
          Found in cloudsmith_cli/cli/validators.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 wait_for_package_sync has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

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

            Function copy has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

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

              Function request has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def request(
              Severity: Major
              Found in cloudsmith_cli/core/rest.py - About 1 hr to fix

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

                def upload_files_and_create_package(
                    ctx,
                    opts,
                    package_type,
                    owner_repo,
                Severity: Minor
                Found in cloudsmith_cli/cli/commands/push.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 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 get has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                def get(ctx, opts, owner_repo, page, page_size):
                    """
                    List repositories for a namespace (owner).
                
                    OWNER/REPO: Specify the OWNER namespace (i.e user or org) to list the
                Severity: Minor
                Found in cloudsmith_cli/cli/commands/repos.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 _print_tags has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                def _print_tags(opts, all_tags, all_immutable_tags):
                    """Print the tags for a package."""
                    all_combined_tags = {"tags": all_tags, "tags_immutable": all_immutable_tags}
                
                    if utils.maybe_print_as_json(opts, all_combined_tags):
                Severity: Minor
                Found in cloudsmith_cli/cli/commands/tags.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 resync has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def resync(
                Severity: Major
                Found in cloudsmith_cli/cli/commands/resync.py - About 50 mins to fix

                  Function create_package has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def create_package(ctx, opts, owner, repo, package_type, skip_errors, **kwargs):
                  Severity: Major
                  Found in cloudsmith_cli/cli/commands/push.py - About 50 mins to fix

                    Function multi_part_upload_file has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def multi_part_upload_file(
                    Severity: Major
                    Found in cloudsmith_cli/core/api/files.py - About 50 mins to fix

                      Function validate_create_package has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def validate_create_package(
                      Severity: Major
                      Found in cloudsmith_cli/cli/commands/push.py - About 50 mins to fix

                        Function upload_file has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def upload_file(ctx, opts, owner, repo, filepath, skip_errors, md5_checksum):
                        Severity: Major
                        Found in cloudsmith_cli/cli/commands/push.py - About 50 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language