hammackj/uirusu

View on GitHub

Showing 19 of 19 total issues

Method scan_and_wait has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

            def scan_and_wait(mod, resource, attempts)
                method = nil
                retries = attempts

                if mod.name == "Uirusu::VTFile"
Severity: Minor
Found in lib/uirusu/cli/application.rb - About 1 day 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 main has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

            def main(args)
                parse_options(args)
                load_config

                if @options['output'] == :stdout
Severity: Minor
Found in lib/uirusu/cli/application.rb - About 4 hrs 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 parse_options has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            def parse_options(args)
                begin
                    @options['output']  = :stdout
                    @options['verbose'] = false
                    @options['rescan']  = false
Severity: Major
Found in lib/uirusu/cli/application.rb - About 3 hrs to fix

    Method initialize has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

            def initialize hash, results
                if results == nil or results.empty?
                    return
    
                # Take into consideration being passed an array of results.
    Severity: Minor
    Found in lib/uirusu/vtresult.rb - About 3 hrs 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 parse_options has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

                def parse_options(args)
                    begin
                        @options['output']  = :stdout
                        @options['verbose'] = false
                        @options['rescan']  = false
    Severity: Minor
    Found in lib/uirusu/cli/application.rb - About 2 hrs 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

    File application.rb has 264 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Uirusu
        module CLI
            class Application
    
                attr_accessor :config
    Severity: Minor
    Found in lib/uirusu/cli/application.rb - About 2 hrs to fix

      Method scan_and_wait has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  def scan_and_wait(mod, resource, attempts)
                      method = nil
                      retries = attempts
      
                      if mod.name == "Uirusu::VTFile"
      Severity: Major
      Found in lib/uirusu/cli/application.rb - About 2 hrs to fix

        Method main has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    def main(args)
                        parse_options(args)
                        load_config
        
                        if @options['output'] == :stdout
        Severity: Major
        Found in lib/uirusu/cli/application.rb - About 2 hrs to fix

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

                  def initialize hash, results
                      if results == nil or results.empty?
                          return
          
                      # Take into consideration being passed an array of results.
          Severity: Major
          Found in lib/uirusu/vtresult.rb - About 2 hrs to fix

            Method load_config has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                        def load_config file=CONFIG_FILE
            
                            @config = nil
            
                            f = File.expand_path(file)
            Severity: Minor
            Found in lib/uirusu/cli/application.rb - About 1 hr 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

                            if @sites != nil
                                @sites.each_with_index do |url, index|
                                    results = scan_and_wait(Uirusu::VTUrl, url, 5)
                                    result = Uirusu::VTResult.new(results[0], results[1])
                                    print result.send output_method if result != nil
            Severity: Minor
            Found in lib/uirusu/cli/application.rb and 1 other location - About 55 mins to fix
            lib/uirusu/cli/application.rb on lines 352..357

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

            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

                            if @uploads != nil
                                @uploads.each_with_index do |upload, index|
                                    results = scan_and_wait(Uirusu::VTFile, upload, 5)
                                    result = Uirusu::VTResult.new(results[0], results[1])
                                    print result.send output_method if result != nil
            Severity: Minor
            Found in lib/uirusu/cli/application.rb and 1 other location - About 55 mins to fix
            lib/uirusu/cli/application.rb on lines 343..348

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

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

                    def to_xml
                        result_string = String.new
                        result_string << "<results>\n"
                        @results.each do |result|
                            result_string << "\t<vtresult>\n"
            Severity: Minor
            Found in lib/uirusu/vtresult.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 recurse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                    def Scanner.recurse file_name
                        Dir.new("#{file_name}").each do |file|
                            next if file.match(/^\.+/)
                            path = "#{file_name}/#{file}"
            
            
            Severity: Minor
            Found in lib/uirusu/scanner.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 parse_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.parse_response(response)
                    puts "Parse Response"
                    begin
                        case response.code
                            when 429, 204
            Severity: Minor
            Found in lib/uirusu.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

                                    opt.on('-u FILE', '--upload-file FILE', 'Uploads a file to virustotal.com for analysis') do |file|
                                        if File.exist?(file)
                                            puts "[+] Adding file #{file}" if @options['verbose']
                                            @uploads.push(file)
                                        else
            Severity: Minor
            Found in lib/uirusu/cli/application.rb and 1 other location - About 20 mins to fix
            lib/uirusu/cli/application.rb on lines 64..69

            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

                                    opt.on('-f FILE', '--search-hash-file FILE', 'Searches each hash in a file of hashes on virustotal.com') do |file|
                                        if File.exist?(file)
                                            puts "[+] Adding file #{file}" if @options['verbose']
                                            @files_of_hashes.push(file)
                                        else
            Severity: Minor
            Found in lib/uirusu/cli/application.rb and 1 other location - About 20 mins to fix
            lib/uirusu/cli/application.rb on lines 73..78

            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

                module VTIPAddr
                    REPORT_URL = Uirusu::VT_API + "/ip-address/report"
            
                    # Searches reports by IP from Virustotal.com
                    #
            Severity: Minor
            Found in lib/uirusu/vtipaddr.rb and 1 other location - About 15 mins to fix
            lib/uirusu/vtdomain.rb on lines 24..42

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

            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

                module VTDomain
                    REPORT_URL = Uirusu::VT_API + "/domain/report"
            
                    # Searches reports by Domain from Virustotal.com
                    #
            Severity: Minor
            Found in lib/uirusu/vtdomain.rb and 1 other location - About 15 mins to fix
            lib/uirusu/vtipaddr.rb on lines 24..42

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

            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

            Severity
            Category
            Status
            Source
            Language