rubysec/bundler-audit

View on GitHub

Showing 13 of 13 total issues

Method update has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

      def update(path=Database.path)
        unless Database.exists?(path)
          download(path)
          return
        end
Severity: Minor
Found in lib/bundler/audit/cli.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

Method scan_sources has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

      def scan_sources(options={})
        return enum_for(__method__,options) unless block_given?

        @lockfile.sources.map do |source|
          case source
Severity: Minor
Found in lib/bundler/audit/scanner.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

Method load has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def self.load(file_path)
        raise(FileNotFound,"Configuration file '#{file_path}' does not exist") unless File.exist?(file_path)

        doc = YAML.parse(File.new(file_path))

Severity: Minor
Found in lib/bundler/audit/configuration.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

Method print_advisory has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def print_advisory(gem, advisory)
            say "Name: ", :red
            say gem.name

            say "Version: ", :red
Severity: Minor
Found in lib/bundler/audit/cli/formats/text.rb - About 1 hr to fix

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

          def self.load(path)
            id   = File.basename(path).chomp('.yml')
            data = File.open(path) do |yaml|
                     if Psych::VERSION >= '3.1.0'
                       YAML.safe_load(yaml, permitted_classes: [Date])
    Severity: Minor
    Found in lib/bundler/audit/advisory.rb - About 1 hr to fix

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

            def check(dir=Dir.pwd)
              unless File.directory?(dir)
                say_error "No such file or directory: #{dir}", :red
                exit 1
              end
      Severity: Minor
      Found in lib/bundler/audit/cli.rb - About 1 hr to fix

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

              def check(dir=Dir.pwd)
                unless File.directory?(dir)
                  say_error "No such file or directory: #{dir}", :red
                  exit 1
                end
        Severity: Minor
        Found in lib/bundler/audit/cli.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

        Method scan_specs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def scan_specs(options={})
                return enum_for(__method__,options) unless block_given?
        
                ignore = if options[:ignore]
                           Set.new(options[:ignore])
        Severity: Minor
        Found in lib/bundler/audit/scanner.rb - About 45 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 update! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.update!(options={})
                raise "Invalid option(s)" unless (options.keys - [:quiet]).empty?
        
                if File.directory?(DEFAULT_PATH)
                  begin
        Severity: Minor
        Found in lib/bundler/audit/database.rb - About 45 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 update! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def update!(options={})
                if git?
                  Dir.chdir(@path) do
                    command = %w[git pull]
                    command << '--quiet' if options[:quiet]
        Severity: Minor
        Found in lib/bundler/audit/database.rb - About 45 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 print_advisory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                  def print_advisory(gem, advisory)
                    say "Name: ", :red
                    say gem.name
        
                    say "Version: ", :red
        Severity: Minor
        Found in lib/bundler/audit/cli/formats/text.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 criticality has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def criticality
                if cvss_v3
                  case cvss_v3
                  when 0.0       then :none
                  when 0.1..3.9  then :low
        Severity: Minor
        Found in lib/bundler/audit/advisory.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

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

              def download(path=Database.path)
                if Database.exists?(path)
                  say "Database already exists", :yellow
                  return
                end
        Severity: Minor
        Found in lib/bundler/audit/cli.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

        Severity
        Category
        Status
        Source
        Language