tansaku/LocalSupport

View on GitHub

Showing 943 of 943 total issues

Line is too long. [100/90] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

  #attr_accessible :email, :password, :password_confirmation, :remember_me, :pending_organisation_id
Severity: Minor
Found in app/models/user.rb by rubocop

Prefer before_action over before_filter.
Open

  before_filter :store_location,

This cop enforces the consistent use of action filter methods.

The cop is configurable and can enforce the use of the older somethingfilter methods or the newer somethingaction methods.

If the TargetRailsVersion is set to less than 4.0, the cop will enforce the use of filter methods.

Example: EnforcedStyle: action (default)

# bad
after_filter :do_stuff
append_around_filter :do_stuff
skip_after_filter :do_stuff

# good
after_action :do_stuff
append_around_action :do_stuff
skip_after_action :do_stuff

Example: EnforcedStyle: filter

# bad
after_action :do_stuff
append_around_action :do_stuff
skip_after_action :do_stuff

# good
after_filter :do_stuff
append_around_filter :do_stuff
skip_after_filter :do_stuff

Indent when as deep as case. (https://github.com/bbatsov/ruby-style-guide#indent-when-to-case)
Open

      when "Email is invalid"

This cop checks how the whens of a case expression are indented in relation to its case or end keyword.

It will register a separate offense for each misaligned when.

Example:

# If Layout/EndAlignment is set to keyword style (default)
# *case* and *end* should always be aligned to same depth,
# and therefore *when* should always be aligned to both -
# regardless of configuration.

# bad for all styles
case n
  when 0
    x * 2
  else
    y / 3
end

# good for all styles
case n
when 0
  x * 2
else
  y / 3
end

Example: EnforcedStyle: case (default)

# if EndAlignment is set to other style such as
# start_of_line (as shown below), then *when* alignment
# configuration does have an effect.

# bad
a = case n
when 0
  x * 2
else
  y / 3
end

# good
a = case n
    when 0
      x * 2
    else
      y / 3
end

Example: EnforcedStyle: end

# bad
a = case n
    when 0
      x * 2
    else
      y / 3
end

# good
a = case n
when 0
  x * 2
else
  y / 3
end

Line is too long. [134/90] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

    create!(attributes.each { |k, v| attributes[k] =v.nil? ? 'No information recorded' : (v.empty? ? 'No information recorded' : v) })
Severity: Minor
Found in app/models/organisation.rb by rubocop

Prefer single-quoted strings when you don't need string interpolation or special symbols. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)
Open

      when "Email is invalid"

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"

Line is too long. [101/90] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

    mail(subject: "You have been made an organisation administrator on the Harrow Community Network",
Severity: Minor
Found in app/mailers/org_admin_mailer.rb by rubocop

Line is too long. [104/90] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

    usr = User.find params[:proposed_organisation][:user_id] if params[:proposed_organisation][:user_id]

Indent when as deep as case. (https://github.com/bbatsov/ruby-style-guide#indent-when-to-case)
Open

      when 404
Severity: Minor
Found in lib/custom_errors.rb by rubocop

This cop checks how the whens of a case expression are indented in relation to its case or end keyword.

It will register a separate offense for each misaligned when.

Example:

# If Layout/EndAlignment is set to keyword style (default)
# *case* and *end* should always be aligned to same depth,
# and therefore *when* should always be aligned to both -
# regardless of configuration.

# bad for all styles
case n
  when 0
    x * 2
  else
    y / 3
end

# good for all styles
case n
when 0
  x * 2
else
  y / 3
end

Example: EnforcedStyle: case (default)

# if EndAlignment is set to other style such as
# start_of_line (as shown below), then *when* alignment
# configuration does have an effect.

# bad
a = case n
when 0
  x * 2
else
  y / 3
end

# good
a = case n
    when 0
      x * 2
    else
      y / 3
end

Example: EnforcedStyle: end

# bad
a = case n
    when 0
      x * 2
    else
      y / 3
end

# good
a = case n
when 0
  x * 2
else
  y / 3
end

Prefer before_action over before_filter.
Open

  before_filter :authorize

This cop enforces the consistent use of action filter methods.

The cop is configurable and can enforce the use of the older somethingfilter methods or the newer somethingaction methods.

If the TargetRailsVersion is set to less than 4.0, the cop will enforce the use of filter methods.

Example: EnforcedStyle: action (default)

# bad
after_filter :do_stuff
append_around_filter :do_stuff
skip_after_filter :do_stuff

# good
after_action :do_stuff
append_around_action :do_stuff
skip_after_action :do_stuff

Example: EnforcedStyle: filter

# bad
after_action :do_stuff
append_around_action :do_stuff
skip_after_action :do_stuff

# good
after_filter :do_stuff
append_around_filter :do_stuff
skip_after_filter :do_stuff

Use && instead of and. (https://github.com/bbatsov/ruby-style-guide#no-and-or-or)
Open

      redirect_to organisations_path and return false

This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

Example: EnforcedStyle: always (default)

# bad
foo.save and return

# bad
if foo and bar
end

# good
foo.save && return

# good
if foo && bar
end

Example: EnforcedStyle: conditionals

# bad
if foo and bar
end

# good
foo.save && return

# good
foo.save and return

# good
if foo && bar
end

Unused block argument - t. If it's necessary, use _ or _t as an argument name to indicate that it won't be used. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
Open

      task :emails, [:file] => :environment do |t, args|
Severity: Minor
Found in lib/tasks/emails.rake by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end

Line is too long. [105/90] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

      msg = render_to_string(partial: "shared/call_to_action", locals: {org: usr.organisation}).html_safe

Use && instead of and. (https://github.com/bbatsov/ruby-style-guide#no-and-or-or)
Open

    if usr.organisation and not usr.organisation.has_been_updated_recently?

This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

Example: EnforcedStyle: always (default)

# bad
foo.save and return

# bad
if foo and bar
end

# good
foo.save && return

# good
if foo && bar
end

Example: EnforcedStyle: conditionals

# bad
if foo and bar
end

# good
foo.save && return

# good
foo.save and return

# good
if foo && bar
end

Line is too long. [106/90] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

    # their token. Failure to do so will yield “Invalid invitation token” errors when the user attempts to

Use == if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition. (https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition)
Open

    while href = process_doit_json_page(http.get("#{HOST}#{href}"));

This cop checks for assignments in the conditions of if/while/until.

Example:

# bad

if some_var = true
  do_something
end

Example:

# good

if some_var == true
  do_something
end

Prefer single-quoted strings when you don't need string interpolation or special symbols. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)
Open

          reply_to: "support@harrowcn.org.uk"
Severity: Minor
Found in app/mailers/custom_devise_mailer.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"

Line is too long. [91/90] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

        query_result = Organisation.where("UPPER(email) LIKE ? ", "%#{user.email.upcase}%")
Severity: Minor
Found in lib/tasks/fix_invites.rake by rubocop

Use the new Ruby 1.9 hash syntax. (https://github.com/bbatsov/ruby-style-guide#hash-literals)
Open

  belongs_to :base_organisation, :foreign_key => :organisation_id
Severity: Minor
Found in app/models/category_organisation.rb by rubocop

This cop checks hash literal syntax.

It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).

A separate offense is registered for each problematic pair.

The supported styles are:

  • ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have all symbols for keys
  • hash_rockets - forces use of hash rockets for all hashes
  • nomixedkeys - simply checks for hashes with mixed syntaxes
  • ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes

Example: EnforcedStyle: ruby19 (default)

# bad
{:a => 2}
{b: 1, :c => 2}

# good
{a: 2, b: 1}
{:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
{d: 1, 'e' => 2} # technically not forbidden

Example: EnforcedStyle: hash_rockets

# bad
{a: 1, b: 2}
{c: 1, 'd' => 5}

# good
{:a => 1, :b => 2}

Example: EnforcedStyle: nomixedkeys

# bad
{:a => 1, b: 2}
{c: 1, 'd' => 2}

# good
{:a => 1, :b => 2}
{c: 1, d: 2}

Example: EnforcedStyle: ruby19nomixed_keys

# bad
{:a => 1, :b => 2}
{c: 2, 'd' => 3} # should just use hash rockets

# good
{a: 1, b: 2}
{:c => 3, 'd' => 4}

Replace class var @@column_mappings with a class instance var. (https://github.com/bbatsov/ruby-style-guide#no-class-vars)
Open

  @@column_mappings = {
Severity: Minor
Found in app/models/category.rb by rubocop

This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

Replace class var @@column_mappings with a class instance var. (https://github.com/bbatsov/ruby-style-guide#no-class-vars)
Open

  @@column_mappings = {
Severity: Minor
Found in app/models/organisation.rb by rubocop

This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

Severity
Category
Status
Source
Language