hackedteam/rcs-db

View on GitHub

Showing 612 of 612 total issues

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

    Method update has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def update
        require_auth_level :admin, :sys, :tech, :view
    
        mongoid_query do
          user = User.find(@params['_id'])
    Severity: Minor
    Found in lib/rcs-db/rest/user.rb - About 1 hr to fix

      Method initialize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def initialize
          # default values.
          # you have at least:
          #   - one user to login to the system
          #   - one collector to receive data
      Severity: Minor
      Found in lib/rcs-db/license.rb - About 1 hr to fix

        Method login has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def login
            case @request[:method]
              # return the info about the current auth session
              when 'GET'
                sess = SessionManager.instance.get(@request[:cookie])
        Severity: Minor
        Found in lib/rcs-db/rest/auth.rb - About 1 hr to fix

          Method add_rule has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def add_rule
              require_auth_level :tech
              require_auth_level :tech_ni_rules
          
              mongoid_query do
          Severity: Minor
          Found in lib/rcs-db/rest/injector.rb - About 1 hr to fix

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

                def process
                  case self[:data][:type]
                    when 'GPS'
                      q = {map: {gpsPosition: {latitude: self[:data][:latitude], longitude: self[:data][:longitude]}}}
                    when 'WIFI'
            Severity: Minor
            Found in lib/rcs-worker/evidence/position.rb - About 1 hr to fix

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

                      when 'GSM'
                        q = {map: {'cellTowers' => [
                            {mobileCountryCode: data['cell']['mcc'], mobileNetworkCode: data['cell']['mnc'], locationAreaCode: data['cell']['lac'], cellId: data['cell']['cid'], signalStrength: data['cell']['db'], timingAdvance: data['cell']['adv'], age: data['cell']['age']}
                        ], radioType: 'gsm'}}
              Severity: Major
              Found in lib/rcs-db/position/resolver.rb and 1 other location - About 1 hr to fix
              lib/rcs-db/position/resolver.rb on lines 216..219

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

              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

                      when 'CDMA'
                        q = {map: {'cellTowers' => [
                            {mobileCountryCode: data['cell']['mcc'], mobileNetworkCode: data['cell']['sid'], locationAreaCode: data['cell']['nid'], cellId: data['cell']['bid'], signalStrength: data['cell']['db'], timingAdvance: data['cell']['adv'], age: data['cell']['age']}
                        ], radioType: 'cdma'}}
              Severity: Major
              Found in lib/rcs-db/position/resolver.rb and 1 other location - About 1 hr to fix
              lib/rcs-db/position/resolver.rb on lines 212..215

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

              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 run! has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.run!(*argv)
              
                  # This hash will hold all of the options parsed from the command-line by OptionParser.
                  options = {}
              
              
              Severity: Minor
              Found in scripts/rcs-db-license-gen.rb - About 1 hr to fix

                Method config has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def config
                    require_auth_level :server, :tech
                    
                    agent = Item.where({_kind: 'agent', _id: @params['_id']}).first
                    return not_found("Agent not found: #{@params['_id']}") if agent.nil?
                Severity: Minor
                Found in lib/rcs-db/rest/agent.rb - About 1 hr to fix

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

                    def add_operation
                      require_auth_level :admin
                      require_auth_level :admin_users
                  
                      mongoid_query do
                  Severity: Major
                  Found in lib/rcs-db/rest/group.rb and 3 other locations - About 1 hr to fix
                  lib/rcs-db/rest/group.rb on lines 75..87
                  lib/rcs-db/rest/group.rb on lines 91..103
                  lib/rcs-db/rest/group.rb on lines 123..135

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

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

                    def del_user
                      require_auth_level :admin
                      require_auth_level :admin_users
                  
                      mongoid_query do
                  Severity: Major
                  Found in lib/rcs-db/rest/group.rb and 3 other locations - About 1 hr to fix
                  lib/rcs-db/rest/group.rb on lines 75..87
                  lib/rcs-db/rest/group.rb on lines 107..119
                  lib/rcs-db/rest/group.rb on lines 123..135

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

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

                    def del_operation
                      require_auth_level :admin
                      require_auth_level :admin_users
                  
                      mongoid_query do
                  Severity: Major
                  Found in lib/rcs-db/rest/group.rb and 3 other locations - About 1 hr to fix
                  lib/rcs-db/rest/group.rb on lines 75..87
                  lib/rcs-db/rest/group.rb on lines 91..103
                  lib/rcs-db/rest/group.rb on lines 107..119

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

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

                    def add_user
                      require_auth_level :admin
                      require_auth_level :admin_users
                  
                      mongoid_query do
                  Severity: Major
                  Found in lib/rcs-db/rest/group.rb and 3 other locations - About 1 hr to fix
                  lib/rcs-db/rest/group.rb on lines 91..103
                  lib/rcs-db/rest/group.rb on lines 107..119
                  lib/rcs-db/rest/group.rb on lines 123..135

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

                  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 new_link has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def new_link(entities)
                        ::Alert.where(:enabled => true, :action => 'LINK').each do |alert|
                          # skip non matching entities
                          next unless match_path(alert, entities.first)
                          next unless match_path(alert, entities.last)
                  Severity: Minor
                  Found in lib/rcs-db/alert.rb - About 1 hr to fix

                    Method melted has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def melted(host, guest)
                        FileUtils.mkdir_p path('DEBIAN')
                    
                        # extract the original
                        CrossPlatform.exec path('bin/ar'), "x #{host} control.tar.gz", {:chdir => path('')}
                    Severity: Minor
                    Found in lib/rcs-db/build/linux.rb - About 1 hr to fix

                      Method clone_instance has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def clone_instance
                          return nil if self[:_kind] != 'factory'
                      
                          agent = Item.new
                          agent._kind = 'agent'
                      Severity: Minor
                      Found in lib/rcs-db/db_objects/item.rb - About 1 hr to fix

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

                          def run
                            process = Proc.new do
                              # temporary file is our task id
                              begin
                                @total = total
                        Severity: Minor
                        Found in lib/rcs-db/tasks.rb - About 1 hr to fix

                          Method melt has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def melt(params)
                              trace :debug, "Build: melting: #{params}"
                          
                              executable = path('default')
                              @appname = params['appname'] || 'agent'
                          Severity: Minor
                          Found in lib/rcs-db/build/linux.rb - About 1 hr to fix

                            Method restore_backup has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def self.restore_backup(params)
                                trace :info, "Restoring backup: #{params['_id']}"
                            
                                backup_path = File.join File.expand_path(Config.instance.global['BACKUP_DIR']), params['_id']
                            
                            
                            Severity: Minor
                            Found in lib/rcs-db/backup.rb - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language