hackedteam/rcs-db

View on GitHub

Showing 612 of 612 total issues

Method process_http_request has 28 lines of code (exceeds 25 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

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

      def unique(core)
        Zip::File.open(core) do |z|
          core_content = z.file.open('core', "rb") { |f| f.read }
          add_magic(core_content)
          File.open(Config.instance.temp('core'), "wb") {|f| f.write core_content}
    Severity: Major
    Found in lib/rcs-db/build/ios.rb and 2 other locations - About 1 hr to fix
    lib/rcs-db/build/osx.rb on lines 157..166
    lib/rcs-db/build/winmo.rb on lines 113..122

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

    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 3 locations. Consider refactoring.
    Open

      def unique(core)
        Zip::File.open(core) do |z|
          core_content = z.file.open('core', "rb") { |f| f.read }
          add_magic(core_content)
          File.open(Config.instance.temp('core'), "wb") {|f| f.write core_content}
    Severity: Major
    Found in lib/rcs-db/build/winmo.rb and 2 other locations - About 1 hr to fix
    lib/rcs-db/build/ios.rb on lines 132..141
    lib/rcs-db/build/osx.rb on lines 157..166

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

    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 3 locations. Consider refactoring.
    Open

      def unique(core)
        Zip::File.open(core) do |z|
          core_content = z.file.open('core', "rb") { |f| f.read }
          add_magic(core_content)
          File.open(Config.instance.temp('core'), "wb") {|f| f.write core_content}
    Severity: Major
    Found in lib/rcs-db/build/osx.rb and 2 other locations - About 1 hr to fix
    lib/rcs-db/build/ios.rb on lines 132..141
    lib/rcs-db/build/winmo.rb on lines 113..122

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

    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 process has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

          def process(connector_queue)
            trace :debug, "Processing #{connector_queue}"
            connector = connector_queue.connector
            data = connector_queue.data
            type = connector_queue.type
    Severity: Minor
    Found in lib/rcs-connector/dispatcher.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 reload_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def reload_list
          list = []
          trace :debug, "Scanning Exploits..."
    
          begin
    Severity: Minor
    Found in lib/rcs-db/build/exploit.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 generate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def generate(params)
        trace :debug, "Build: generate: #{params}"
    
        # don't include support files into the outputs
        @outputs = []
    Severity: Minor
    Found in lib/rcs-db/build/qrcode.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 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        require_auth_level :admin, :sys, :tech, :view
        require_auth_level :admin_audit if @params['type'] == 'audit'
        require_auth_level :sys_backend if @params['type'] == 'compact'
        require_auth_level :sys_frontend if @params['type'] == 'topology'
    Severity: Minor
    Found in lib/rcs-db/rest/task.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 destroy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def destroy
        require_auth_level :sys, :tech
    
        mongoid_query do
    
    
    Severity: Minor
    Found in lib/rcs-db/rest/core.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 availables has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def availables
        require_auth_level :server
    
        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 run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def run(task)
    
        # recovered task already have the id and are in the journal
        unless task.has_key? :recover
          # the unique ident of this task
    Severity: Minor
    Found in lib/rcs-db/offload_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 index has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def index
        require_auth_level :view
        require_auth_level :view_profiles
    
        mongoid_query do
    Severity: Minor
    Found in lib/rcs-db/rest/entity.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 change_mongo_profiler_level has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def change_mongo_profiler_level
        result = session.command('$eval' => "db.getProfilingStatus()")
        profiler_level = result['retval']['was']
    
        trace(:warn, "MongoDB profiler is active") unless profiler_level.zero?
    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

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

      def ensure_cn_resolution
        # only for windows
        return unless RbConfig::CONFIG['host_os'] =~ /mingw/
    
        # don't add if it's an ip address
    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

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

      def initialize(params = {})
        set_attributes_default_values
    
        if params[:time]
          [:time, :start, :end].each do |param_name|
    Severity: Minor
    Found in lib/rcs-db/position/point.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_thumbnail has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def create_thumbnail
        self[:data] ||= {}
    
        return unless valid_grid_content?
    
    
    Severity: Minor
    Found in lib/rcs-worker/evidence/thumbnailable.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_or_update_group has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.create_or_update_group(operation, name: nil, children: [], stand_for: nil)
        children = children[0].respond_to?(:id) ? children.map(&:id) : children
        level = stand_for ? :automatic : :manual
        operation = operation.respond_to?(:id) ? operation : Item.operations.find(operation)
    
    
    Severity: Minor
    Found in lib/rcs-db/db_objects/entity.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 dispatch has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

          def dispatch(type, message)
            each_session_with_web_socket do |session, web_socket|
              usr_id = session.user.id
    
              # if we have specified a recepient(s), skip all the other online users
    Severity: Minor
    Found in lib/rcs-db/push.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

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

      def most_visited_urls
        require_auth_level :view
        require_auth_level :view_profiles
    
        return conflict('LICENSE_LIMIT_REACHED') unless LicenseManager.instance.check :correlation
    Severity: Major
    Found in lib/rcs-db/rest/entity.rb and 2 other locations - About 1 hr to fix
    lib/rcs-db/rest/entity.rb on lines 278..291
    lib/rcs-db/rest/entity.rb on lines 312..325

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

    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 2 locations. Consider refactoring.
    Open

      def self.run!(*argv)
        # reopen the class and declare any empty trace method
        # if called from command line, we don't have the trace facility
        self.class_eval do
          def trace(level, message)
    Severity: Major
    Found in lib/rcs-worker/statistics.rb and 1 other location - About 1 hr to fix
    lib/rcs-db/statistics.rb on lines 165..193

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

    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