diff --git a/.rubocop.yml b/.rubocop.yml
index b093d4d25d492ae0f54758f3138da19dbb9200ed..a836b469cc7f734a22e9d03c0f7df5d5d9a9b111 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -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
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 648b3fc49d2d08d420a9c5ddb5300e551216dc36..a5b4d2f5b02cc96589b8b9a6fd70a0ee3014f8a1 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -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.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index bf6be3d516b36c28b8666dee6fe4d7b9f4a15f7e..5e7af3bff0df919e762b25455e0b58c1764829aa 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -74,7 +74,7 @@ class ApplicationController < ActionController::Base
 
   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 @@ class ApplicationController < ActionController::Base
     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 @@ class ApplicationController < ActionController::Base
 
   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 @@ class ApplicationController < ActionController::Base
 
   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
 
diff --git a/app/controllers/import/fogbugz_controller.rb b/app/controllers/import/fogbugz_controller.rb
index 99b10b2f9b35b3f1970f377cb1895d840b799693..5df6bd341852eee9abfef703513318086876ebc3 100644
--- a/app/controllers/import/fogbugz_controller.rb
+++ b/app/controllers/import/fogbugz_controller.rb
@@ -29,7 +29,7 @@ class Import::FogbugzController < Import::BaseController
     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
diff --git a/app/controllers/import/google_code_controller.rb b/app/controllers/import/google_code_controller.rb
index 8d0de158f98e47024912edda5a08160e2c88fb4c..7d7f13ce5d525df283ce4a725706d01432dba432 100644
--- a/app/controllers/import/google_code_controller.rb
+++ b/app/controllers/import/google_code_controller.rb
@@ -44,13 +44,13 @@ class Import::GoogleCodeController < Import::BaseController
     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.
diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb
index 58964a0e65d7677e14790f7b2ca63a1038ffa184..7625187c7beccb7efc5e25f6029d26859b4e22bd 100644
--- a/app/controllers/invites_controller.rb
+++ b/app/controllers/invites_controller.rb
@@ -42,9 +42,7 @@ class InvitesController < ApplicationController
     @token = params[:id]
     @member = Member.find_by_invite_token(@token)
 
-    unless @member
-      render_404 and return
-    end
+    return render_404 unless @member
 
     @member
   end
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb
index 3ab7e6e065831f56ba7d925ca9711d1d4fa6f0b0..58d50ad647bf1d858046122fe573998135cd8e19 100644
--- a/app/controllers/omniauth_callbacks_controller.rb
+++ b/app/controllers/omniauth_callbacks_controller.rb
@@ -122,7 +122,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
     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
 
diff --git a/app/controllers/profiles/keys_controller.rb b/app/controllers/profiles/keys_controller.rb
index 830e0b9591bcbfadf15a1b137818bbbe20d409d2..c8663a3c38ee271d4080364e7b54223f1e19825d 100644
--- a/app/controllers/profiles/keys_controller.rb
+++ b/app/controllers/profiles/keys_controller.rb
@@ -45,13 +45,13 @@ class Profiles::KeysController < Profiles::ApplicationController
         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
 
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb
index a1db856dcfb1886c3ea1c82a0523b1dc7afb60a3..39ba815cfcaf17c0bf87ba33d0bc7cb471ed50ee 100644
--- a/app/controllers/projects/blob_controller.rb
+++ b/app/controllers/projects/blob_controller.rb
@@ -95,7 +95,7 @@ class Projects::BlobController < Projects::ApplicationController
     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
 
diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb
index cb3ed0f6f9c25dabfb05247f6002bf2478330a3d..4f094146348aac2ac31fe01853b99ea5fa0c5c18 100644
--- a/app/controllers/projects/tree_controller.rb
+++ b/app/controllers/projects/tree_controller.rb
@@ -15,10 +15,10 @@ class Projects::TreeController < Projects::ApplicationController
 
     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
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index 366804ab17e6a3e8062bbf7429573adad5634c8b..445898a2e9e0bf5416548afa0db56015c392518e 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -23,7 +23,7 @@ class SnippetsController < ApplicationController
     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,
diff --git a/app/models/project.rb b/app/models/project.rb
index fc5b1a66910f0be31da229b76dd670d0aae5c2d4..411299eef63c11729d1d66d4e858605e31869bd6 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -552,7 +552,7 @@ class Project < ActiveRecord::Base
   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
diff --git a/app/models/project_services/drone_ci_service.rb b/app/models/project_services/drone_ci_service.rb
index 942ec9371e567cb45c1c5f1cfa7c7f490f273142..1ad9efac1964e0ac4988fb7d7bed8d6a210a8565 100644
--- a/app/models/project_services/drone_ci_service.rb
+++ b/app/models/project_services/drone_ci_service.rb
@@ -52,7 +52,7 @@ class DroneCiService < CiService
     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
diff --git a/app/models/project_services/irker_service.rb b/app/models/project_services/irker_service.rb
index 5d93064f9b311af129db78d44cce4b4efa250114..5d6862d9faa65ec2b2b177bf32e67397a77a924e 100644
--- a/app/models/project_services/irker_service.rb
+++ b/app/models/project_services/irker_service.rb
@@ -96,7 +96,7 @@ class IrkerService < Service
     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))
diff --git a/app/services/projects/upload_service.rb b/app/services/projects/upload_service.rb
index 012e82a77042d188f72102a13404af3b9f78b0ca..be34d4fa9b87b8b67091143106a58454a6c85d10 100644
--- a/app/services/projects/upload_service.rb
+++ b/app/services/projects/upload_service.rb
@@ -5,7 +5,7 @@ module Projects
     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)
diff --git a/config/initializers/mysql_ignore_postgresql_options.rb b/config/initializers/mysql_ignore_postgresql_options.rb
index 835f3ec557446aacaed23f2725e9c91323f02d57..9a569be767427e60e1f608d4fd469e097960d00d 100644
--- a/config/initializers/mysql_ignore_postgresql_options.rb
+++ b/config/initializers/mysql_ignore_postgresql_options.rb
@@ -31,7 +31,7 @@ if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
         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
diff --git a/config/initializers/rack_lineprof.rb b/config/initializers/rack_lineprof.rb
index 22e77a32c614bffa2d0709d46298cf21e3da6d49..f7172fce9bc72e62fa5b3925b2183e06e82ba770 100644
--- a/config/initializers/rack_lineprof.rb
+++ b/config/initializers/rack_lineprof.rb
@@ -1,7 +1,7 @@
 # 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
diff --git a/config/routes/sidekiq.rb b/config/routes/sidekiq.rb
index d3e6bc4c2926794e3b728c9ece131c0da395b63e..0fa23f2b3d0be8fb47c95bc584e53f5746f49efa 100644
--- a/config/routes/sidekiq.rb
+++ b/config/routes/sidekiq.rb
@@ -1,4 +1,4 @@
-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
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 7b6fae866eb16a35939fcad72d4a5b3c7138767a..ae62f1f9580ee6a22dafc381e0d6a0c8d46a1bb9 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -153,7 +153,7 @@ module API
       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
diff --git a/lib/banzai/filter/plantuml_filter.rb b/lib/banzai/filter/plantuml_filter.rb
index e194cf59275f82ba6417e45c900d9ae7bf8082e8..b2537117558746442c7bf99e3a4fd1ef05338193 100644
--- a/lib/banzai/filter/plantuml_filter.rb
+++ b/lib/banzai/filter/plantuml_filter.rb
@@ -7,7 +7,7 @@ module Banzai
     #
     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
 
diff --git a/lib/ci/ansi2html.rb b/lib/ci/ansi2html.rb
index c10d3616f312cade8ab28d14be3341211544d21d..158a33f26fec65d95f744b0bceb6347c5b516f46 100644
--- a/lib/ci/ansi2html.rb
+++ b/lib/ci/ansi2html.rb
@@ -126,7 +126,7 @@ module Ci
         # We are only interested in color and text style changes - triggered by
         # sequences starting with '\e[' and ending with 'm'. Any other control
         # sequence gets stripped (including stuff like "delete last line")
-        return unless indicator == '[' and terminator == 'm'
+        return unless indicator == '[' && terminator == 'm'
 
         close_open_tags()
 
diff --git a/lib/gitlab/metrics/system.rb b/lib/gitlab/metrics/system.rb
index 287b7a83547656d023cdb7ce6a877a302d763918..3aaebb3e9c3e64eda8c52eedc54f12292db64ae5 100644
--- a/lib/gitlab/metrics/system.rb
+++ b/lib/gitlab/metrics/system.rb
@@ -11,7 +11,7 @@ module Gitlab
           mem   = 0
           match = File.read('/proc/self/status').match(/VmRSS:\s+(\d+)/)
 
-          if match and match[1]
+          if match && match[1]
             mem = match[1].to_f * 1024
           end