experteer/blobsterix

View on GitHub

Showing 43 of 43 total issues

File tables.rb has 1762 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class MimeMagic
  # @private
  # :nodoc:
  EXTENSIONS = {
    '123' => 'application/vnd.lotus-1-2-3',
Severity: Major
Found in lib/blobsterix/mimemagic/tables.rb - About 4 days to fix

    Class FileSystemMetaData has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class FileSystemMetaData < BlobMetaData
        include Blobsterix::Logable
    
          def initialize(path_, payload={})
            @payload=payload
    Severity: Minor
    Found in lib/blobsterix/storage/file_system_meta_data.rb - About 2 hrs to fix

      Method create_simple_trafo has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.create_simple_trafo(name_, input, output, is_format_=false, &block)
          trafo = ::Class.new Blobsterix::Transformations::Transformation do
      
            def self.name=(obj)
              @name=obj
      Severity: Major
      Found in lib/blobsterix/transformation/image_transformation.rb - About 2 hrs to fix

        Method Hash64B has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.Hash64B(key)
            len = key.size
            seed = 11
        
            m = 0x5bd1e995 #1540483477
        Severity: Minor
        Found in lib/blobsterix/helper/murmur.rb - About 1 hr to fix

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

                def call()
                  if not meta.valid
                    Http.NotFound()
                  elsif Blobsterix.use_x_send_file and etag != meta.etag
                    [200, meta.header.merge({"X-Sendfile" => meta.path.to_s}).merge(content_disposition_header), ""]
          Severity: Minor
          Found in lib/blobsterix/helper/data_response.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 12 (exceeds 5 allowed). Consider refactoring.
          Open

                def get_file(send_with_data=true)
                  return Http.NotAuthorized unless check_auth
                  return Http.NotFound if favicon
          
                  if bucket?
          Severity: Minor
          Found in lib/blobsterix/s3/s3_api.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 invalidate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

                def invalidate(blob_access, delete_single=false)
                  if delete_single
                    FileSystemMetaData.new(cache_file_path(blob_access)).delete
                  else
                    cache_path(blob_access).entries.each {|cache_file|
          Severity: Minor
          Found in lib/blobsterix/storage/cache.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 run_transformation has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def run_transformation(blob_access)
                  logger.debug "Transformation: build #{blob_access}"
          
                  metaData = blob_access.source || Blobsterix::BlobAccess.new(:bucket => blob_access.bucket,:id => blob_access.id).get
          
          
          Severity: Minor
          Found in lib/blobsterix/transformation/transformation_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 by_magic has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.by_magic(io)
              mime =
                unless io.respond_to?(:seek) && io.respond_to?(:read)
                  str = io.respond_to?(:read) ? io.read : io.to_s
                  str = str.force_encoding(Encoding::BINARY) if str.respond_to? :force_encoding
          Severity: Minor
          Found in lib/blobsterix/mimemagic/magic.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 bucket has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def bucket
                return env['HTTP_X_AMZ_BUCKET'] if env['HTTP_X_AMZ_BUCKET']
                host = bucket_matcher(env['HTTP_HOST'])
                if host
                  host[1]
          Severity: Minor
          Found in lib/blobsterix/s3/s3_url_helper.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 Hash64A has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.Hash64A (key)
              len = key.size
              seed = 11
          
              m = 0xc6a4a7935bd1e995
          Severity: Minor
          Found in lib/blobsterix/helper/murmur.rb - About 1 hr to fix

            Method run_transformation has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def run_transformation(blob_access)
                    logger.debug "Transformation: build #{blob_access}"
            
                    metaData = blob_access.source || Blobsterix::BlobAccess.new(:bucket => blob_access.bucket,:id => blob_access.id).get
            
            
            Severity: Minor
            Found in lib/blobsterix/transformation/transformation_manager.rb - About 1 hr to fix

              Method list has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                    def list(bucket="root", opts={})
                      begin
                        if bucket =~ /root/
                          list_buckets
                        else
              Severity: Minor
              Found in lib/blobsterix/storage/file_system.rb - 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

              Method finish has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def finish(accept_type, trafo)
                    if @transformations.empty? or (not @transformations.last[0].output_type.equal?(accept_type) and not @transformations.last[0].is_format?)
                      @transformations << [trafo, nil] if trafo != nil && trafo.is_format?
                    end
                    accept_type =  @transformations.empty? || !@transformations.last[0].is_format? ? nil : @transformations.last[0].output_type
              Severity: Minor
              Found in lib/blobsterix/transformation/transformation_chain.rb - 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

              Method Hash64A has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.Hash64A (key)
                  len = key.size
                  seed = 11
              
                  m = 0xc6a4a7935bd1e995
              Severity: Minor
              Found in lib/blobsterix/helper/murmur.rb - 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

              Method load_meta_file has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                      def load_meta_file
                        return if not valid
              
                        if not File.exists?(meta_path)
                          save_meta_file
              Severity: Minor
              Found in lib/blobsterix/storage/file_system_meta_data.rb - 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

              Method to_xml has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def to_xml()
                      xml = Nokogiri::XML::Builder.new do |xml|
                      xml.BlobsterixStatus() {
                        self.class.json_vars.each{|var_name|
                          var = send(var_name)
              Severity: Minor
              Found in lib/blobsterix/helper/jsonizer.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 create_simple_trafo has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def self.create_simple_trafo(name_, input, output, is_format_=false, &block)
              Severity: Minor
              Found in lib/blobsterix/transformation/image_transformation.rb - About 35 mins to fix

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    ['image/x-portable-graymap', [[0, 'P2', [[2, "\n"], [2, ' '], [2, "\t"], [2, "\r"]]], [0, 'P5', [[2, "\n"], [2, ' '], [2, "\t"], [2, "\r"]]]]],
                Severity: Minor
                Found in lib/blobsterix/mimemagic/tables.rb and 2 other locations - About 35 mins to fix
                lib/blobsterix/mimemagic/tables.rb on lines 1660..1660
                lib/blobsterix/mimemagic/tables.rb on lines 1662..1662

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 35.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    ['image/x-portable-bitmap', [[0, 'P1', [[2, "\n"], [2, ' '], [2, "\t"], [2, "\r"]]], [0, 'P4', [[2, "\n"], [2, ' '], [2, "\t"], [2, "\r"]]]]],
                Severity: Minor
                Found in lib/blobsterix/mimemagic/tables.rb and 2 other locations - About 35 mins to fix
                lib/blobsterix/mimemagic/tables.rb on lines 1661..1661
                lib/blobsterix/mimemagic/tables.rb on lines 1662..1662

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 35.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language