awesome-print/awesome_print

View on GitHub

Showing 387 of 387 total issues

Line is too long. [84/80]
Open

        # #<Method: User(id: integer, username: string)(ActiveRecord::Base).current>

Do not use unless with else. Rewrite these with the positive case first.
Open

        data = unless should_be_limited?
                 generate_printable_array
               else
                 limited(generate_printable_array, width(array))
               end

This cop looks for unless expressions with else clauses.

Example:

# bad
unless foo_bar.nil?
  # do something...
else
  # do a different thing...
end

# good
if foo_bar.present?
  # do something...
else
  # do a different thing...
end

Use % instead of %Q.
Open

          "#<#{awesome_instance}\n#{data.join(%Q/,\n/)}\n#{outdent}>"

This cop checks if usage of %() or %Q() matches configuration.

Example: EnforcedStyle: bare_percent (default)

# bad
%Q(He said: "#{greeting}")
%q{She said: 'Hi'}

# good
%(He said: "#{greeting}")
%{She said: 'Hi'}

Example: EnforcedStyle: percent_q

# bad
%|He said: "#{greeting}"|
%/She said: 'Hi'/

# good
%Q|He said: "#{greeting}"|
%q/She said: 'Hi'/

Use %Q only for strings that contain both single quotes and double quotes, or for dynamic strings that contain double quotes.
Open

          "#<#{awesome_instance}\n#{data.join(%Q/,\n/)}\n#{outdent}>"

Surrounding space missing in default value assignment.
Open

      def generic_prefix(iteration, width, padding='')

Checks that the equals signs in parameter default assignments have or don't have surrounding space depending on configuration.

Example:

# bad
def some_method(arg1=:default, arg2=nil, arg3=[])
  # do something...
end

# good
def some_method(arg1 = :default, arg2 = nil, arg3 = [])
  # do something...
end

Line is too long. [105/80]
Open

              key.sub!(/(attr_\w+)\s(\:\w+)/, "#{colorize('\\1', :keyword)} #{colorize('\\2', :method)}")

Extra empty line detected at class body beginning.
Open


      attr_reader :method, :inspector, :options

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
Severity
Category
Status
Source
Language