lujanfernaud/prevy

View on GitHub
app/uploaders/image_uploader.rb

Summary

Maintainability
A
0 mins
Test Coverage

ImageUploader has no descriptive comment
Open

class ImageUploader < CarrierWave::Uploader::Base
Severity: Minor
Found in app/uploaders/image_uploader.rb by reek

Classes and modules are the units of reuse and release. It is therefore considered good practice to annotate every class and module with a brief comment outlining its responsibilities.

Example

Given

class Dummy
  # Do things...
end

Reek would emit the following warning:

test.rb -- 1 warning:
  [1]:Dummy has no descriptive comment (IrresponsibleModule)

Fixing this is simple - just an explaining comment:

# The Dummy class is responsible for ...
class Dummy
  # Do things...
end

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

  def cache_dir
Severity: Minor
Found in app/uploaders/image_uploader.rb by reek

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

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

    def application_name
Severity: Minor
Found in app/uploaders/image_uploader.rb by reek

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

Extra empty line detected at class body beginning.
Open


  include CarrierWave::SampleImage::DefaultFolder
Severity: Minor
Found in app/uploaders/image_uploader.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

Inconsistent indentation detected.
Open

    def original_file_name
      Cloudinary::PreloadedFile.split_format(original_filename).first
    end
Severity: Minor
Found in app/uploaders/image_uploader.rb by rubocop

This cops checks for inconsistent indentation.

Example:

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

Freeze mutable objects assigned to constants.
Open

  MEDIUM_SIZE   = [510, 287]
Severity: Minor
Found in app/uploaders/image_uploader.rb by rubocop

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

Missing top-level class documentation comment.
Open

class ImageUploader < CarrierWave::Uploader::Base
Severity: Minor
Found in app/uploaders/image_uploader.rb by rubocop

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

Extra empty line detected at class body end.
Open


end
Severity: Minor
Found in app/uploaders/image_uploader.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

Freeze mutable objects assigned to constants.
Open

  STANDARD_SIZE = [730, 411]
Severity: Minor
Found in app/uploaders/image_uploader.rb by rubocop

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

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

      cloudinary_transformation quality: "auto"
Severity: Minor
Found in app/uploaders/image_uploader.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 application_name
      Rails.application.class.parent_name.underscore
    end
Severity: Minor
Found in app/uploaders/image_uploader.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

    cloudinary_transformation quality: "auto"
Severity: Minor
Found in app/uploaders/image_uploader.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 model_type
      model.class.to_s.underscore.pluralize
    end
Severity: Minor
Found in app/uploaders/image_uploader.rb by rubocop

This cops checks for inconsistent indentation.

Example:

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

%w-literals should be delimited by [ and ].
Open

    %w(jpg jpeg gif png)
Severity: Minor
Found in app/uploaders/image_uploader.rb by rubocop

This cop enforces the consistent usage of %-literal delimiters.

Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

Example:

# Style/PercentLiteralDelimiters:
#   PreferredDelimiters:
#     default: '[]'
#     '%i':    '()'

# good
%w[alpha beta] + %i(gamma delta)

# bad
%W(alpha #{beta})

# bad
%I(alpha beta)

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

      cloudinary_transformation quality: "auto"
Severity: Minor
Found in app/uploaders/image_uploader.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"

Freeze mutable objects assigned to constants.
Open

  THUMB_SIZE    = [350, 197]
Severity: Minor
Found in app/uploaders/image_uploader.rb by rubocop

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

There are no issues that match your filters.

Category
Status