dpn-admin/dpn-bagit

View on GitHub

Showing 7 of 27 total issues

Method valid? has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    def valid?()
      if @cachedValidity == nil
        if @bag.valid? == false
          @validationErrors.push(@bag.errors.full_messages)
        end
Severity: Minor
Found in lib/dpn/bagit/bag.rb - About 5 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 from_existing has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def from_existing(file_location)
      @dpnInfoKeysArrays.each do |key|
        @dpnInfo[key.to_sym] = []
      end

Severity: Minor
Found in lib/dpn/bagit/bag/dpn_info_txt.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 valid? has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def valid?()
      if @cachedValidity == nil
        if @bag.valid? == false
          @validationErrors.push(@bag.errors.full_messages)
        end
Severity: Major
Found in lib/dpn/bagit/bag.rb - About 2 hrs to fix

Method from_existing has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def from_existing(file_location)
      @dpnInfoKeysArrays.each do |key|
        @dpnInfo[key.to_sym] = []
      end

Severity: Minor
Found in lib/dpn/bagit/bag/dpn_info_txt.rb - About 1 hr to fix

Method consistent? has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def consistent?
            (manifest_files|tagmanifest_files).each do |mf|
                # get the algorithm implementation
                readAlgo = /manifest-(.+).txt$/.match(File.basename(mf))[1]
                algo = case readAlgo
Severity: Minor
Found in lib/dpn/bagit/ext/bagit/valid.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 consistent? has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def consistent?
            (manifest_files|tagmanifest_files).each do |mf|
                # get the algorithm implementation
                readAlgo = /manifest-(.+).txt$/.match(File.basename(mf))[1]
                algo = case readAlgo
Severity: Minor
Found in lib/dpn/bagit/ext/bagit/valid.rb - About 1 hr to fix

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

    def fixity(algorithm)
      if @cachedFixity == nil
        case algorithm
          when :sha256
            digest = Digest::SHA256
Severity: Minor
Found in lib/dpn/bagit/bag.rb - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language