diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 653a973..2e19663 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -93,17 +93,6 @@ Style/FileName: Style/GuardClause: Enabled: false -# Offense count: 6 -# Cop supports --auto-correct. -# Configuration parameters: MaxLineLength. -Style/IfUnlessModifier: - Exclude: - - 'app/controllers/api/v1/stats_controller.rb' - - 'app/controllers/application_controller.rb' - - 'app/controllers/problems_controller.rb' - - 'app/models/notice.rb' - - 'app/models/user.rb' - # Offense count: 873 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. diff --git a/app/controllers/api/v1/stats_controller.rb b/app/controllers/api/v1/stats_controller.rb index ed8f977..d34f020 100644 --- a/app/controllers/api/v1/stats_controller.rb +++ b/app/controllers/api/v1/stats_controller.rb @@ -25,9 +25,7 @@ class Api::V1::StatsController < ApplicationController protected def require_api_key_or_authenticate_user! if params[:api_key].present? - if (@app = App.where(api_key: params[:api_key]).first) - return true - end + return true if (@app = App.where(api_key: params[:api_key]).first) end authenticate_user! diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 00c03ac..0f5af89 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -41,8 +41,6 @@ protected user_token = params[User.token_authentication_key].presence user = user_token && User.find_by(authentication_token: user_token) - if user - sign_in user, store: false - end + sign_in user, store: false if user end end diff --git a/app/controllers/problems_controller.rb b/app/controllers/problems_controller.rb index 75cf81b..029eb20 100644 --- a/app/controllers/problems_controller.rb +++ b/app/controllers/problems_controller.rb @@ -58,9 +58,7 @@ class ProblemsController < ApplicationController issue = Issue.new(problem: problem, user: current_user) issue.body = render_to_string(*issue.render_body_args) - unless issue.save - flash[:error] = issue.errors.full_messages.join(', ') - end + flash[:error] = issue.errors.full_messages.join(', ') unless issue.save redirect_to app_problem_path(app, problem) end diff --git a/app/models/notice.rb b/app/models/notice.rb index 30b14d2..8c3e42e 100644 --- a/app/models/notice.rb +++ b/app/models/notice.rb @@ -107,15 +107,11 @@ class Notice # TODO: Move on decorator maybe # def project_root - if server_environment - server_environment['project-root'] || '' - end + server_environment['project-root'] || '' if server_environment end def app_version - if server_environment - server_environment['app-version'] || '' - end + server_environment['app-version'] || '' if server_environment end # filter memory addresses out of object strings diff --git a/app/models/user.rb b/app/models/user.rb index 4c680b0..a58ae15 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -67,9 +67,7 @@ class User end def github_login=(login) - if login.is_a?(String) && login.strip.empty? - login = nil - end + login = nil if login.is_a?(String) && login.strip.empty? self[:github_login] = login end -- libgit2 0.21.2