hackedteam/rcs-collector

View on GitHub
lib/rcs-collector/db_rest.rb

Summary

Maintainability
F
4 days
Test Coverage

File db_rest.rb has 539 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rcs-common/trace'
require 'rcs-common/cgi'

# system
require 'net/http'
Severity: Major
Found in lib/rcs-collector/db_rest.rb - About 1 day to fix

    Class DB_rest has 48 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class DB_rest
      include RCS::Tracer
    
      def initialize(host)
        @host, @port = host.split(':')
    Severity: Minor
    Found in lib/rcs-collector/db_rest.rb - About 6 hrs to fix

      Method status_update has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def status_update(component, remoteip, status, message, disk, cpu, pcpu, type, version)
      Severity: Major
      Found in lib/rcs-collector/db_rest.rb - About 1 hr to fix

        Method sync_start has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def sync_start(session, version, user, device, source, time)
        Severity: Minor
        Found in lib/rcs-collector/db_rest.rb - About 45 mins to fix

          Method sync_update has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def sync_update(session, version, user, device, source, time)
          Severity: Minor
          Found in lib/rcs-collector/db_rest.rb - About 45 mins to fix

            Method agent_status has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def agent_status(build_id, instance_id, platform, demo, level)
            Severity: Minor
            Found in lib/rcs-collector/db_rest.rb - About 35 mins to fix

              Avoid too many return statements within this method.
              Open

                        return {status: DB::QUEUED_AGENT, id: aid, good: good}
              Severity: Major
              Found in lib/rcs-collector/db_rest.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                          return {status: DB::CLOSED_AGENT, id: aid, good: good}
                Severity: Major
                Found in lib/rcs-collector/db_rest.rb - About 30 mins to fix

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

                    def agent_status(build_id, instance_id, platform, demo, level)
                      begin
                        request = {:ident => build_id, :instance => instance_id, :platform => platform, :demo => demo, :level => level}
                        ret = rest_call('GET', '/agent/status/?' + CGI.encode_query(request))
                  
                  
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.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

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

                    def new_upgrades(bid)
                      begin
                        ret = rest_call('GET', "/agent/upgrades/#{bid}")
                  
                        upgr = {}
                  Severity: Major
                  Found in lib/rcs-collector/db_rest.rb and 1 other location - About 2 hrs to fix
                  lib/rcs-collector/db_rest.rb on lines 373..390

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

                  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 new_uploads(bid)
                      begin
                        ret = rest_call('GET', "/agent/uploads/#{bid}")
                  
                        upl = {}
                  Severity: Major
                  Found in lib/rcs-collector/db_rest.rb and 1 other location - About 2 hrs to fix
                  lib/rcs-collector/db_rest.rb on lines 402..419

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

                  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 new_downloads(bid)
                      begin
                        ret = rest_call('GET', "/agent/downloads/#{bid}")
                  
                        down = {}
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 1 other location - About 55 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 508..522

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

                  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 new_exec(bid)
                      begin
                        ret = rest_call('GET', "/agent/exec/#{bid}")
                  
                        commands = {}
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 1 other location - About 55 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 432..446

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

                  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 sync_end(session)
                      begin
                        content = {:bid => session[:bid], :instance => session[:instance], :cookie => session[:cookie], :sync_stat => session[:sync_stat]}
                        return rest_call('POST', '/evidence/stop', content.to_json)
                      rescue Exception => e
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 1 other location - About 55 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 153..160

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

                  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 sync_timeout(session)
                      begin
                        content = {:bid => session[:bid], :instance => session[:instance], :cookie => session[:cookie], :sync_stat => session[:sync_stat]}
                        return rest_call('POST', '/evidence/timeout', content.to_json)
                      rescue Exception => e
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 1 other location - About 55 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 163..170

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

                  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

                    def new_conf(bid)
                      begin
                        ret = rest_call('GET', "/agent/config/#{bid}")
                  
                        if ret.kind_of? Net::HTTPNotFound then
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 2 other locations - About 40 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 553..565
                  lib/rcs-collector/db_rest.rb on lines 568..580

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

                  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

                    def injector_upgrade(id)
                      begin
                        ret = rest_call('GET', "/injector/upgrade/#{id}")
                  
                        if ret.kind_of? Net::HTTPNotFound
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 2 other locations - About 40 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 349..361
                  lib/rcs-collector/db_rest.rb on lines 553..565

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

                  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

                    def injector_config(id)
                      begin
                        ret = rest_call('GET', "/injector/config/#{id}")
                  
                        if ret.kind_of? Net::HTTPNotFound
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 2 other locations - About 40 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 349..361
                  lib/rcs-collector/db_rest.rb on lines 568..580

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

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

                    def agent_signature
                      begin
                        ret = rest_call('GET', '/signature/agent')
                        sign = JSON.parse(ret.body)['value']
                        return sign
                  Severity: Major
                  Found in lib/rcs-collector/db_rest.rb and 5 other locations - About 35 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 224..232
                  lib/rcs-collector/db_rest.rb on lines 235..243
                  lib/rcs-collector/db_rest.rb on lines 246..254
                  lib/rcs-collector/db_rest.rb on lines 257..265
                  lib/rcs-collector/db_rest.rb on lines 268..276

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

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

                    def check_signature
                      begin
                        ret = rest_call('GET', '/signature/check')
                        sign = JSON.parse(ret.body)['value']
                        return sign
                  Severity: Major
                  Found in lib/rcs-collector/db_rest.rb and 5 other locations - About 35 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 213..221
                  lib/rcs-collector/db_rest.rb on lines 224..232
                  lib/rcs-collector/db_rest.rb on lines 235..243
                  lib/rcs-collector/db_rest.rb on lines 257..265
                  lib/rcs-collector/db_rest.rb on lines 268..276

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

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

                    def crc_signature
                      begin
                        ret = rest_call('GET', '/signature/crc')
                        sign = JSON.parse(ret.body)['value']
                        return sign
                  Severity: Major
                  Found in lib/rcs-collector/db_rest.rb and 5 other locations - About 35 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 213..221
                  lib/rcs-collector/db_rest.rb on lines 224..232
                  lib/rcs-collector/db_rest.rb on lines 235..243
                  lib/rcs-collector/db_rest.rb on lines 246..254
                  lib/rcs-collector/db_rest.rb on lines 268..276

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

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

                    def updater_signature
                      begin
                        ret = rest_call('GET', '/signature/updater')
                        sign = JSON.parse(ret.body)['value']
                        return sign
                  Severity: Major
                  Found in lib/rcs-collector/db_rest.rb and 5 other locations - About 35 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 213..221
                  lib/rcs-collector/db_rest.rb on lines 224..232
                  lib/rcs-collector/db_rest.rb on lines 246..254
                  lib/rcs-collector/db_rest.rb on lines 257..265
                  lib/rcs-collector/db_rest.rb on lines 268..276

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

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

                    def network_signature
                      begin
                        ret = rest_call('GET', '/signature/network')
                        sign = JSON.parse(ret.body)['value']
                        return sign
                  Severity: Major
                  Found in lib/rcs-collector/db_rest.rb and 5 other locations - About 35 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 213..221
                  lib/rcs-collector/db_rest.rb on lines 235..243
                  lib/rcs-collector/db_rest.rb on lines 246..254
                  lib/rcs-collector/db_rest.rb on lines 257..265
                  lib/rcs-collector/db_rest.rb on lines 268..276

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

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

                    def sha1_signature
                      begin
                        ret = rest_call('GET', '/signature/sha1')
                        sign = JSON.parse(ret.body)['value']
                        return sign
                  Severity: Major
                  Found in lib/rcs-collector/db_rest.rb and 5 other locations - About 35 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 213..221
                  lib/rcs-collector/db_rest.rb on lines 224..232
                  lib/rcs-collector/db_rest.rb on lines 235..243
                  lib/rcs-collector/db_rest.rb on lines 246..254
                  lib/rcs-collector/db_rest.rb on lines 257..265

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

                  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

                    def del_exec(bid, id)
                      begin
                        return rest_call('DELETE', "/agent/exec/#{bid}?" + CGI.encode_query({:exec => id}))
                      rescue Exception => e
                        trace :error, "Error calling del_exec: #{e.class} #{e.message}"
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 2 other locations - About 30 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 393..399
                  lib/rcs-collector/db_rest.rb on lines 449..455

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

                  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

                    def del_download(bid, id)
                      begin
                        return rest_call('DELETE', "/agent/download/#{bid}?" + CGI.encode_query({:download => id}))
                      rescue Exception => e
                        trace :error, "Error calling del_download: #{e.class} #{e.message}"
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 2 other locations - About 30 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 393..399
                  lib/rcs-collector/db_rest.rb on lines 525..531

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

                  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

                    def del_upload(bid, id)
                      begin
                        return rest_call('DELETE', "/agent/upload/#{bid}?" + CGI.encode_query({:upload => id}))
                      rescue Exception => e
                        trace :error, "Error calling del_upload: #{e.class} #{e.message}"
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 2 other locations - About 30 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 449..455
                  lib/rcs-collector/db_rest.rb on lines 525..531

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

                  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 get_collectors
                      begin
                        ret = rest_call('GET', "/collector")
                        return JSON.parse(ret.body)
                      rescue Exception => e
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 1 other location - About 25 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 534..541

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

                  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 get_injectors
                      begin
                        ret = rest_call('GET', "/injector")
                        return JSON.parse(ret.body)
                      rescue Exception => e
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 1 other location - About 25 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 593..600

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

                  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 injector_set_version(id, version)
                      begin
                        rest_call('POST', "/injector/version/#{id}", {:version => version}.to_json)
                      rescue Exception => e
                        trace :error, "Error calling injector_set_version: #{e.class} #{e.message}"
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 1 other location - About 25 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 603..609

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

                  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 collector_set_version(id, version)
                      begin
                        rest_call('POST', "/collector/version/#{id}", {:version => version}.to_json)
                      rescue Exception => e
                        trace :error, "Error calling collector_set_version: #{e.class} #{e.message}"
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 1 other location - About 25 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 544..550

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

                  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

                    def activate_conf(bid)
                      begin
                        return rest_call('DELETE', "/agent/config/#{bid}")
                      rescue Exception => e
                        trace :error, "Error calling activate_conf: #{e.class} #{e.message}"
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 2 other locations - About 15 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 422..428
                  lib/rcs-collector/db_rest.rb on lines 498..504

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

                  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

                    def del_purge(bid)
                      begin
                        return rest_call('DELETE', "/agent/purge/#{bid}")
                      rescue Exception => e
                        trace :error, "Error calling del_purge: #{e.class} #{e.message}"
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 2 other locations - About 15 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 364..370
                  lib/rcs-collector/db_rest.rb on lines 422..428

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

                  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

                    def del_upgrade(bid)
                      begin
                        return rest_call('DELETE', "/agent/upgrade/#{bid}")
                      rescue Exception => e
                        trace :error, "Error calling del_upgrade: #{e.class} #{e.message}"
                  Severity: Minor
                  Found in lib/rcs-collector/db_rest.rb and 2 other locations - About 15 mins to fix
                  lib/rcs-collector/db_rest.rb on lines 364..370
                  lib/rcs-collector/db_rest.rb on lines 498..504

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

                  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

                  There are no issues that match your filters.

                  Category
                  Status