jhnvz/retina_rails

View on GitHub

Showing 6 of 6 total issues

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

          def optimize_retina!(name)
            attachment = attachment_definitions[name]

            ## Check for style definitions
            styles = attachment[:styles]
Severity: Minor
Found in lib/retina_rails/strategies/paperclip.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 optimize_retina! has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

          def optimize_retina!(name, options={})
            config = versions[name]
            options[:retina] = false

            processors = if config.respond_to?(:processors)
Severity: Minor
Found in lib/retina_rails/strategies/carrierwave.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 optimize_retina! has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def optimize_retina!(name, options={})
            config = versions[name]
            options[:retina] = false

            processors = if config.respond_to?(:processors)
Severity: Minor
Found in lib/retina_rails/strategies/carrierwave.rb - About 1 hr to fix

    Method optimize_retina! has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def optimize_retina!(name)
                attachment = attachment_definitions[name]
    
                ## Check for style definitions
                styles = attachment[:styles]
    Severity: Minor
    Found in lib/retina_rails/strategies/paperclip.rb - About 1 hr to fix

      Method retina_quality has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def retina_quality(percentage)
              manipulate! do |img|
                if defined?(Magick)
                  img.write(current_path) { self.quality = percentage } unless img.quality == percentage
                elsif defined?(MiniMagick)
      Severity: Minor
      Found in lib/retina_rails/processors/carrierwave.rb - About 55 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 retina_image_tag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def retina_image_tag(model, mounted_to, version, options={})
              default = options.delete(:default)
      
              # Check if we can find the dimensions of the uploaded image.
              # If no image or dimensions available use default.
      Severity: Minor
      Found in lib/retina_rails/helpers.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