fredjean/middleman-s3_sync

View on GitHub

Showing 11 of 11 total issues

Class Resource has 40 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Resource
      attr_accessor :path, :resource, :partial_s3_resource, :full_s3_resource, :content_type, :gzipped, :options

      CONTENT_MD5_KEY = 'x-amz-meta-content-md5'
      REDIRECT_KEY = 'x-amz-website-redirect-location'
Severity: Minor
Found in lib/middleman/s3_sync/resource.rb - About 5 hrs to fix

    Method s3_sync has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def s3_sync
            env = options[:environment].to_s.to_sym
            verbose = options[:verbose] ? 0 : 1
            instrument = options[:instrument]
    
    
    Severity: Minor
    Found in lib/middleman-s3_sync/commands.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

    Method after_configuration has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def after_configuration
          read_config
          options.aws_access_key_id ||= ENV['AWS_ACCESS_KEY_ID']
          options.aws_secret_access_key ||= ENV['AWS_SECRET_ACCESS_KEY']
          options.aws_session_token ||= ENV['AWS_SESSION_TOKEN'] || ENV['AWS_SECURITY_TOKEN']
    Severity: Minor
    Found in lib/middleman-s3_sync/extension.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 status has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def status
            @status ||= if shunned?
                          :ignored
                        elsif directory?
                          if remote?
    Severity: Minor
    Found in lib/middleman/s3_sync/resource.rb - About 1 hr to fix

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

            def cache_control
              policy = []
              policy << "max-age=#{policies.max_age}" if policies.has_key?(:max_age)
              policy << "s-maxage=#{policies.s_maxage}" if policies.has_key?(:s_maxage)
              policy << "public" if policies.fetch(:public, false)
      Severity: Minor
      Found in lib/middleman/s3_sync/caching_policy.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 ignore! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def ignore!
              if options.verbose
                reason = if redirect?
                           :redirect
                         elsif directory?
      Severity: Minor
      Found in lib/middleman/s3_sync/resource.rb - About 35 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 update_bucket_website has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def update_bucket_website
              opts = {}
              opts[:IndexDocument] = s3_sync_options.index_document if s3_sync_options.index_document
              opts[:ErrorDocument] = s3_sync_options.error_document if s3_sync_options.error_document
      
      
      Severity: Minor
      Found in lib/middleman/s3_sync.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

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

          def read_config(io = nil)
            unless io
              root_path = ::Middleman::Application.root
              config_file_path = File.join(root_path, ".s3_sync")
      
      
      Severity: Minor
      Found in lib/middleman-s3_sync/extension.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

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

            def update!
              local_content { |body|
                say_status "#{ANSI.blue{"Updating"}} #{remote_path}#{ gzipped ? ANSI.white {' (gzipped)'} : ''}"
                s3_resource.merge_attributes(to_h)
                s3_resource.body = body
      Severity: Minor
      Found in lib/middleman/s3_sync/resource.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

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

            def to_h
              attributes = {
                :key => key,
                :acl => options.acl,
                :content_type => content_type,
      Severity: Minor
      Found in lib/middleman/s3_sync/resource.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

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

            def connection
              connection_options = {
                :endpoint => s3_sync_options.endpoint,
                :region => s3_sync_options.region,
                :path_style => s3_sync_options.path_style
      Severity: Minor
      Found in lib/middleman/s3_sync.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