cloudfoundry-community/bosh-cloudstack-cpi

View on GitHub
blobstore_client/lib/blobstore_client/s3_blobstore_client.rb

Summary

Maintainability
B
5 hrs
Test Coverage

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

      def initialize(options)
        super(options)
        @bucket_name    = @options[:bucket_name]
        @encryption_key = @options[:encryption_key]

Severity: Minor
Found in blobstore_client/lib/blobstore_client/s3_blobstore_client.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 get_file has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def get_file(object_id, file)
        object_id = full_oid_path(object_id)
        return @simple.get_file(object_id, file) if @simple

        if @encryption_key
Severity: Minor
Found in blobstore_client/lib/blobstore_client/s3_blobstore_client.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 initialize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def initialize(options)
        super(options)
        @bucket_name    = @options[:bucket_name]
        @encryption_key = @options[:encryption_key]

Severity: Minor
Found in blobstore_client/lib/blobstore_client/s3_blobstore_client.rb - About 1 hr to fix

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

          def create_file(object_id, file)
            raise BlobstoreError, 'unsupported action' if @simple
    
            object_id ||= generate_object_id
    
    
    Severity: Minor
    Found in blobstore_client/lib/blobstore_client/s3_blobstore_client.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 delete_object has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def delete_object(object_id)
            raise BlobstoreError, 'unsupported action' if @simple
            object_id = full_oid_path(object_id)
            object = get_object_from_s3(object_id)
            unless object.exists?
    Severity: Minor
    Found in blobstore_client/lib/blobstore_client/s3_blobstore_client.rb - 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

    There are no issues that match your filters.

    Category
    Status