diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/api/internal/kubernetes.rb | 9 | ||||
| -rw-r--r-- | lib/api/projects.rb | 4 | ||||
| -rw-r--r-- | lib/gitlab/auth.rb | 6 | ||||
| -rw-r--r-- | lib/gitlab/conflict/file.rb | 12 | ||||
| -rw-r--r-- | lib/gitlab/sql/pattern.rb | 10 | ||||
| -rw-r--r-- | lib/gitlab/usage/service_ping/payload_keys_processor.rb | 4 | ||||
| -rw-r--r-- | lib/service_ping/build_payload.rb | 4 | ||||
| -rw-r--r-- | lib/tasks/gitlab/cleanup.rake | 10 | ||||
| -rw-r--r-- | lib/tasks/gitlab/shell.rake | 10 |
9 files changed, 29 insertions, 40 deletions
diff --git a/lib/api/internal/kubernetes.rb b/lib/api/internal/kubernetes.rb index d06d1e9862a..c42b6fd8951 100644 --- a/lib/api/internal/kubernetes.rb +++ b/lib/api/internal/kubernetes.rb @@ -6,7 +6,6 @@ module API class Kubernetes < ::API::Base include Gitlab::Utils::StrongMemoize - feature_category :kubernetes_management before do check_feature_enabled authenticate_gitlab_kas_request! @@ -86,7 +85,7 @@ module API detail 'Retrieves agent info for the given token' end route_setting :authentication, cluster_agent_token_allowed: true - get '/agent_info', urgency: :low do + get '/agent_info', feature_category: :kubernetes_management, urgency: :low do project = agent.project status 200 @@ -104,7 +103,7 @@ module API detail 'Retrieves project info (if authorized)' end route_setting :authentication, cluster_agent_token_allowed: true - get '/project_info', urgency: :low do + get '/project_info', feature_category: :kubernetes_management, urgency: :low do project = find_project(params[:id]) not_found! unless agent_has_access_to_project?(project) @@ -127,7 +126,7 @@ module API requires :agent_id, type: Integer, desc: 'ID of the configured Agent' requires :agent_config, type: JSON, desc: 'Configuration for the Agent' end - post '/' do + post '/', feature_category: :kubernetes_management do agent = ::Clusters::Agent.find(params[:agent_id]) ::Clusters::Agents::RefreshAuthorizationService.new(agent, config: params[:agent_config]).execute @@ -150,7 +149,7 @@ module API optional :agent_users_using_ci_tunnel, type: Set[Integer], desc: 'A set of user ids that have interacted a CI Tunnel to' end end - post '/' do + post '/', feature_category: :kubernetes_management do increment_count_events increment_unique_events diff --git a/lib/api/projects.rb b/lib/api/projects.rb index fc898c30a71..66f7111f743 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -559,8 +559,8 @@ module API if result present_project user_project.reset, with: Entities::Project, current_user: current_user - else - render_api_error!("Project already forked", 409) if user_project.forked? + elsif user_project.forked? + render_api_error!("Project already forked", 409) end end diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb index c567df8e133..7e8f9c76dea 100644 --- a/lib/gitlab/auth.rb +++ b/lib/gitlab/auth.rb @@ -135,15 +135,13 @@ module Gitlab # it is important to reset the ban counter once the client has proven # they are not a 'bad guy'. rate_limiter.reset! - else + elsif rate_limiter.register_fail! # Register a login failure so that Rack::Attack can block the next # request from this IP if needed. # This returns true when the failures are over the threshold and the IP # is banned. - if rate_limiter.register_fail! - Gitlab::AppLogger.info "IP #{rate_limiter.ip} failed to login " \ + Gitlab::AppLogger.info "IP #{rate_limiter.ip} failed to login " \ "as #{login} but has been temporarily banned from Git auth" - end end end diff --git a/lib/gitlab/conflict/file.rb b/lib/gitlab/conflict/file.rb index d40a6323d4f..7bcbcf84a4e 100644 --- a/lib/gitlab/conflict/file.rb +++ b/lib/gitlab/conflict/file.rb @@ -236,14 +236,12 @@ module Gitlab else :modified_target_removed_source end + elsif our_path.present? && their_path.present? + :both_added + elsif their_path.blank? + diff_file.renamed_file? ? :renamed_same_file : :removed_target_renamed_source else - if our_path.present? && their_path.present? - :both_added - elsif their_path.blank? - diff_file.renamed_file? ? :renamed_same_file : :removed_target_renamed_source - else - :removed_source_renamed_target - end + :removed_source_renamed_target end end diff --git a/lib/gitlab/sql/pattern.rb b/lib/gitlab/sql/pattern.rb index d13ccde8576..cd5587bbaef 100644 --- a/lib/gitlab/sql/pattern.rb +++ b/lib/gitlab/sql/pattern.rb @@ -51,16 +51,14 @@ module Gitlab if words.any? words.map { |word| arel_column.matches(to_pattern(word, use_minimum_char_limit: use_minimum_char_limit)) }.reduce(:and) - else + elsif lower_exact_match # No words of at least 3 chars, but we can search for an exact # case insensitive match with the query as a whole - if lower_exact_match - Arel::Nodes::NamedFunction + Arel::Nodes::NamedFunction .new('LOWER', [arel_column]) .eq(query) - else - arel_column.matches(sanitize_sql_like(query)) - end + else + arel_column.matches(sanitize_sql_like(query)) end end diff --git a/lib/gitlab/usage/service_ping/payload_keys_processor.rb b/lib/gitlab/usage/service_ping/payload_keys_processor.rb index ea2043ffb83..89931d8c012 100644 --- a/lib/gitlab/usage/service_ping/payload_keys_processor.rb +++ b/lib/gitlab/usage/service_ping/payload_keys_processor.rb @@ -28,8 +28,8 @@ module Gitlab payload.map do |key, value| if has_metric_definition?(key, parents) parents.dup.append(key).join('.') - else - payload_keys(value, parents.dup << key) if value.is_a?(Hash) + elsif value.is_a?(Hash) + payload_keys(value, parents.dup << key) end end end diff --git a/lib/service_ping/build_payload.rb b/lib/service_ping/build_payload.rb index 3553b624ae0..0f19cd55a4c 100644 --- a/lib/service_ping/build_payload.rb +++ b/lib/service_ping/build_payload.rb @@ -20,8 +20,8 @@ module ServicePing if has_metric_definition?(key_path) include_metric?(key_path) - else - filtered_usage_data(node, parents.dup << label) if node.is_a?(Hash) + elsif node.is_a?(Hash) + filtered_usage_data(node, parents.dup << label) end end end diff --git a/lib/tasks/gitlab/cleanup.rake b/lib/tasks/gitlab/cleanup.rake index f908a7606fa..49d2d9fed03 100644 --- a/lib/tasks/gitlab/cleanup.rake +++ b/lib/tasks/gitlab/cleanup.rake @@ -15,13 +15,11 @@ namespace :gitlab do if Gitlab::Auth::Ldap::Access.allowed?(user) puts " [OK]".color(:green) + elsif block_flag + user.block! unless user.blocked? + puts " [BLOCKED]".color(:red) else - if block_flag - user.block! unless user.blocked? - puts " [BLOCKED]".color(:red) - else - puts " [NOT IN LDAP]".color(:yellow) - end + puts " [NOT IN LDAP]".color(:yellow) end end diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake index 59c87c2b01b..a5dcb23450f 100644 --- a/lib/tasks/gitlab/shell.rake +++ b/lib/tasks/gitlab/shell.rake @@ -53,13 +53,11 @@ namespace :gitlab do path_to_repo = project.repository.path_to_repo if File.exist?(path_to_repo) print '-' - else - if Gitlab::Shell.new.create_repository(project.repository_storage, + elsif Gitlab::Shell.new.create_repository(project.repository_storage, project.disk_path) - print '.' - else - print 'F' - end + print '.' + else + print 'F' end end end |
