lujanfernaud/prevy

View on GitHub
app/services/lqip_generator.rb

Summary

Maintainability
A
0 mins
Test Coverage

LQIPGenerator#token doesn't depend on instance state (maybe move it to another class?)
Open

    def token
Severity: Minor
Found in app/services/lqip_generator.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

LQIPGenerator#prepare_temporary_folder doesn't depend on instance state (maybe move it to another class?)
Open

    def prepare_temporary_folder
Severity: Minor
Found in app/services/lqip_generator.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

Inconsistent indentation detected.
Open

    def original_file_name
      image_url.match(FILENAME_PATTERN)[0]
    end
Severity: Minor
Found in app/services/lqip_generator.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

  TEMPORARY_FOLDER = Rails.root.join("tmp", "carrierwave", "minimagick")
Severity: Minor
Found in app/services/lqip_generator.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Inconsistent indentation detected.
Open

    def new_file_name
      "#{token}-#{original_file_name}"
    end
Severity: Minor
Found in app/services/lqip_generator.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

  TEMPORARY_FOLDER = Rails.root.join("tmp", "carrierwave", "minimagick")
Severity: Minor
Found in app/services/lqip_generator.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

      image.resize "30x17"
Severity: Minor
Found in app/services/lqip_generator.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Inconsistent indentation detected.
Open

    def prepare_temporary_folder
      FileUtils.mkdir_p TEMPORARY_FOLDER
    end
Severity: Minor
Found in app/services/lqip_generator.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Inconsistent indentation detected.
Open

    def new_file_full_path
      @_new_file_full_path ||= "#{TEMPORARY_FOLDER}/#{new_file_name}"
    end
Severity: Minor
Found in app/services/lqip_generator.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Inconsistent indentation detected.
Open

    attr_reader :image_url
Severity: Minor
Found in app/services/lqip_generator.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Inconsistent indentation detected.
Open

    def generate_lqip
      image = MiniMagick::Image.open(image_url)

      image.resize "30x17"

Severity: Minor
Found in app/services/lqip_generator.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Inconsistent indentation detected.
Open

    def token
      SecureRandom.urlsafe_base64
    end
Severity: Minor
Found in app/services/lqip_generator.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

  TEMPORARY_FOLDER = Rails.root.join("tmp", "carrierwave", "minimagick")
Severity: Minor
Found in app/services/lqip_generator.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Extra empty line detected at class body beginning.
Open


  TEMPORARY_FOLDER = Rails.root.join("tmp", "carrierwave", "minimagick")
Severity: Minor
Found in app/services/lqip_generator.rb by rubocop

This cops checks if empty lines around the bodies of classes match the configuration.

Example: EnforcedStyle: empty_lines

# good

class Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

class Foo
  class Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
class Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

class Foo
  def bar
    # ...
  end
end

There are no issues that match your filters.

Category
Status