This instance will be upgraded to Heptapod 0.27.1 on 2021-12-08 at 22:00 UTC+1 (a few minutes of down time)

Commit f40716f4 authored by Douwe Maan's avatar Douwe Maan
Browse files

No more and/or

parent b8c85e6867fa
......@@ -54,6 +54,11 @@ Style/AlignArray:
Style/AlignHash:
Enabled: true
# Whether `and` and `or` are banned only in conditionals (conditionals)
# or completely (always).
Style/AndOr:
Enabled: true
# Use `Array#join` instead of `Array#*`.
Style/ArrayJoin:
Enabled: true
......
......@@ -180,13 +180,6 @@ Security/JSONLoad:
Style/AlignParameters:
Enabled: false
# Offense count: 27
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: always, conditionals
Style/AndOr:
Enabled: false
# Offense count: 54
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
......
......@@ -74,7 +74,7 @@ def authenticate_user_from_private_token!
def authenticate_user!(*args)
if redirect_to_home_page_url?
redirect_to current_application_settings.home_page_url and return
return redirect_to current_application_settings.home_page_url
end
super(*args)
......@@ -131,7 +131,7 @@ def default_headers
headers['X-UA-Compatible'] = 'IE=edge'
headers['X-Content-Type-Options'] = 'nosniff'
# Enabling HSTS for non-standard ports would send clients to the wrong port
if Gitlab.config.gitlab.https and Gitlab.config.gitlab.port == 443
if Gitlab.config.gitlab.https && Gitlab.config.gitlab.port == 443
headers['Strict-Transport-Security'] = 'max-age=31536000'
end
end
......@@ -152,7 +152,7 @@ def validate_user_service_ticket!
def check_password_expiration
if current_user && current_user.password_expires_at && current_user.password_expires_at < Time.now && !current_user.ldap_user?
redirect_to new_profile_password_path and return
return redirect_to new_profile_password_path
end
end
......@@ -218,7 +218,7 @@ def hexdigest(string)
def require_email
if current_user && current_user.temp_oauth_email? && session[:impersonator_id].nil?
redirect_to profile_path, notice: 'Please complete your profile with email address' and return
return redirect_to profile_path, notice: 'Please complete your profile with email address'
end
end
......
......@@ -29,7 +29,7 @@ def create_user_map
unless user_map.is_a?(Hash) && user_map.all? { |k, v| !v[:name].blank? }
flash.now[:alert] = 'All users must have a name.'
render 'new_user_map' and return
return render 'new_user_map'
end
session[:fogbugz_user_map] = user_map
......
......@@ -44,13 +44,13 @@ def create_user_map
rescue
flash.now[:alert] = "The entered user map is not a valid JSON user map."
render "new_user_map" and return
return render "new_user_map"
end
unless user_map.is_a?(Hash) && user_map.all? { |k, v| k.is_a?(String) && v.is_a?(String) }
flash.now[:alert] = "The entered user map is not a valid JSON user map."
render "new_user_map" and return
return render "new_user_map"
end
# This is the default, so let's not save it into the database.
......
......@@ -42,9 +42,7 @@ def member
@token = params[:id]
@member = Member.find_by_invite_token(@token)
unless @member
render_404 and return
end
return render_404 unless @member
@member
end
......
......@@ -122,7 +122,7 @@ def continue_login_process
else
error_message = @user.errors.full_messages.to_sentence
redirect_to omniauth_error_path(oauth['provider'], error: error_message) and return
return redirect_to omniauth_error_path(oauth['provider'], error: error_message)
end
end
......
......@@ -45,13 +45,13 @@ def get_keys
if user.present?
render text: user.all_ssh_keys.join("\n"), content_type: "text/plain"
else
render_404 and return
return render_404
end
rescue => e
render text: e.message
end
else
render_404 and return
return render_404
end
end
......
......@@ -95,7 +95,7 @@ def blob
else
if tree = @repository.tree(@commit.id, @path)
if tree.entries.any?
redirect_to namespace_project_tree_path(@project.namespace, @project, File.join(@ref, @path)) and return
return redirect_to namespace_project_tree_path(@project.namespace, @project, File.join(@ref, @path))
end
end
......
......@@ -15,10 +15,10 @@ def show
if tree.entries.empty?
if @repository.blob_at(@commit.id, @path)
redirect_to(
return redirect_to(
namespace_project_blob_path(@project.namespace, @project,
File.join(@ref, @path))
) and return
)
elsif @path.present?
return render_404
end
......
......@@ -23,7 +23,7 @@ def index
if params[:username].present?
@user = User.find_by(username: params[:username])
render_404 and return unless @user
return render_404 unless @user
@snippets = SnippetsFinder.new.execute(current_user, {
filter: :by_user,
......
......@@ -552,7 +552,7 @@ def gitea_import?
end
def check_limit
unless creator.can_create_project? or namespace.kind == 'group'
unless creator.can_create_project? || namespace.kind == 'group'
projects_limit = creator.projects_limit
if projects_limit == 0
......
......@@ -52,7 +52,7 @@ def calculate_reactive_cache(sha, ref)
response = HTTParty.get(commit_status_path(sha, ref), verify: enable_ssl_verification)
status =
if response.code == 200 and response['status']
if response.code == 200 && response['status']
case response['status']
when 'killed'
:canceled
......
......@@ -96,7 +96,7 @@ def format_channel(recipient)
rescue URI::InvalidURIError
end
unless uri.present? and default_irc_uri.nil?
unless uri.present? && default_irc_uri.nil?
begin
new_recipient = URI.join(default_irc_uri, '/', recipient).to_s
uri = consider_uri(URI.parse(new_recipient))
......
......@@ -5,7 +5,7 @@ def initialize(project, file)
end
def execute
return nil unless @file and @file.size <= max_attachment_size
return nil unless @file && @file.size <= max_attachment_size
uploader = FileUploader.new(@project)
uploader.store!(@file)
......
......@@ -31,7 +31,7 @@ def add_index_sql(table_name, column_name, options = {})
end
def add_index_options(table_name, column_name, options = {})
if options[:using] and options[:using] == :gin
if options[:using] && options[:using] == :gin
options = options.dup
options.delete(:using)
end
......
# The default colors of rack-lineprof can be very hard to look at in terminals
# with darker backgrounds. This patch tweaks the colors a bit so the output is
# actually readable.
if Rails.env.development? and RUBY_ENGINE == 'ruby' and ENV['ENABLE_LINEPROF']
if Rails.env.development? && RUBY_ENGINE == 'ruby' && ENV['ENABLE_LINEPROF']
Rails.application.config.middleware.use(Rack::Lineprof)
module Rack
......
constraint = lambda { |request| request.env['warden'].authenticate? and request.env['warden'].user.admin? }
constraint = lambda { |request| request.env['warden'].authenticate? && request.env['warden'].user.admin? }
constraints constraint do
mount Sidekiq::Web, at: '/admin/sidekiq', as: :sidekiq
end
......@@ -153,7 +153,7 @@ def attributes_for_keys(keys, custom_params = nil)
params_hash = custom_params || params
attrs = {}
keys.each do |key|
if params_hash[key].present? or (params_hash.has_key?(key) and params_hash[key] == false)
if params_hash[key].present? || (params_hash.has_key?(key) && params_hash[key] == false)
attrs[key] = params_hash[key]
end
end
......
......@@ -7,7 +7,7 @@ module Filter
#
class PlantumlFilter < HTML::Pipeline::Filter
def call
return doc unless doc.at('pre.plantuml') and settings.plantuml_enabled
return doc unless doc.at('pre.plantuml') && settings.plantuml_enabled
plantuml_setup
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment