hackedteam/rcs-db

View on GitHub

Showing 612 of 612 total issues

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

    Zip::File.open(path("#{@appname}.zip"), Zip::File::CREATE) do |z|
      @outputs.each do |o|
        z.file.open("#{o}", "wb") { |f| f.write File.open(path(o), 'rb') {|f| f.read} }
Severity: Minor
Found in lib/rcs-db/build/wap.rb and 1 other location - About 40 mins to fix
lib/rcs-db/build/qrcode.rb on lines 98..100

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

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

    Zip::File.open(path("#{@appname}.zip"), Zip::File::CREATE) do |z|
      @outputs.each do |o|
        z.file.open("#{o}", "wb") { |f| f.write File.open(path(o), 'rb') {|f| f.read} }
Severity: Minor
Found in lib/rcs-db/build/qrcode.rb and 1 other location - About 40 mins to fix
lib/rcs-db/build/wap.rb on lines 87..89

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

    @stats[section][:last].each do |minute|
      minute.each_pair do |k,v|
        if k.to_s['_size']
          print "| #{v.to_i.to_s_bytes.rjust(23)} "
        else
Severity: Minor
Found in lib/rcs-worker/statistics.rb and 1 other location - About 40 mins to fix
lib/rcs-db/statistics.rb on lines 102..110

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

    @stats[section][:last].each do |minute|
      minute.each_pair do |k,v|
        if k.to_s['_size']
          print "| #{v.to_i.to_s_bytes.rjust(15)} "
        else
Severity: Minor
Found in lib/rcs-db/statistics.rb and 1 other location - About 40 mins to fix
lib/rcs-worker/statistics.rb on lines 95..103

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

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

  def auth_server(username, pass, version, type, peer)
Severity: Minor
Found in lib/rcs-db/auth.rb - About 35 mins to fix

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

    def REST_task(http, cookie, type, filename, params={})
    Severity: Minor
    Found in scripts/rest_test.rb - About 35 mins to fix

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

        def inject_html_flash(intercept_files, progressive, redirect_user, rule, vector_files)
      Severity: Minor
      Found in lib/rcs-db/tasks/injector.rb - About 35 mins to fix

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

          def create_filesystem_entry(agent, target, path, type, size)
        Severity: Minor
        Found in lib/rcs-worker/evidence/filecap.rb - About 35 mins to fix

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

              def edge id, source_node, target_node, data = {}, opts = {}
          Severity: Minor
          Found in lib/rcs-db/graphml.rb - About 35 mins to fix

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

              def create_filesystem_entry(agent, target, path, type, size)
            Severity: Minor
            Found in lib/rcs-worker/evidence/fileopen.rb - About 35 mins to fix

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

                  @stats[section][:average].each_pair do |k,v|
                    next if k == :samples
                    if k.to_s['_size']
                      print "| #{v.to_i.to_s_bytes.rjust(23)} "
                    else
              Severity: Minor
              Found in lib/rcs-worker/statistics.rb and 1 other location - About 35 mins to fix
              lib/rcs-db/statistics.rb on lines 127..132

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

              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

                  @stats[section][:average].each_pair do |k,v|
                    next if k == :samples
                    if k.to_s['_size']
                      print "| #{v.to_i.to_s_bytes.rjust(15)} "
                    else
              Severity: Minor
              Found in lib/rcs-db/statistics.rb and 1 other location - About 35 mins to fix
              lib/rcs-worker/statistics.rb on lines 113..118

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

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

                    def create_default_rules(component=nil)
                      return if !WinFirewall.exists?
              
                      trace(:info, "Creating firewall rules...")
              
              
              Severity: Minor
              Found in lib/rcs-db/firewall.rb - About 35 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

              Method run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def run
                      options = {}
                      optparse = OptionParser.new do |opts|
                        opts.banner = "Usage: rcs-money [opts]"
              
              
              Severity: Minor
              Found in lib/rcs-money/cli.rb - About 35 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

              Method add_handle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def add_handle(entity, password_evidence)
                  data = password_evidence[:data]
              
                  trace :debug, "Parsing handle data: #{data.inspect}"
              
              
              Severity: Minor
              Found in lib/rcs-intelligence/passwords.rb - About 35 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

              Method run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def run(options)
              
                  # load the input file
                  if options[:input]
                    load_license_file options[:input]
              Severity: Minor
              Found in scripts/rcs-db-license-gen.rb - About 35 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

              Method group_and_count_positions_within has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                      def group_and_count_positions_within(ranges)
                        dist = week_distribution
                        return [] if dist.keys.size < MIN_DAYS
              
                        grouped = {}
              Severity: Minor
              Found in lib/rcs-intelligence/infer.rb - About 35 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

              Method week_distribution has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                      def week_distribution
                        results = {}
              
                        each_aggregate do |aggregate|
                          aggregate.info.each do |interval|
              Severity: Minor
              Found in lib/rcs-intelligence/infer.rb - About 35 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

              Method run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def run
                      @pool = Pool.new
                      @known_agents = []
              
                      loop_and_wait do
              Severity: Minor
              Found in lib/rcs-connector/dispatcher.rb - About 35 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

              Method status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def status
                      establish_database_connection
              
                      currencies.each do |currency|
                        blocks_folder = BlocksFolder.discover(currency)
              Severity: Minor
              Found in lib/rcs-money/cli.rb - About 35 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

              Severity
              Category
              Status
              Source
              Language