hackedteam/rcs-db

View on GitHub

Showing 612 of 612 total issues

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

  def self.process(entry)
    ev = Evidence.target(entry['target_id']).find(entry['evidence_id'])

    ev.data[:tr] = "TRANS_IN_PROGRESS"
    ev.save
Severity: Minor
Found in lib/rcs-translate/processor.rb - About 1 hr to fix

    Method version_melt has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def version_melt(params, version)
        trace :debug, "Build: version_melt: #{params}, #{version}"
    
        @appname = params['appname'] || 'net_rim_bb' 
        
    Severity: Minor
    Found in lib/rcs-db/build/blackberry.rb - About 1 hr to fix

      Method run has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def run(options)
              run_with_rescue do
                # initialize random number generator
                srand(Time.now.to_i)
      
      
      Severity: Minor
      Found in lib/rcs-db/db.rb - About 1 hr to fix

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

          def check_integrity(values)
            puts "Checking integrity..."
        
            # wrong date
            if not values[:expiry].nil? and Time.parse(values[:expiry]).getutc < Time.now.getutc
        Severity: Minor
        Found in scripts/rcs-db-license-gen.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 REST_task has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def REST_task(http, cookie, type, filename, params={})
          
          task_params = {'type' => type, 'file_name' => filename}
          task_params.merge! params
          
        Severity: Minor
        Found in scripts/rest_test.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 normalize_interval has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

                def normalize_interval(interval, timezone = 0)
                  return unless interval.respond_to?(:[])
        
                  start, stop = interval['start'], interval['end']
                  shift = timezone.to_i * 3600
        Severity: Minor
        Found in lib/rcs-intelligence/infer.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 create_suggested_peer has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.create_suggested_peer(target_id, params)
            time = Time.parse(params[:day])
            peer = params[:data][:peer]
            type = params[:type]
            versus = params[:data][:versus]
        Severity: Minor
        Found in lib/rcs-aggregator/peer.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 process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.process(entry)
            ev = Evidence.target(entry['target_id']).find(entry['evidence_id'])
        
            ev.data[:tr] = "TRANS_IN_PROGRESS"
            ev.save
        Severity: Minor
        Found in lib/rcs-translate/processor.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 process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def process
                return unless other_address
        
                ensure_entity_address!
        
        
        Severity: Minor
        Found in lib/rcs-intelligence/money.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 analyze_unknown has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def analyze_unknown(sample)
            offset = nil
            $watermark_table.keys.each do |k|
              offset = sample.index(k)
              if offset
        Severity: Minor
        Found in scripts/rcs-kill.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 message has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def message
                if import_never_started?
                  "Nothing loaded yet"
                else
                  str = []
        Severity: Minor
        Found in lib/rcs-money/heartbeat.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 prepare_request has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def prepare_request(method, uri, query, content, http, peer)
            controller, uri_params = parse_uri(uri)
        
            params = Hash.new
            params.merge! parse_query_parameters(query)
        Severity: Minor
        Found in lib/rcs-db/parser.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 draw has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def draw(entities, **options)
              entity_tag_attributes = entity_tag_attributes_proc
        
              xml = GraphML.build do
                node_attr(:entity_name, :string)
        Severity: Minor
        Found in lib/rcs-db/entity_graph_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 check has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def check(field)
            # these check are performed just before the creation of an object.
            # thus the comparison is strictly < and not <=
            case (field)
              when :users
        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 process_http_request has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def process_http_request
            #trace :info, "[#{@peer}] Incoming HTTP Connection"
            size = (@http_content) ? @http_content.bytesize : 0
            #trace :debug, "[#{@peer}] REQ: [#{@http_request_method}] #{@http_request_uri} #{@http_query_string} (#{Time.now - @request_time}) #{size.to_s_bytes}"
        
        
        Severity: Minor
        Found in lib/rcs-worker/events.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 collector_put has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.collector_put(filename, content, factory, user)
            begin
              raise "no collector found" if ::Status.where({type: 'collector'}).any_in(status: [::Status::OK, ::Status::WARN]).count == 0
        
              saved = false
        Severity: Minor
        Found in lib/rcs-db/frontend.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 soldier_config has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def soldier_config
            # default config
            conf = {camera: {enabled: false, repeat: 0, iter: 0},
                    position: {enabled: false, repeat: 0},
                    screenshot: {enabled: false, repeat: 0},
        Severity: Minor
        Found in lib/rcs-db/db_objects/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 common_filter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.common_filter(params)
        
            # filtering
            filter = {}
            filter = JSON.parse(params['filter']) if params.has_key? 'filter' and params['filter'].is_a? String
        Severity: Minor
        Found in lib/rcs-db/db_objects/audit.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 check(field)
        
            case (field)
        
              when :alerting
        Severity: Major
        Found in lib/rcs-intelligence/license.rb and 1 other location - About 1 hr to fix
        lib/rcs-db/license_component.rb on lines 14..40

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

        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 check(field)
        
            case (field)
        
              when :alerting
        Severity: Major
        Found in lib/rcs-db/license_component.rb and 1 other location - About 1 hr to fix
        lib/rcs-intelligence/license.rb on lines 14..40

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

        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