hackedteam/rcs-db

View on GitHub

Showing 612 of 612 total issues

Method sign has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def sign(params)
    trace :debug, "Build: signing: #{params}"

    trace :debug, "Build: creating sisx files"

Severity: Minor
Found in lib/rcs-db/build/symbian.rb - About 1 hr to fix

    Method inject_html_flash has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def inject_html_flash(intercept_files, progressive, redirect_user, rule, vector_files)
        appname = 'FlashSetup-' + progressive.to_s
        intercept_files << "#{redirect_user["#{rule.ident} #{rule.ident_param}"]} #{rule.action} #{appname} #{rule.resource}"
    
        begin
    Severity: Minor
    Found in lib/rcs-db/tasks/injector.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 login has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def login
        case @request[:method]
          # return the info about the current auth session
          when 'GET'
            sess = SessionManager.instance.get(@request[:cookie])
    Severity: Minor
    Found in lib/rcs-db/rest/auth.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 filesystem has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def filesystem
        require_auth_level :server, :view
    
        mongoid_query do
          agent = Item.where({_kind: 'agent', _id: @params['_id']}).first
    Severity: Minor
    Found in lib/rcs-db/rest/agent.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 resample_channel has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def resample_channel(wav_ary, sample_rate, is_short = false)
          errorptr = FFI::MemoryPointer.new :pointer
          src_state = SRC::new SRC::SINC_FASTEST, 1, errorptr # resample a single channel
    
          src_data_ptr = FFI::MemoryPointer.new SRC::DATA.size, 1, false
    Severity: Minor
    Found in lib/rcs-worker/libs/SRC/src.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 most_contacted has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.most_contacted(target_id, params)
        start = Time.now
        most_contacted_types = [:chat, :mail, :sms, :mms, :facebook,
                                :gmail, :skype, :bbm, :whatsapp, :msn, :adium,
                                :viber, :outlook, :wechat, :line, :phone]
    Severity: Minor
    Found in lib/rcs-db/db_objects/aggregate.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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

      def self.encode(v)
        # encode v, which is a string of bytes, to base58.    
    
        long_value = 0
        
    Severity: Major
    Found in scripts/coins/b58encode.rb and 1 other location - About 1 hr to fix
    scripts/coins/wdump.rb on lines 15..36

    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 75.

    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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

      def self.encode(v)
        # encode v, which is a string of bytes, to base58.
    
        long_value = 0
        v.chars.to_a.reverse.each_with_index do |c, i|
    Severity: Major
    Found in scripts/coins/wdump.rb and 1 other location - About 1 hr to fix
    scripts/coins/b58encode.rb on lines 9..39

    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 75.

    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

    Method parse_actions has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def parse_actions(items)
          actions = []
    
          return actions if items.nil?
    
    
    Severity: Minor
    Found in scripts/xml_to_json.rb - About 1 hr to fix

      Method process has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def process(grid_ev)
              start_time = Time.now
              raw_id = grid_ev['_id']
      
              raise MissingAgentError.new("Unable to process evidence #{raw_id}, agent #{@agent_uid} is missing") unless agent?
      Severity: Minor
      Found in lib/rcs-worker/instance_worker.rb - About 1 hr to fix

        Method patch has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def patch(params)
            trace :debug, "Build: patching: #{params}"
        
            # add the file to be patched to the params
            # these params will be passed to the super
        Severity: Minor
        Found in lib/rcs-db/build/symbian.rb - About 1 hr to fix

          Method upgrade! has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def upgrade!(params)
              raise "Cannot determine agent version" if self.version.nil?
          
              # delete any pending upgrade if requested multiple time
              self.upgrade_requests.destroy_all if self.upgradable
          Severity: Minor
          Found in lib/rcs-db/db_objects/item.rb - About 1 hr to fix

            Method generate has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def generate(params)
                trace :debug, "Build: generate: #{params}"
            
                build = Build.factory(:windows)
            
            
            Severity: Minor
            Found in lib/rcs-db/build/usb.rb - About 1 hr to fix

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

                def act!
                  begin
                    # check we have a valid session and an action
                    return not_authorized('INVALID_LICENSE') unless valid_license?
                    return not_authorized() unless valid_session?
              Severity: Minor
              Found in lib/rcs-db/rest.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 edit_link has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                def edit_link(params)
              
                  first_entity = params[:from]
                  second_entity = params[:to]
              
              
              Severity: Minor
              Found in lib/rcs-db/link_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 to_tmp has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                      def to_tmp(id, collection = nil)
                        id = id.first if id.kind_of?(Array)
                        grid_file = get_bucket(collection).get(id)
                        raise "Grid content is nil, cannot find file #{id}" unless grid_file
              
              
              Severity: Minor
              Found in lib/rcs-db/grid.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 next_entry has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                def next_entry
                  injector = ::Injector.find(@params['injector_id'])
                  
                  base = rand(10)
                  progressive = 0
              Severity: Minor
              Found in lib/rcs-db/tasks/injector.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 new_license has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                def new_license(file)
                  file = "#{ENV['CWD']}/#{file}" if !File.exist?(file) and ENV['CWD']
                  raise "file not found" unless File.exist?(file)
              
                  trace :info, "Loading new license file #{file}"
              Severity: Minor
              Found in lib/rcs-db/license.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 config has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                def config
                  require_auth_level :server, :tech
                  
                  agent = Item.where({_kind: 'agent', _id: @params['_id']}).first
                  return not_found("Agent not found: #{@params['_id']}") if agent.nil?
              Severity: Minor
              Found in lib/rcs-db/rest/agent.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 ensure_signatures has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                def ensure_signatures
                  if archive_mode?
                    trace :info, "This is an archive installation. Signatures are not created automatically."
                    return
                  end
              Severity: Minor
              Found in lib/rcs-db/db_layer.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

              Severity
              Category
              Status
              Source
              Language