hackedteam/rcs-collector

View on GitHub

Showing 209 of 209 total issues

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

  def self.clear_upgrade(bid)
    return unless File.exist?(CACHE_FILE)

    begin
      db = SQLite.open CACHE_FILE
Severity: Major
Found in lib/rcs-collector/db_cache.rb and 4 other locations - About 30 mins to fix
lib/rcs-collector/db_cache.rb on lines 330..339
lib/rcs-collector/db_cache.rb on lines 557..566
lib/rcs-collector/db_cache.rb on lines 622..631
lib/rcs-collector/db_cache.rb on lines 687..696

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

  def self.del_downloads(bid)
    return unless File.exist?(CACHE_FILE)

    begin
      db = SQLite.open CACHE_FILE
Severity: Major
Found in lib/rcs-collector/db_cache.rb and 4 other locations - About 30 mins to fix
lib/rcs-collector/db_cache.rb on lines 330..339
lib/rcs-collector/db_cache.rb on lines 492..501
lib/rcs-collector/db_cache.rb on lines 622..631
lib/rcs-collector/db_cache.rb on lines 687..696

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

  def self.del_filesystems(bid)
    return unless File.exist?(CACHE_FILE)

    begin
      db = SQLite.open CACHE_FILE
Severity: Major
Found in lib/rcs-collector/db_cache.rb and 4 other locations - About 30 mins to fix
lib/rcs-collector/db_cache.rb on lines 330..339
lib/rcs-collector/db_cache.rb on lines 492..501
lib/rcs-collector/db_cache.rb on lines 557..566
lib/rcs-collector/db_cache.rb on lines 687..696

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

  def self.del_exec(bid)
    return unless File.exist?(CACHE_FILE)

    begin
      db = SQLite.open CACHE_FILE
Severity: Major
Found in lib/rcs-collector/db_cache.rb and 4 other locations - About 30 mins to fix
lib/rcs-collector/db_cache.rb on lines 330..339
lib/rcs-collector/db_cache.rb on lines 492..501
lib/rcs-collector/db_cache.rb on lines 557..566
lib/rcs-collector/db_cache.rb on lines 622..631

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

  def self.del_conf(bid)
    return unless File.exist?(CACHE_FILE)

    begin
      db = SQLite.open CACHE_FILE
Severity: Major
Found in lib/rcs-collector/db_cache.rb and 4 other locations - About 30 mins to fix
lib/rcs-collector/db_cache.rb on lines 492..501
lib/rcs-collector/db_cache.rb on lines 557..566
lib/rcs-collector/db_cache.rb on lines 622..631
lib/rcs-collector/db_cache.rb on lines 687..696

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

Avoid too many return statements within this method.
Open

    return not_found if os == 'cydia' and not File.file?(file_path)
Severity: Major
Found in lib/rcs-collector/http_controller.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        return message, 'application/octet-stream', cookie
    Severity: Major
    Found in lib/rcs-collector/sync_protocol.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return
      Severity: Major
      Found in lib/rcs-collector/sync_protocol.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return 'android', "." + version + '.apk'
        Severity: Major
        Found in lib/rcs-collector/http_controller.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

              return true
          Severity: Major
          Found in lib/rcs-collector/config.rb - About 30 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 'cydia', '.deb' if user_agent['Telesphoreo']
              Severity: Major
              Found in lib/rcs-collector/http_controller.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                    return 'symbian', '.sisx' if user_agent['Symbian']
                Severity: Major
                Found in lib/rcs-collector/http_controller.rb - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language