gmanley/loggia

View on GitHub

Showing 6 of 6 total issues

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

  def self.perform(glob)
    Dir[glob].each do |album_folder|
      parent_text = File.join(album_folder, 'parent.txt')

      if File.exists?(parent_text)
Severity: Minor
Found in app/workers/folder_import.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 perform has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def perform
    Image.where(md5: nil).pluck(:id).each do |record_id|
      ImageChecksumer.perform_async(record_id)
    end

Severity: Minor
Found in app/workers/image_consolidator.rb - About 1 hr to fix

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

        def create_albums
          @extraction_location.find do |entry|
            next if entry.to_s == @extraction_location.to_s
            Find.prune if IGNORED_ENTRIES.include?(entry.basename.to_s)
    
    
    Severity: Minor
    Found in lib/import/zip_import.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 perform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def perform(album_slug, user_id)
        album = Album.find_by_slug!(album_slug)
        archive = (album.archive || album.create_archive)
    
        unless archive.requesters.include?(user_id.to_s)
    Severity: Minor
    Found in app/workers/album_archiver.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 import_image has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def import_image(legacy_image)
          image_file_path = legacy_image.file_path(@upload_root)
          if LegacyImage.valid_image?(image_file_path)
            if album = Album.where(legacy_id: legacy_image.album_id).first
              image = album.images.new
    Severity: Minor
    Found in lib/import/ipgallery_import.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 extract has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def extract(destination)
        each do |entry|
          next if entry.directory?
          entry_path = ::File.join(destination, entry.name)
          dirname = ::File.dirname(entry_path)
    Severity: Minor
    Found in lib/zip_archive.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