myGrid/ruby-zip-container

View on GitHub

Showing 4 of 4 total issues

Class File has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

  class File < Container

    extend Forwardable
    def_delegators :@container, :comment, :comment=, :commit_required?, :each,
      :entries, :extract, :get_input_stream, :name, :read, :size
Severity: Minor
Found in lib/zip-container/file.rb - About 2 hrs to fix

    Method glob has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def glob(pattern, *params, &block)
          flags = ::File::FNM_PATHNAME | ::File::FNM_DOTMATCH
          options = { :include_hidden => false }
    
          params.each do |param|
    Severity: Minor
    Found in lib/zip-container/file.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 verify_mimetype has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def verify_mimetype
          mime_path = full_path(MIMETYPE_FILE)
          if ::File.exist?(mime_path)
            return "'mimetype' is not a regular file" unless ::File.file?(mime_path)
            return "'mimetype' is not readable." unless ::File.readable?(mime_path)
    Severity: Minor
    Found in lib/zip-container/dir.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 entry_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def entry_name(entry)
          name = entry.kind_of?(::Zip::Entry) ? entry.name : entry
    
          if name.respond_to?(:end_with?) && name.respond_to?(:chop!)
            name.chop! if name.end_with?("/")
    Severity: Minor
    Found in lib/zip-container/util.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