varvet/godmin

View on GitHub

Showing 116 of 116 total issues

unterminated string meets end of file (Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
Open

  attrs_for_form <%= @attributes.map { |x| ":#{x}" }.join(", ") %>

Line is too long. [140/120]
Open

    inject_into_file File.join("app/controllers", namespaced_path, "application_controller.rb"), after: "Godmin::ApplicationController\n" do

Use nested module/class definitions instead of compact style.
Open

class Godmin::PolicyGenerator < Godmin::Generators::NamedBase

This cop checks the style of children definitions at classes and modules. Basically there are two different styles:

Example: EnforcedStyle: nested (default)

# good
# have each child on its own line
class Foo
  class Bar
  end
end

Example: EnforcedStyle: compact

# good
# combine definitions as much as possible
class Foo::Bar
end

The compact style is only forced for classes/modules with one child.

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

        if @resource_class
Severity: Minor
Found in lib/godmin/helpers/translations.rb by rubocop

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

          if authorization_enabled?

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

              if apply_filter?(name, value)

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?

Space missing to the left of {.
Open

  gem.executables   = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Severity: Minor
Found in godmin.gemspec by rubocop

Checks that block braces have or don't have a space before the opening brace depending on configuration.

Example:

# bad
foo.map{ |a|
  a.bar.to_s
}

# good
foo.map { |a|
  a.bar.to_s
}

Prefer $LOAD_PATH over $:.
Open

$:.push File.expand_path("../lib", __FILE__)
Severity: Minor
Found in godmin.gemspec by rubocop

unexpected token tLT (Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
Open

<% module_namespacing do -%>

unexpected token kDO (Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
Open

<% module_namespacing do -%>

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

        if @object.has_attribute?(attribute)
Severity: Minor
Found in lib/godmin/helpers/forms.rb by rubocop

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?

unexpected token kDO (Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
Open

<% module_namespacing do -%>

Line is too long. [141/120]
Open

          link_to @resource_class.human_attribute_name(attribute.to_s), url_for(params.to_unsafe_h.merge(order: "#{attribute}_#{direction}"))
Severity: Minor
Found in lib/godmin/helpers/tables.rb by rubocop

Rename has_many to many?.
Open

          def has_many(attr, options = {})

This cop makes sure that predicates are named properly.

Example:

# bad
def is_even?(value)
end

# good
def even?(value)
end

# bad
def has_value?
end

# good
def value?
end

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

          if column_value.is_a?(Date) || column_value.is_a?(Time)
Severity: Minor
Found in lib/godmin/helpers/tables.rb by rubocop

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?

Prefer $INPUT_RECORD_SEPARATOR or $RS from the stdlib 'English' module (don't forget to require it) over $/.
Open

  gem.files         = `git ls-files`.split($/)
Severity: Minor
Found in godmin.gemspec by rubocop

Use %i or %I for an array of symbols.
Open

        before_action :set_resource, only: [:show, :new, :edit, :create, :update, :destroy]

This cop can check for array literals made up of symbols that are not using the %i() syntax.

Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

Example: EnforcedStyle: percent (default)

# good
%i[foo bar baz]

# bad
[:foo, :bar, :baz]

Example: EnforcedStyle: brackets

# good
[:foo, :bar, :baz]

# bad
%i[foo bar baz]

Indent the first parameter one step more than apply_scope(.
Open

                params[:scope], resources_relation

This cop checks the indentation of the first parameter in a method call. Parameters after the first one are checked by Style/AlignParameters, not by this cop.

Example:

# bad
some_method(
first_param,
second_param)

# good
some_method(
  first_param,
second_param)

Use meaningful heredoc delimiters.
Open

      END

This cop checks that your heredocs are using meaningful delimiters. By default it disallows END and EO*, and can be configured through blacklisting additional delimiters.

Example:

# good
<<-SQL
  SELECT * FROM foo
SQL

# bad
<<-END
  SELECT * FROM foo
END

# bad
<<-EOS
  SELECT * FROM foo
EOS

unexpected token tIVAR (Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
Open

  attrs_for_show <%= @attributes.map { |x| ":#{x}" }.join(", ") %>
Severity
Category
Status
Source
Language