hackedteam/rcs-collector

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

Summary

Maintainability
F
4 days
Test Coverage

File db_cache.rb has 507 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative 'sqlite'

# from RCS::Common
require 'rcs-common/trace'

Severity: Major
Found in lib/rcs-collector/db_cache.rb - About 1 day to fix

    Class DBCache has 41 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class DBCache
      extend RCS::Tracer
    
      CACHE_FILE = Dir.pwd + '/config/cache.db'
    
    
    Severity: Minor
    Found in lib/rcs-collector/db_cache.rb - About 5 hrs to fix

      Method create! has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.create!
          begin
            db = SQLite.open CACHE_FILE
          rescue Exception => e
            trace :error, "Problems creating the cache file: #{e.message}"
      Severity: Minor
      Found in lib/rcs-collector/db_cache.rb - About 1 hr to fix

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

          def self.new_conf(bid)
            return nil unless File.exist?(CACHE_FILE)
        
            begin
              db = SQLite.open CACHE_FILE
        Severity: Minor
        Found in lib/rcs-collector/db_cache.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 self.new_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 1 other location - About 1 hr to fix
        lib/rcs-collector/db_cache.rb on lines 522..538

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 51.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

          def self.new_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 1 other location - About 1 hr to fix
        lib/rcs-collector/db_cache.rb on lines 652..668

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 51.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

          def self.save_downloads(bid, downloads)
            # ensure the db was already created, otherwise create it
            create! unless File.exist?(CACHE_FILE)
        
            begin
        Severity: Minor
        Found in lib/rcs-collector/db_cache.rb and 1 other location - About 1 hr to fix
        lib/rcs-collector/db_cache.rb on lines 671..684

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

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

          def self.save_exec(bid, commands)
            # ensure the db was already created, otherwise create it
            create! unless File.exist?(CACHE_FILE)
        
            begin
        Severity: Minor
        Found in lib/rcs-collector/db_cache.rb and 1 other location - About 1 hr to fix
        lib/rcs-collector/db_cache.rb on lines 541..554

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

        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 self.new_exec?(bid)
            return false unless File.exist?(CACHE_FILE)
        
            begin
              db = SQLite.open CACHE_FILE
        Severity: Major
        Found in lib/rcs-collector/db_cache.rb and 5 other locations - About 45 mins to fix
        lib/rcs-collector/db_cache.rb on lines 287..299
        lib/rcs-collector/db_cache.rb on lines 346..358
        lib/rcs-collector/db_cache.rb on lines 420..432
        lib/rcs-collector/db_cache.rb on lines 508..520
        lib/rcs-collector/db_cache.rb on lines 573..585

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

        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 self.new_downloads?(bid)
            return false unless File.exist?(CACHE_FILE)
        
            begin
              db = SQLite.open CACHE_FILE
        Severity: Major
        Found in lib/rcs-collector/db_cache.rb and 5 other locations - About 45 mins to fix
        lib/rcs-collector/db_cache.rb on lines 287..299
        lib/rcs-collector/db_cache.rb on lines 346..358
        lib/rcs-collector/db_cache.rb on lines 420..432
        lib/rcs-collector/db_cache.rb on lines 573..585
        lib/rcs-collector/db_cache.rb on lines 638..650

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

        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 self.new_uploads?(bid)
            return false unless File.exist?(CACHE_FILE)
        
            begin
              db = SQLite.open CACHE_FILE
        Severity: Major
        Found in lib/rcs-collector/db_cache.rb and 5 other locations - About 45 mins to fix
        lib/rcs-collector/db_cache.rb on lines 287..299
        lib/rcs-collector/db_cache.rb on lines 420..432
        lib/rcs-collector/db_cache.rb on lines 508..520
        lib/rcs-collector/db_cache.rb on lines 573..585
        lib/rcs-collector/db_cache.rb on lines 638..650

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

        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 self.new_upgrade?(bid)
            return false unless File.exist?(CACHE_FILE)
        
            begin
              db = SQLite.open CACHE_FILE
        Severity: Major
        Found in lib/rcs-collector/db_cache.rb and 5 other locations - About 45 mins to fix
        lib/rcs-collector/db_cache.rb on lines 287..299
        lib/rcs-collector/db_cache.rb on lines 346..358
        lib/rcs-collector/db_cache.rb on lines 508..520
        lib/rcs-collector/db_cache.rb on lines 573..585
        lib/rcs-collector/db_cache.rb on lines 638..650

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

        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 self.new_conf?(bid)
            return false unless File.exist?(CACHE_FILE)
        
            begin
              db = SQLite.open CACHE_FILE
        Severity: Major
        Found in lib/rcs-collector/db_cache.rb and 5 other locations - About 45 mins to fix
        lib/rcs-collector/db_cache.rb on lines 346..358
        lib/rcs-collector/db_cache.rb on lines 420..432
        lib/rcs-collector/db_cache.rb on lines 508..520
        lib/rcs-collector/db_cache.rb on lines 573..585
        lib/rcs-collector/db_cache.rb on lines 638..650

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

        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 self.new_filesystems?(bid)
            return false unless File.exist?(CACHE_FILE)
        
            begin
              db = SQLite.open CACHE_FILE
        Severity: Major
        Found in lib/rcs-collector/db_cache.rb and 5 other locations - About 45 mins to fix
        lib/rcs-collector/db_cache.rb on lines 287..299
        lib/rcs-collector/db_cache.rb on lines 346..358
        lib/rcs-collector/db_cache.rb on lines 420..432
        lib/rcs-collector/db_cache.rb on lines 508..520
        lib/rcs-collector/db_cache.rb on lines 638..650

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

        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.crc_signature
            return nil 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 40 mins to fix
        lib/rcs-collector/db_cache.rb on lines 97..109
        lib/rcs-collector/db_cache.rb on lines 130..142
        lib/rcs-collector/db_cache.rb on lines 163..175
        lib/rcs-collector/db_cache.rb on lines 229..241

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

        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.network_signature
            return nil 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 40 mins to fix
        lib/rcs-collector/db_cache.rb on lines 97..109
        lib/rcs-collector/db_cache.rb on lines 163..175
        lib/rcs-collector/db_cache.rb on lines 196..208
        lib/rcs-collector/db_cache.rb on lines 229..241

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

        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.check_signature
            return nil 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 40 mins to fix
        lib/rcs-collector/db_cache.rb on lines 97..109
        lib/rcs-collector/db_cache.rb on lines 130..142
        lib/rcs-collector/db_cache.rb on lines 196..208
        lib/rcs-collector/db_cache.rb on lines 229..241

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

        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.agent_signature
            return nil 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 40 mins to fix
        lib/rcs-collector/db_cache.rb on lines 130..142
        lib/rcs-collector/db_cache.rb on lines 163..175
        lib/rcs-collector/db_cache.rb on lines 196..208
        lib/rcs-collector/db_cache.rb on lines 229..241

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

        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.sha1_signature
            return nil 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 40 mins to fix
        lib/rcs-collector/db_cache.rb on lines 97..109
        lib/rcs-collector/db_cache.rb on lines 130..142
        lib/rcs-collector/db_cache.rb on lines 163..175
        lib/rcs-collector/db_cache.rb on lines 196..208

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

        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.check_signature=(sig)
            # ensure the db was already created, otherwise create it
            create! unless File.exist?(CACHE_FILE)
        
            begin
        Severity: Major
        Found in lib/rcs-collector/db_cache.rb and 4 other locations - About 35 mins to fix
        lib/rcs-collector/db_cache.rb on lines 83..94
        lib/rcs-collector/db_cache.rb on lines 116..127
        lib/rcs-collector/db_cache.rb on lines 182..193
        lib/rcs-collector/db_cache.rb on lines 215..226

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

          def self.sha1_signature=(sig)
            # ensure the db was already created, otherwise create it
            create! unless File.exist?(CACHE_FILE)
        
            begin
        Severity: Major
        Found in lib/rcs-collector/db_cache.rb and 4 other locations - About 35 mins to fix
        lib/rcs-collector/db_cache.rb on lines 83..94
        lib/rcs-collector/db_cache.rb on lines 116..127
        lib/rcs-collector/db_cache.rb on lines 149..160
        lib/rcs-collector/db_cache.rb on lines 182..193

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 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 5 locations. Consider refactoring.
        Open

          def self.agent_signature=(sig)
            # ensure the db was already created, otherwise create it
            create! unless File.exist?(CACHE_FILE)
        
            begin
        Severity: Major
        Found in lib/rcs-collector/db_cache.rb and 4 other locations - About 35 mins to fix
        lib/rcs-collector/db_cache.rb on lines 116..127
        lib/rcs-collector/db_cache.rb on lines 149..160
        lib/rcs-collector/db_cache.rb on lines 182..193
        lib/rcs-collector/db_cache.rb on lines 215..226

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

          def self.network_signature=(sig)
            # ensure the db was already created, otherwise create it
            create! unless File.exist?(CACHE_FILE)
        
            begin
        Severity: Major
        Found in lib/rcs-collector/db_cache.rb and 4 other locations - About 35 mins to fix
        lib/rcs-collector/db_cache.rb on lines 83..94
        lib/rcs-collector/db_cache.rb on lines 149..160
        lib/rcs-collector/db_cache.rb on lines 182..193
        lib/rcs-collector/db_cache.rb on lines 215..226

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

          def self.crc_signature=(sig)
            # ensure the db was already created, otherwise create it
            create! unless File.exist?(CACHE_FILE)
        
            begin
        Severity: Major
        Found in lib/rcs-collector/db_cache.rb and 4 other locations - About 35 mins to fix
        lib/rcs-collector/db_cache.rb on lines 83..94
        lib/rcs-collector/db_cache.rb on lines 116..127
        lib/rcs-collector/db_cache.rb on lines 149..160
        lib/rcs-collector/db_cache.rb on lines 215..226

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

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

            begin
              db = SQLite.open CACHE_FILE
              db.execute("DELETE FROM uploads WHERE bid = '#{bid}' AND uid = '#{id}';")
              db.close
            rescue Exception => e
        Severity: Minor
        Found in lib/rcs-collector/db_cache.rb and 1 other location - About 20 mins to fix
        lib/rcs-collector/db_cache.rb on lines 483..489

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

        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

            begin
              db = SQLite.open CACHE_FILE
              db.execute("DELETE FROM upgrade WHERE bid = '#{bid}' #{id_sql};")
              db.close
            rescue Exception => e
        Severity: Minor
        Found in lib/rcs-collector/db_cache.rb and 1 other location - About 20 mins to fix
        lib/rcs-collector/db_cache.rb on lines 407..413

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

        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