rokumatsumoto/boyutluseyler

View on GitHub

Showing 439 of 439 total issues

Please use Rails.root.join('path', 'to') instead.
Open

      format.html { render file: Rails.root.join('public/403'), layout: false, status: 403 }

This cop is used to identify usages of file path joining process to use Rails.root.join clause. It is used to add uniformity when joining paths.

Example: EnforcedStyle: arguments (default)

# bad
Rails.root.join('app/models/goober')
File.join(Rails.root, 'app/models/goober')
"#{Rails.root}/app/models/goober"

# good
Rails.root.join('app', 'models', 'goober')

Example: EnforcedStyle: slashes

# bad
Rails.root.join('app', 'models', 'goober')
File.join(Rails.root, 'app/models/goober')
"#{Rails.root}/app/models/goober"

# good
Rails.root.join('app/models/goober')

Line is too long. [155/100]
Open

            thumb_url: "#{blueprint_image_source}/id/#{blueprint_id}/#{blueprint_image_thumb_size}/#{blueprint_image_thumb_size}.#{blueprint_image_format}"
Severity: Minor
Found in lib/tasks/dev.rake by rubocop

Line is too long. [120/100]
Open

gem 'omniauth-rails_csrf_protection', '~> 0.1.2' # remove once https://github.com/omniauth/omniauth/pull/809 is resolved
Severity: Minor
Found in Gemfile by rubocop

Do not use instance variables in helpers.
Open

    @devise_mapping ||= Devise.mappings[:user]
Severity: Minor
Found in app/helpers/devise_helper.rb by rubocop

Line is too long. [121/100]
Open

  # In designs_controller.rb we track events named 'Viewed design' 'Downloaded design', 'Liked design' and 'Saved design'

Shadowing outer local variable - identity.
Open

          identity = bs_user.identities.find { |identity| identity.provider == auth_hash.provider }

This cop looks for use of the same name as outer local variables for block arguments or block local variables. This is a mimic of the warning "shadowing outer local variable - foo" from ruby -cw.

Example:

# bad

def some_method
  foo = 1

  2.times do |foo| # shadowing outer `foo`
    do_something(foo)
  end
end

Example:

# good

def some_method
  foo = 1

  2.times do |bar|
    do_something(bar)
  end
end

Line is too long. [104/100]
Open

            "#{Faker::Construction.heavy_equipment} üzerinde #{Faker::Science.element} ile basılmıştır."
Severity: Minor
Found in lib/tasks/dev.rake by rubocop

Use (i % 5).zero? instead of i % 5 == 0.
Open

          model_file_format: i % 5 == 0 ? 'STL ve ZIP' : blueprint_extensions.sample,
Severity: Minor
Found in lib/tasks/dev.rake by rubocop

This cop checks for usage of comparison operators (==, >, <) to test numbers as zero, positive, or negative. These can be replaced by their respective predicate methods. The cop can also be configured to do the reverse.

The cop disregards #nonzero? as it its value is truthy or falsey, but not true and false, and thus not always interchangeable with != 0.

The cop ignores comparisons to global variables, since they are often populated with objects which can be compared with integers, but are not themselves Integer polymorphic.

Example: EnforcedStyle: predicate (default)

# bad

foo == 0
0 > foo
bar.baz > 0

# good

foo.zero?
foo.negative?
bar.baz.positive?

Example: EnforcedStyle: comparison

# bad

foo.zero?
foo.negative?
bar.baz.positive?

# good

foo == 0
0 > foo
bar.baz > 0

Assignment Branch Condition size for active_nav_link? is too high. [<6, 14, 10> 18.22/15]
Open

  def active_nav_link?(options)
    if path = options.delete(:path)
      path = [path] unless path.respond_to?(:each)

      path.any? do |single_path|
Severity: Minor
Found in app/helpers/tab_helper.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric and https://en.wikipedia.org/wiki/ABC_Software_Metric.

Line is too long. [114/100]
Open

  #           :controller   - One or more controller names to check, use path notation when namespaced (optional).
Severity: Minor
Found in app/helpers/tab_helper.rb by rubocop

Method parameter must be at least 3 characters long.
Open

  def user_not_authorized(e)

This cop checks method parameter names for how descriptive they are. It is highly configurable.

The MinNameLength config option takes an integer. It represents the minimum amount of characters the name must be. Its default is 3. The AllowNamesEndingInNumbers config option takes a boolean. When set to false, this cop will register offenses for names ending with numbers. Its default is false. The AllowedNames config option takes an array of whitelisted names that will never register an offense. The ForbiddenNames config option takes an array of blacklisted names that will always register an offense.

Example:

# bad
def bar(varOne, varTwo)
  varOne + varTwo
end

# With `AllowNamesEndingInNumbers` set to false
def foo(num1, num2)
  num1 * num2
end

# With `MinArgNameLength` set to number greater than 1
def baz(a, b, c)
  do_stuff(a, b, c)
end

# good
def bar(thud, fred)
  thud + fred
end

def foo(speed, distance)
  speed * distance
end

def baz(age_a, height_b, gender_c)
  do_stuff(age_a, height_b, gender_c)
end

Useless assignment to variable - e.
Open

        rescue ActiveRecord::RecordInvalid => e

This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

assigned but unused variable - foo

Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

Example:

# bad

def some_method
  some_var = 1
  do_something
end

Example:

# good

def some_method
  some_var = 1
  do_something(some_var)
end

Use module_function instead of extend self.
Open

    extend self
Severity: Minor
Found in lib/boyutluseyler/utils.rb by rubocop

This cop checks for use of extend self or module_function in a module.

Supported styles are: modulefunction, extendself.

Example: EnforcedStyle: module_function (default)

# bad
module Test
  extend self
  # ...
end

# good
module Test
  module_function
  # ...
end

In case there are private methods, the cop won't be activated. Otherwise, it forces to change the flow of the default code.

Example: EnforcedStyle: module_function (default)

# good
module Test
  extend self
  # ...
  private
  # ...
end

Example: EnforcedStyle: extend_self

# bad
module Test
  module_function
  # ...
end

# good
module Test
  extend self
  # ...
end

These offenses are not safe to auto-correct since there are different implications to each approach.

Useless assignment to variable - design.
Open

        design = Design.create!(
Severity: Minor
Found in lib/tasks/dev.rake by rubocop

This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

assigned but unused variable - foo

Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

Example:

# bad

def some_method
  some_var = 1
  do_something
end

Example:

# good

def some_method
  some_var = 1
  do_something(some_var)
end

Line is too long. [146/100]
Open

            thumb_url: "#{illustration_source}/id/#{illustration_id}/#{illustration_thumb_size}/#{illustration_thumb_size}.#{illustration_format}"
Severity: Minor
Found in lib/tasks/dev.rake by rubocop

Line is too long. [103/100]
Open

            url: "#{Boyutluseyler.config[:direct_upload_endpoint]}/bowser_low_poly_flowalistik223.STL",
Severity: Minor
Found in lib/tasks/dev.rake by rubocop

Line is too long. [135/100]
Open

  gem 'webdrivers', '~> 4.1', '>= 4.1.2', require: false # Easy installation and use of selenium webdriver browsers to run system tests
Severity: Minor
Found in Gemfile by rubocop

Line is too long. [106/100]
Open

        cache_name = "any_events_for-#{event_name.parameterize.underscore}-#{event_id}-#{user.updated_at}"
Severity: Minor
Found in app/models/ahoy/event.rb by rubocop

Assignment Branch Condition size for update is too high. [<3, 20, 4> 20.62/15]
Open

  def update
    password_attributes = user_params.select do |key, _value|
      %w[password password_confirmation].include?(key.to_s)
    end

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric and https://en.wikipedia.org/wiki/ABC_Software_Metric.

include is used at the top level. Use inside class or module.
Open

include Rails::ConsoleMethods
Severity: Minor
Found in .pryrc by rubocop

This cop checks that include, extend and prepend statements appear inside classes and modules, not at the top level, so as to not affect the behavior of Object.

Example:

# bad
include M

class C
end

# bad
extend M

class C
end

# bad
prepend M

class C
end

# good
class C
  include M
end

# good
class C
  extend M
end

# good
class C
  prepend M
end
Severity
Category
Status
Source
Language