app/controllers/proposed_organisations_controller.rb
Method has too many lines. [18/7] (https://github.com/bbatsov/ruby-style-guide#short-methods) Open
Open
def self.build params
params.require(:proposed_organisation).permit(
:superadmin_email_to_add,
:description,
:address,
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [9/7] (https://github.com/bbatsov/ruby-style-guide#short-methods) Open
Open
def create
make_user_into_org_admin_of_new_proposed_org
@proposed_organisation.check_geocode
if @proposed_organisation.save
session[:proposed_organisation_id] = @proposed_organisation.id
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Line is too long. [91/90] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
Open
redirect_to @proposed_organisation, notice: 'Organisation is pending admin approval.'
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression. (https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals) Open
Open
unless session[:proposed_organisation_id] || current_user.try(:superadmin)
- Read upRead up
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression
Example:
# bad
def test
if something
work
end
end
# good
def test
return unless something
work
end
# also good
def test
work if something
end
# bad
if something
raise 'exception'
else
ok
end
# good
raise 'exception' if something
ok
Line is too long. [104/90] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
Open
usr = User.find params[:proposed_organisation][:user_id] if params[:proposed_organisation][:user_id]
- Exclude checks
Line is too long. [102/90] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
Open
@proposer_email = @proposed_organisation.users.first.email if !@proposed_organisation.users.empty?
- Exclude checks
Favor unless
over if
for negative conditions. (https://github.com/bbatsov/ruby-style-guide#unless-for-negatives) Open
Open
@proposer_email = @proposed_organisation.users.first.email if !@proposed_organisation.users.empty?
- Read upRead up
- Exclude checks
Checks for uses of if with a negated condition. Only ifs without else are considered. There are three different styles:
- both
- prefix
- postfix
Example: EnforcedStyle: both (default)
# enforces `unless` for `prefix` and `postfix` conditionals
# bad
if !foo
bar
end
# good
unless foo
bar
end
# bad
bar if !foo
# good
bar unless foo
Example: EnforcedStyle: prefix
# enforces `unless` for just `prefix` conditionals
# bad
if !foo
bar
end
# good
unless foo
bar
end
# good
bar if !foo
Example: EnforcedStyle: postfix
# enforces `unless` for just `postfix` conditionals
# bad
bar if !foo
# good
bar unless foo
# good
if !foo
bar
end
Use a guard clause instead of wrapping the code inside a conditional expression. (https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals) Open
Open
unless current_user.try(:superadmin?)
- Read upRead up
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression
Example:
# bad
def test
if something
work
end
end
# good
def test
return unless something
work
end
# also good
def test
work if something
end
# bad
if something
raise 'exception'
else
ok
end
# good
raise 'exception' if something
ok