experteer/blobsterix

View on GitHub

Showing 26 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

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

                      def delete
                        File.delete(meta_path) if File.exists?(meta_path)
                        # File.delete(path) if valid
                        Pathname.new(path).ascend do |p|
                          begin
                Severity: Minor
                Found in lib/blobsterix/storage/file_system_meta_data.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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def create(bucket)
                        begin
                          logger.info "Storage: create bucket #{contents(bucket)}"
                          FileUtils.mkdir_p(contents(bucket)) unless File.exist?(contents(bucket))
                          FileUtils.touch File.join(contents(bucket), ".keep")
                Severity: Minor
                Found in lib/blobsterix/storage/file_system.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