cloudfoundry-community/bosh-cloudstack-cpi

View on GitHub
bosh_cli/lib/cli/blob_manager.rb

Summary

Maintainability
D
1 day
Test Coverage

Method process_blobs_directory has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def process_blobs_directory
      @updated_blobs = []
      @new_blobs = []

      Dir[File.join(@blobs_dir, "**", "*")].each do |file|
Severity: Minor
Found in bosh_cli/lib/cli/blob_manager.rb - 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 blob_manager.rb has 259 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Bosh::Cli
  # In order to avoid storing large objects in git repo,
  # release might save them in the blobstore instead.
  # BlobManager encapsulates most of the blob operations.
  class BlobManager
Severity: Minor
Found in bosh_cli/lib/cli/blob_manager.rb - About 2 hrs to fix

    Method initialize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(release)
          @release = release
          @index_file = File.join(@release.dir, "config", DEFAULT_INDEX_NAME)
    
          legacy_index_file = File.join(@release.dir, "blob_index.yml")
    Severity: Minor
    Found in bosh_cli/lib/cli/blob_manager.rb - 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

    Method download_blob has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def download_blob(path)
          unless @index.has_key?(path)
            err("Unknown blob path `#{path}'")
          end
    
    
    Severity: Minor
    Found in bosh_cli/lib/cli/blob_manager.rb - 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

    Method add_blob has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def add_blob(local_path, blob_path)
          unless File.exists?(local_path)
            err("File `#{local_path}' not found")
          end
    
    
    Severity: Minor
    Found in bosh_cli/lib/cli/blob_manager.rb - About 1 hr to fix

      Method initialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def initialize(release)
            @release = release
            @index_file = File.join(@release.dir, "config", DEFAULT_INDEX_NAME)
      
            legacy_index_file = File.join(@release.dir, "blob_index.yml")
      Severity: Minor
      Found in bosh_cli/lib/cli/blob_manager.rb - About 1 hr to fix

        Method add_blob has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def add_blob(local_path, blob_path)
              unless File.exists?(local_path)
                err("File `#{local_path}' not found")
              end
        
        
        Severity: Minor
        Found in bosh_cli/lib/cli/blob_manager.rb - 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

        Method download_blob has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def download_blob(path)
              unless @index.has_key?(path)
                err("Unknown blob path `#{path}'")
              end
        
        
        Severity: Minor
        Found in bosh_cli/lib/cli/blob_manager.rb - About 1 hr to fix

          Method process_index has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def process_index
                @index.each_pair do |path, entry|
                  if File.exists?(File.join(@src_dir, path))
                    err("File `#{path}' is in both blob index and src directory.\n" +
                        "Please fix release repo before proceeding")
          Severity: Minor
          Found in bosh_cli/lib/cli/blob_manager.rb - 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

          There are no issues that match your filters.

          Category
          Status