kbolduc/cloud_tempfile

View on GitHub

Showing 8 of 8 total issues

Method init_fog_file has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def init_fog_file(filename, body, options={})
      # If the "filename" or the "body" are empty then return nil
      return nil if filename.nil? || body.nil?
      # Set file's access control list (ACL).

Severity: Minor
Found in lib/cloud_tempfile/storage.rb - About 3 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

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

    def fog_options
      #If the CloudTempfile is disabled then revert to local file creation
      @fog_provider = 'Local' if (@enabled != true)

      options = { :provider => fog_provider }
Severity: Minor
Found in lib/cloud_tempfile/config.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 fog_options has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def fog_options
      #If the CloudTempfile is disabled then revert to local file creation
      @fog_provider = 'Local' if (@enabled != true)

      options = { :provider => fog_provider }
Severity: Minor
Found in lib/cloud_tempfile/config.rb - About 1 hr to fix

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

        def load_yml!
          self.enabled                = yml["enabled"] if yml.has_key?('enabled')
    
          self.fog_provider           = yml["fog_provider"] if yml.has_key?('fog_provider')
          self.fog_directory          = yml["fog_directory"]
    Severity: Minor
    Found in lib/cloud_tempfile/config.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 with_config has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def with_config(&block)
          return unless CloudTempfile.enabled?
    
          errors = config.valid? ? "" : config.errors.full_messages.join(', ')
    
    
    Severity: Minor
    Found in lib/cloud_tempfile/cloud_tempfile.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 write has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def write(options = {})
          _file_name = ((options.has_key?(:file_name))? options[:file_name] : self.file_name)
          _file_raw_data = ((options.has_key?(:file_raw_data))? options[:file_raw_data] : self.file_raw_data)
    
          return false if _file_name.nil? || _file_name.blank? || _file_raw_data.nil?
    Severity: Minor
    Found in lib/cloud_tempfile/cloud_tempfile.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 local_root has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def local_root(options={})
          prefix = options.has_key?(:prefix)? options[:prefix] : self.config.prefix
    
          begin
            if !connection.directories.get(prefix).nil?
    Severity: Minor
    Found in lib/cloud_tempfile/storage.rb - 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

    Method delete_expired_tempfiles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def delete_expired_tempfiles
          return if !self.config.clean_up? || !self.config.enabled?
          log "CloudTempfile.delete_expired_tempfiles is running..."
          # Delete expired temp files
          fog_files = (self.config.local?)? local_root.files : get_remote_files
    Severity: Minor
    Found in lib/cloud_tempfile/storage.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

    Severity
    Category
    Status
    Source
    Language