diff options
44 files changed, 245 insertions, 213 deletions
diff --git a/app/controllers/concerns/creates_commit.rb b/app/controllers/concerns/creates_commit.rb index a6cf2b274a2..2fe03020d2d 100644 --- a/app/controllers/concerns/creates_commit.rb +++ b/app/controllers/concerns/creates_commit.rb @@ -101,13 +101,14 @@ module CreatesCommit # TODO: We should really clean this up def set_commit_variables - @mr_source_project = if can?(current_user, :push_code, @project) - # Edit file in this project - @project - else - # Merge request from fork to this project - current_user.fork_of(@project) - end + @mr_source_project = + if can?(current_user, :push_code, @project) + # Edit file in this project + @project + else + # Merge request from fork to this project + current_user.fork_of(@project) + end # Merge request to this project @mr_target_project = @project diff --git a/app/controllers/projects/git_http_client_controller.rb b/app/controllers/projects/git_http_client_controller.rb index 0305dafe8da..9a1bf037a95 100644 --- a/app/controllers/projects/git_http_client_controller.rb +++ b/app/controllers/projects/git_http_client_controller.rb @@ -76,11 +76,12 @@ class Projects::GitHttpClientController < Projects::ApplicationController return @project if defined?(@project) project_id, _ = project_id_with_suffix - @project = if project_id.blank? - nil - else - Project.find_by_full_path("#{params[:namespace_id]}/#{project_id}") - end + @project = + if project_id.blank? + nil + else + Project.find_by_full_path("#{params[:namespace_id]}/#{project_id}") + end end # This method returns two values so that we can parse diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index ff77c2b5e01..5ee7972e29e 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -381,14 +381,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController end def merge_widget_refresh - @status = if merge_request.merge_when_build_succeeds - :merge_when_build_succeeds - else - # Only MRs that can be merged end in this action - # MR can be already picked up for merge / merged already or can be waiting for worker to be picked up - # in last case it does not have any special status. Possible error is handled inside widget js function - :success - end + @status = + if merge_request.merge_when_build_succeeds + :merge_when_build_succeeds + else + # Only MRs that can be merged end in this action + # MR can be already picked up for merge / merged already or can be waiting for worker to be picked up + # in last case it does not have any special status. Possible error is handled inside widget js function + :success + end render 'merge' end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 529a8c9b4b4..7d81c96262f 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -15,11 +15,12 @@ class SessionsController < Devise::SessionsController def new set_minimum_password_length - @ldap_servers = if Gitlab.config.ldap.enabled - Gitlab::LDAP::Config.servers - else - [] - end + @ldap_servers = + if Gitlab.config.ldap.enabled + Gitlab::LDAP::Config.servers + else + [] + end super end diff --git a/app/finders/notes_finder.rb b/app/finders/notes_finder.rb index 3279cd4a941..6630c6384f2 100644 --- a/app/finders/notes_finder.rb +++ b/app/finders/notes_finder.rb @@ -28,11 +28,12 @@ class NotesFinder private def init_collection - @notes = if @params[:target_id] - on_target(@params[:target_type], @params[:target_id]) - else - notes_of_any_type - end + @notes = + if @params[:target_id] + on_target(@params[:target_type], @params[:target_id]) + else + notes_of_any_type + end end def notes_of_any_type diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ed4be180f04..70419eb4bde 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -69,11 +69,12 @@ module ApplicationHelper end def avatar_icon(user_or_email = nil, size = nil, scale = 2) - user = if user_or_email.is_a?(User) - user_or_email - else - User.find_by_any_email(user_or_email.try(:downcase)) - end + user = + if user_or_email.is_a?(User) + user_or_email + else + User.find_by_any_email(user_or_email.try(:downcase)) + end if user user.avatar_url(size) || default_avatar diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index 6cba11f1b63..7f32c1b5300 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -153,16 +153,17 @@ module BlobHelper # Because we are opionated we set the cache headers ourselves. response.cache_control[:public] = @project.public? - response.cache_control[:max_age] = if @ref && @commit && @ref == @commit.id - # This is a link to a commit by its commit SHA. That means that the blob - # is immutable. The only reason to invalidate the cache is if the commit - # was deleted or if the user lost access to the repository. - Blob::CACHE_TIME_IMMUTABLE - else - # A branch or tag points at this blob. That means that the expected blob - # value may change over time. - Blob::CACHE_TIME - end + response.cache_control[:max_age] = + if @ref && @commit && @ref == @commit.id + # This is a link to a commit by its commit SHA. That means that the blob + # is immutable. The only reason to invalidate the cache is if the commit + # was deleted or if the user lost access to the repository. + Blob::CACHE_TIME_IMMUTABLE + else + # A branch or tag points at this blob. That means that the expected blob + # value may change over time. + Blob::CACHE_TIME + end response.etag = @blob.id !stale diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb index 97d8cde4b3d..fb95f2b565e 100644 --- a/app/helpers/submodule_helper.rb +++ b/app/helpers/submodule_helper.rb @@ -38,7 +38,7 @@ module SubmoduleHelper def self_url?(url, namespace, project) return true if url == [Gitlab.config.gitlab.url, '/', namespace, '/', - project, '.git'].join('') + project, '.git'].join('') url == gitlab_shell.url_to_repo([namespace, '/', project].join('')) end diff --git a/app/mailers/repository_check_mailer.rb b/app/mailers/repository_check_mailer.rb index 11a0c0b7700..22a9f5da646 100644 --- a/app/mailers/repository_check_mailer.rb +++ b/app/mailers/repository_check_mailer.rb @@ -1,10 +1,11 @@ class RepositoryCheckMailer < BaseMailer def notify(failed_count) - @message = if failed_count == 1 - "One project failed its last repository check" - else - "#{failed_count} projects failed their last repository check" - end + @message = + if failed_count == 1 + "One project failed its last repository check" + else + "#{failed_count} projects failed their last repository check" + end mail( to: User.admins.pluck(:email), diff --git a/app/models/commit.rb b/app/models/commit.rb index feb35bb3e92..8f6179f183e 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -122,11 +122,12 @@ class Commit def full_title return @full_title if @full_title - @full_title = if safe_message.blank? - no_commit_message - else - safe_message.split("\n", 2).first - end + @full_title = + if safe_message.blank? + no_commit_message + else + safe_message.split("\n", 2).first + end end # Returns the commits description diff --git a/app/models/concerns/case_sensitivity.rb b/app/models/concerns/case_sensitivity.rb index 2cfb6127c96..034e9f40ff0 100644 --- a/app/models/concerns/case_sensitivity.rb +++ b/app/models/concerns/case_sensitivity.rb @@ -13,11 +13,12 @@ module CaseSensitivity params.each do |key, value| column = ActiveRecord::Base.connection.quote_table_name(key) - condition = if cast_lower - "LOWER(#{column}) = LOWER(:value)" - else - "#{column} = :value" - end + condition = + if cast_lower + "LOWER(#{column}) = LOWER(:value)" + else + "#{column} = :value" + end criteria = criteria.where(condition, value: value) end diff --git a/app/models/concerns/sortable.rb b/app/models/concerns/sortable.rb index fdcb4f3ba64..b9a2d812edd 100644 --- a/app/models/concerns/sortable.rb +++ b/app/models/concerns/sortable.rb @@ -46,11 +46,12 @@ module Sortable where("label_links.target_id = #{target_column}"). reorder(nil) - query = if target_type_column - query.where("label_links.target_type = #{target_type_column}") - else - query.where(label_links: { target_type: target_type }) - end + query = + if target_type_column + query.where("label_links.target_type = #{target_type_column}") + else + query.where(label_links: { target_type: target_type }) + end query = query.where.not(title: excluded_labels) if excluded_labels.present? diff --git a/app/models/network/graph.rb b/app/models/network/graph.rb index b859d40da24..2a7fa7d0607 100644 --- a/app/models/network/graph.rb +++ b/app/models/network/graph.rb @@ -188,11 +188,12 @@ module Network end # and mark it as reserved - min_time = if parent_time.nil? - leaves.first.time - else - parent_time + 1 - end + min_time = + if parent_time.nil? + leaves.first.time + else + parent_time + 1 + end max_time = leaves.last.time leaves.last.parents(@map).each do |parent| diff --git a/app/models/project.rb b/app/models/project.rb index a0bc82af7d5..e75ba3abb98 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -453,13 +453,14 @@ class Project < ActiveRecord::Base end def add_import_job - job_id = if forked? - RepositoryForkWorker.perform_async(id, forked_from_project.repository_storage_path, - forked_from_project.path_with_namespace, - self.namespace.full_path) - else - RepositoryImportWorker.perform_async(self.id) - end + job_id = + if forked? + RepositoryForkWorker.perform_async(id, forked_from_project.repository_storage_path, + forked_from_project.path_with_namespace, + self.namespace.full_path) + else + RepositoryImportWorker.perform_async(self.id) + end if job_id Rails.logger.info "Import job started for #{path_with_namespace} with job ID #{job_id}" diff --git a/app/models/project_services/pushover_service.rb b/app/models/project_services/pushover_service.rb index cd185f6e120..f4106048345 100644 --- a/app/models/project_services/pushover_service.rb +++ b/app/models/project_services/pushover_service.rb @@ -72,13 +72,14 @@ class PushoverService < Service before = data[:before] after = data[:after] - message = if Gitlab::Git.blank_ref?(before) - "#{data[:user_name]} pushed new branch \"#{ref}\"." - elsif Gitlab::Git.blank_ref?(after) - "#{data[:user_name]} deleted branch \"#{ref}\"." - else - "#{data[:user_name]} push to branch \"#{ref}\"." - end + message = + if Gitlab::Git.blank_ref?(before) + "#{data[:user_name]} pushed new branch \"#{ref}\"." + elsif Gitlab::Git.blank_ref?(after) + "#{data[:user_name]} deleted branch \"#{ref}\"." + else + "#{data[:user_name]} push to branch \"#{ref}\"." + end if data[:total_commits_count] > 0 message << "\nTotal commits count: #{data[:total_commits_count]}" diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index 3e362bb2ca9..5cb4401d69d 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -408,12 +408,13 @@ module SystemNoteService # Initial scope should be system notes of this noteable type notes = Note.system.where(noteable_type: noteable.class) - notes = if noteable.is_a?(Commit) - # Commits have non-integer IDs, so they're stored in `commit_id` - notes.where(commit_id: noteable.id) - else - notes.where(noteable_id: noteable.id) - end + notes = + if noteable.is_a?(Commit) + # Commits have non-integer IDs, so they're stored in `commit_id` + notes.where(commit_id: noteable.id) + else + notes.where(noteable_id: noteable.id) + end notes_for_mentioner(mentioner, noteable, notes).exists? end diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index ecae5453736..ac89fb9e9cf 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -14,16 +14,17 @@ class Settings < Settingslogic end def build_gitlab_ci_url - custom_port = if on_standard_port?(gitlab) - nil - else - ":#{gitlab.port}" - end + custom_port = + if on_standard_port?(gitlab) + nil + else + ":#{gitlab.port}" + end [gitlab.protocol, - "://", - gitlab.host, - custom_port, - gitlab.relative_url_root + "://", + gitlab.host, + custom_port, + gitlab.relative_url_root ].join('') end @@ -81,9 +82,9 @@ class Settings < Settingslogic def base_url(config) custom_port = on_standard_port?(config) ? nil : ":#{config.port}" [config.protocol, - "://", - config.host, - custom_port + "://", + config.host, + custom_port ] end @@ -160,15 +161,16 @@ if github_settings github_settings["args"] ||= Settingslogic.new({}) - github_settings["args"]["client_options"] = if github_settings["url"].include?(github_default_url) - OmniAuth::Strategies::GitHub.default_options[:client_options] - else - { - "site" => File.join(github_settings["url"], "api/v3"), - "authorize_url" => File.join(github_settings["url"], "login/oauth/authorize"), - "token_url" => File.join(github_settings["url"], "login/oauth/access_token") - } - end + github_settings["args"]["client_options"] = + if github_settings["url"].include?(github_default_url) + OmniAuth::Strategies::GitHub.default_options[:client_options] + else + { + "site" => File.join(github_settings["url"], "api/v3"), + "authorize_url" => File.join(github_settings["url"], "login/oauth/authorize"), + "token_url" => File.join(github_settings["url"], "login/oauth/access_token") + } + end end Settings['shared'] ||= Settingslogic.new({}) diff --git a/lib/api/api_guard.rb b/lib/api/api_guard.rb index a955d17c9d1..c11f8529183 100644 --- a/lib/api/api_guard.rb +++ b/lib/api/api_guard.rb @@ -115,7 +115,7 @@ module API def install_error_responders(base) error_classes = [MissingTokenError, TokenNotFoundError, - ExpiredError, RevokedError, InsufficientScopeError] + ExpiredError, RevokedError, InsufficientScopeError] base.send :rescue_from, *error_classes, oauth2_bearer_token_error_handler end diff --git a/lib/api/award_emoji.rb b/lib/api/award_emoji.rb index f54ba232608..d6352920f57 100644 --- a/lib/api/award_emoji.rb +++ b/lib/api/award_emoji.rb @@ -16,7 +16,7 @@ module API end [":id/#{awardable_string}/:#{awardable_id_string}/award_emoji", - ":id/#{awardable_string}/:#{awardable_id_string}/notes/:note_id/award_emoji" + ":id/#{awardable_string}/:#{awardable_id_string}/notes/:note_id/award_emoji" ].each do |endpoint| desc 'Get a list of project +awardable+ award emoji' do diff --git a/lib/banzai/filter/abstract_reference_filter.rb b/lib/banzai/filter/abstract_reference_filter.rb index 1c42ae3363d..02d5ad70fa7 100644 --- a/lib/banzai/filter/abstract_reference_filter.rb +++ b/lib/banzai/filter/abstract_reference_filter.rb @@ -160,11 +160,12 @@ module Banzai data = data_attributes_for(link_content || match, project, object, link: !!link_content) - url = if matches.names.include?("url") && matches[:url] - matches[:url] - else - url_for_object_cached(object, project) - end + url = + if matches.names.include?("url") && matches[:url] + matches[:url] + else + url_for_object_cached(object, project) + end content = link_content || object_link_text(object, matches) diff --git a/lib/banzai/filter/gollum_tags_filter.rb b/lib/banzai/filter/gollum_tags_filter.rb index 35d21733967..0ea4eeaed5b 100644 --- a/lib/banzai/filter/gollum_tags_filter.rb +++ b/lib/banzai/filter/gollum_tags_filter.rb @@ -149,11 +149,12 @@ module Banzai name, reference = *parts.compact.map(&:strip) end - href = if url?(reference) - reference - else - ::File.join(project_wiki_base_path, reference) - end + href = + if url?(reference) + reference + else + ::File.join(project_wiki_base_path, reference) + end content_tag(:a, name || reference, href: href, class: 'gfm') end diff --git a/lib/banzai/filter/issue_reference_filter.rb b/lib/banzai/filter/issue_reference_filter.rb index e5082895e82..044d18ff824 100644 --- a/lib/banzai/filter/issue_reference_filter.rb +++ b/lib/banzai/filter/issue_reference_filter.rb @@ -39,11 +39,12 @@ module Banzai projects_per_reference.each do |path, project| issue_ids = references_per_project[path] - issues = if project.default_issues_tracker? - project.issues.where(iid: issue_ids.to_a) - else - issue_ids.map { |id| ExternalIssue.new(id, project) } - end + issues = + if project.default_issues_tracker? + project.issues.where(iid: issue_ids.to_a) + else + issue_ids.map { |id| ExternalIssue.new(id, project) } + end issues.each do |issue| hash[project][issue.iid.to_i] = issue diff --git a/lib/gitlab/award_emoji.rb b/lib/gitlab/award_emoji.rb index fcb3542d181..7555326d384 100644 --- a/lib/gitlab/award_emoji.rb +++ b/lib/gitlab/award_emoji.rb @@ -69,11 +69,12 @@ module Gitlab end JSON.parse(File.read(path)).map do |hash| - fname = if digest - "#{hash['unicode']}-#{hash['digest']}" - else - hash['unicode'] - end + fname = + if digest + "#{hash['unicode']}-#{hash['digest']}" + else + hash['unicode'] + end { name: hash['name'], path: File.join(base, prefix, "#{fname}.png") } end diff --git a/lib/gitlab/ci/config/entry/global.rb b/lib/gitlab/ci/config/entry/global.rb index 8154beea21f..0a404331225 100644 --- a/lib/gitlab/ci/config/entry/global.rb +++ b/lib/gitlab/ci/config/entry/global.rb @@ -49,7 +49,7 @@ module Gitlab factory = Entry::Factory.new(Entry::Jobs). value(@config.except(*self.class.nodes.keys)). with(key: :jobs, parent: self, - description: 'Jobs definition for this pipeline') + description: 'Jobs definition for this pipeline') @entries[:jobs] = factory.create! end diff --git a/lib/gitlab/ci/config/entry/jobs.rb b/lib/gitlab/ci/config/entry/jobs.rb index 41de7dbbb3e..7b83f0f1b69 100644 --- a/lib/gitlab/ci/config/entry/jobs.rb +++ b/lib/gitlab/ci/config/entry/jobs.rb @@ -35,7 +35,7 @@ module Gitlab value(config || {}). metadata(name: name). with(key: name, parent: self, - description: "#{name} job definition.") + description: "#{name} job definition.") @entries[name] = factory.create! end diff --git a/lib/gitlab/conflict/file.rb b/lib/gitlab/conflict/file.rb index fd43a224b3d..d80bc748209 100644 --- a/lib/gitlab/conflict/file.rb +++ b/lib/gitlab/conflict/file.rb @@ -91,11 +91,12 @@ module Gitlab our_highlight = Gitlab::Highlight.highlight(our_path, our_file, repository: repository).lines lines.each do |line| - line.rich_text = if line.type == 'old' - their_highlight[line.old_line - 1].try(:html_safe) - else - our_highlight[line.new_line - 1].try(:html_safe) - end + line.rich_text = + if line.type == 'old' + their_highlight[line.old_line - 1].try(:html_safe) + else + our_highlight[line.new_line - 1].try(:html_safe) + end end end diff --git a/lib/gitlab/diff/position.rb b/lib/gitlab/diff/position.rb index 81c93f1aab5..fc728123c97 100644 --- a/lib/gitlab/diff/position.rb +++ b/lib/gitlab/diff/position.rb @@ -140,15 +140,16 @@ module Gitlab def find_diff_file(repository) # We're at the initial commit, so just get that as we can't compare to anything. - compare = if Gitlab::Git.blank_ref?(start_sha) - Gitlab::Git::Commit.find(repository.raw_repository, head_sha) - else - Gitlab::Git::Compare.new( - repository.raw_repository, - start_sha, - head_sha - ) - end + compare = + if Gitlab::Git.blank_ref?(start_sha) + Gitlab::Git::Commit.find(repository.raw_repository, head_sha) + else + Gitlab::Git::Compare.new( + repository.raw_repository, + start_sha, + head_sha + ) + end diff = compare.diffs(paths: paths).first diff --git a/lib/gitlab/email/reply_parser.rb b/lib/gitlab/email/reply_parser.rb index 4ddfd78130e..558df87f36d 100644 --- a/lib/gitlab/email/reply_parser.rb +++ b/lib/gitlab/email/reply_parser.rb @@ -31,11 +31,12 @@ module Gitlab private def select_body(message) - part = if message.multipart? - message.text_part || message.html_part || message - else - message - end + part = + if message.multipart? + message.text_part || message.html_part || message + else + message + end decoded = fix_charset(part) diff --git a/lib/gitlab/metrics/instrumentation.rb b/lib/gitlab/metrics/instrumentation.rb index 9a07abfed06..6aa38542cb4 100644 --- a/lib/gitlab/metrics/instrumentation.rb +++ b/lib/gitlab/metrics/instrumentation.rb @@ -143,11 +143,12 @@ module Gitlab # signature this would break things. As a result we'll make sure the # generated method _only_ accepts regular arguments if the underlying # method also accepts them. - args_signature = if method.arity == 0 - '' - else - '*args' - end + args_signature = + if method.arity == 0 + '' + else + '*args' + end proxy_module.class_eval <<-EOF, __FILE__, __LINE__ + 1 def #{name}(#{args_signature}) diff --git a/lib/gitlab/saml/user.rb b/lib/gitlab/saml/user.rb index abde05d9b68..8a7cc690046 100644 --- a/lib/gitlab/saml/user.rb +++ b/lib/gitlab/saml/user.rb @@ -28,11 +28,12 @@ module Gitlab if external_users_enabled? && @user # Check if there is overlap between the user's groups and the external groups # setting then set user as external or internal. - @user.external = if (auth_hash.groups & Gitlab::Saml::Config.external_groups).empty? - false - else - true - end + @user.external = + if (auth_hash.groups & Gitlab::Saml::Config.external_groups).empty? + false + else + true + end end @user diff --git a/lib/gitlab/search_results.rb b/lib/gitlab/search_results.rb index a1a6929103b..ccfa517e04b 100644 --- a/lib/gitlab/search_results.rb +++ b/lib/gitlab/search_results.rb @@ -56,11 +56,12 @@ module Gitlab def issues issues = IssuesFinder.new(current_user).execute.where(project_id: project_ids_relation) - issues = if query =~ /#(\d+)\z/ - issues.where(iid: $1) - else - issues.full_search(query) - end + issues = + if query =~ /#(\d+)\z/ + issues.where(iid: $1) + else + issues.full_search(query) + end issues.order('updated_at DESC') end @@ -73,11 +74,12 @@ module Gitlab def merge_requests merge_requests = MergeRequestsFinder.new(current_user).execute.in_projects(project_ids_relation) - merge_requests = if query =~ /[#!](\d+)\z/ - merge_requests.where(iid: $1) - else - merge_requests.full_search(query) - end + merge_requests = + if query =~ /[#!](\d+)\z/ + merge_requests.where(iid: $1) + else + merge_requests.full_search(query) + end merge_requests.order('updated_at DESC') end diff --git a/lib/gitlab/shell.rb b/lib/gitlab/shell.rb index 3be8d3aec9c..7374d2bc8b8 100644 --- a/lib/gitlab/shell.rb +++ b/lib/gitlab/shell.rb @@ -83,7 +83,7 @@ module Gitlab # Timeout should be less than 900 ideally, to prevent the memory killer # to silently kill the process without knowing we are timing out here. output, status = Popen.popen([gitlab_shell_projects_path, 'import-project', - storage, "#{name}.git", url, '800']) + storage, "#{name}.git", url, '800']) raise Error, output unless status.zero? true end diff --git a/lib/gitlab/sherlock/query.rb b/lib/gitlab/sherlock/query.rb index 086fcddf721..99e56e923eb 100644 --- a/lib/gitlab/sherlock/query.rb +++ b/lib/gitlab/sherlock/query.rb @@ -94,11 +94,12 @@ module Gitlab private def raw_explain(query) - explain = if Gitlab::Database.postgresql? - "EXPLAIN ANALYZE #{query};" - else - "EXPLAIN #{query};" - end + explain = + if Gitlab::Database.postgresql? + "EXPLAIN ANALYZE #{query};" + else + "EXPLAIN #{query};" + end ActiveRecord::Base.connection.execute(explain) end diff --git a/spec/features/issuables/issuable_list_spec.rb b/spec/features/issuables/issuable_list_spec.rb index 2867fcf8819..b90bf6268fd 100644 --- a/spec/features/issuables/issuable_list_spec.rb +++ b/spec/features/issuables/issuable_list_spec.rb @@ -47,11 +47,12 @@ describe 'issuable list', feature: true do def create_issuables(issuable_type) 3.times do - issuable = if issuable_type == :issue - create(:issue, project: project, author: user) - else - create(:merge_request, title: FFaker::Lorem.sentence, source_project: project, source_branch: FFaker::Name.name) - end + issuable = + if issuable_type == :issue + create(:issue, project: project, author: user) + else + create(:merge_request, title: FFaker::Lorem.sentence, source_project: project, source_branch: FFaker::Name.name) + end 2.times do create(:note_on_issue, noteable: issuable, project: project, note: 'Test note') diff --git a/spec/helpers/issues_helper_spec.rb b/spec/helpers/issues_helper_spec.rb index 372546e92a5..4a9cbba69f9 100644 --- a/spec/helpers/issues_helper_spec.rb +++ b/spec/helpers/issues_helper_spec.rb @@ -56,7 +56,7 @@ describe IssuesHelper do subject { merge_requests_sentence(merge_requests)} let(:merge_requests) do [build(:merge_request, iid: 1), build(:merge_request, iid: 2), - build(:merge_request, iid: 3)] + build(:merge_request, iid: 3)] end it { is_expected.to eq("!1, !2, or !3") } diff --git a/spec/lib/gitlab/ci/config/entry/global_spec.rb b/spec/lib/gitlab/ci/config/entry/global_spec.rb index c3551a149ed..3b2d043301e 100644 --- a/spec/lib/gitlab/ci/config/entry/global_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/global_spec.rb @@ -12,8 +12,8 @@ describe Gitlab::Ci::Config::Entry::Global do it 'contains the expected node names' do expect(described_class.nodes.keys). to match_array(%i[before_script image services - after_script variables stages - types cache]) + after_script variables stages + types cache]) end end end diff --git a/spec/lib/gitlab/ci/config/entry/job_spec.rb b/spec/lib/gitlab/ci/config/entry/job_spec.rb index b90308a0515..82feff0af1c 100644 --- a/spec/lib/gitlab/ci/config/entry/job_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/job_spec.rb @@ -140,11 +140,11 @@ describe Gitlab::Ci::Config::Entry::Job do it 'returns correct value' do expect(entry.value). to eq(name: :rspec, - before_script: %w[ls pwd], - script: %w[rspec], - commands: "ls\npwd\nrspec", - stage: 'test', - after_script: %w[cleanup]) + before_script: %w[ls pwd], + script: %w[rspec], + commands: "ls\npwd\nrspec", + stage: 'test', + after_script: %w[cleanup]) end end end diff --git a/spec/lib/gitlab/ci/status/build/factory_spec.rb b/spec/lib/gitlab/ci/status/build/factory_spec.rb index 3d1ebadadcc..aa026a66460 100644 --- a/spec/lib/gitlab/ci/status/build/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/build/factory_spec.rb @@ -69,7 +69,7 @@ describe Gitlab::Ci::Status::Build::Factory do it 'matches correct extended statuses' do expect(factory.extended_statuses). to eq [Gitlab::Ci::Status::Build::Retryable, - Gitlab::Ci::Status::Build::FailedAllowed] + Gitlab::Ci::Status::Build::FailedAllowed] end it 'fabricates a failed but allowed build status' do diff --git a/spec/lib/gitlab/incoming_email_spec.rb b/spec/lib/gitlab/incoming_email_spec.rb index 06d39d5c782..d54753ccf90 100644 --- a/spec/lib/gitlab/incoming_email_spec.rb +++ b/spec/lib/gitlab/incoming_email_spec.rb @@ -101,8 +101,8 @@ describe Gitlab::IncomingEmail, lib: true do it 'returns reply key' do expect(described_class.scan_fallback_references(references)). to eq(%w[issue_1@localhost - reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost - exchange@microsoft.com]) + reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost + exchange@microsoft.com]) end end end diff --git a/spec/lib/gitlab/o_auth/user_spec.rb b/spec/lib/gitlab/o_auth/user_spec.rb index 0575b95fd30..2c07c37b0ea 100644 --- a/spec/lib/gitlab/o_auth/user_spec.rb +++ b/spec/lib/gitlab/o_auth/user_spec.rb @@ -152,7 +152,7 @@ describe Gitlab::OAuth::User, lib: true do identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } expect(identities_as_hash).to match_array( [{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, - { provider: 'twitter', extern_uid: uid } + { provider: 'twitter', extern_uid: uid } ]) end end @@ -171,7 +171,7 @@ describe Gitlab::OAuth::User, lib: true do identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } expect(identities_as_hash).to match_array( [{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, - { provider: 'twitter', extern_uid: uid } + { provider: 'twitter', extern_uid: uid } ]) end end diff --git a/spec/lib/gitlab/saml/user_spec.rb b/spec/lib/gitlab/saml/user_spec.rb index 844b9446603..00dd29f3e5d 100644 --- a/spec/lib/gitlab/saml/user_spec.rb +++ b/spec/lib/gitlab/saml/user_spec.rb @@ -158,7 +158,7 @@ describe Gitlab::Saml::User, lib: true do expect(gl_user.identities.length).to eql 2 identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } expect(identities_as_hash).to match_array([{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, - { provider: 'saml', extern_uid: uid } + { provider: 'saml', extern_uid: uid } ]) end end @@ -181,7 +181,7 @@ describe Gitlab::Saml::User, lib: true do expect(gl_user.identities.length).to eql 2 identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } expect(identities_as_hash).to match_array([{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, - { provider: 'saml', extern_uid: uid } + { provider: 'saml', extern_uid: uid } ]) end @@ -207,7 +207,7 @@ describe Gitlab::Saml::User, lib: true do expect(local_gl_user.identities.length).to eql 2 identities_as_hash = local_gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } expect(identities_as_hash).to match_array([{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, - { provider: 'saml', extern_uid: 'uid=user1,ou=People,dc=example' } + { provider: 'saml', extern_uid: 'uid=user1,ou=People,dc=example' } ]) end end diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 2611a0be92f..eaff27efd5d 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1263,7 +1263,7 @@ describe Ci::Build, :models do context 'when build has user' do let(:user_variables) do [{ key: 'GITLAB_USER_ID', value: user.id.to_s, public: true }, - { key: 'GITLAB_USER_EMAIL', value: user.email, public: true }] + { key: 'GITLAB_USER_EMAIL', value: user.email, public: true }] end before do diff --git a/spec/support/issuables_list_metadata_shared_examples.rb b/spec/support/issuables_list_metadata_shared_examples.rb index c61f3e05cea..4644c7a6b86 100644 --- a/spec/support/issuables_list_metadata_shared_examples.rb +++ b/spec/support/issuables_list_metadata_shared_examples.rb @@ -3,11 +3,12 @@ shared_examples 'issuables list meta-data' do |issuable_type, action = nil| @issuable_ids = [] 2.times do - issuable = if issuable_type == :issue - create(issuable_type, project: project) - else - create(issuable_type, title: FFaker::Lorem.sentence, source_project: project, source_branch: FFaker::Name.name) - end + issuable = + if issuable_type == :issue + create(issuable_type, project: project) + else + create(issuable_type, title: FFaker::Lorem.sentence, source_project: project, source_branch: FFaker::Name.name) + end @issuable_ids << issuable.id diff --git a/spec/support/login_helpers.rb b/spec/support/login_helpers.rb index b94ffa30736..dd4c7287655 100644 --- a/spec/support/login_helpers.rb +++ b/spec/support/login_helpers.rb @@ -15,11 +15,12 @@ module LoginHelpers # user = create(:user) # login_as(user) def login_as(user_or_role) - @user = if user_or_role.kind_of?(User) - user_or_role - else - create(user_or_role) - end + @user = + if user_or_role.kind_of?(User) + user_or_role + else + create(user_or_role) + end login_with(@user) end |