Commit c874a481 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'lib-api-frozen-string-enable' into 'master'

Enable frozen string in lib/api and lib/backup

See merge request gitlab-org/gitlab-ce!22005
parents 299a927a 3836d691
---
title: Enable frozen string in lib/api and lib/backup
merge_request:
author: gfyoung
type: performance
# frozen_string_literal: true
module API
class AccessRequests < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class API < Grape::API
include APIGuard
......
# frozen_string_literal: true
# Guard API with OAuth 2.0 Access Token
require 'rack/oauth2'
......
# frozen_string_literal: true
module API
# External applications API
class Applications < Grape::API
......
# frozen_string_literal: true
module API
class Avatar < Grape::API
resource :avatar do
......
# frozen_string_literal: true
module API
class AwardEmoji < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class Badges < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class Boards < Grape::API
include BoardsResponses
......
# frozen_string_literal: true
module API
module BoardsResponses
extend ActiveSupport::Concern
......
# frozen_string_literal: true
require 'mime/types'
module API
......
# frozen_string_literal: true
module API
class BroadcastMessages < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class CircuitBreakers < Grape::API
before { authenticated_as_admin! }
......
# frozen_string_literal: true
require 'mime/types'
module API
......
# frozen_string_literal: true
require 'mime/types'
module API
......
# frozen_string_literal: true
module API
module CustomAttributesEndpoints
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module API
class DeployKeys < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
# Deployments RESTful API endpoints
class Deployments < Grape::API
......
# frozen_string_literal: true
module API
class Discussions < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
module Entities
class WikiPageBasic < Grape::Entity
......
# frozen_string_literal: true
module API
# Environments RESTfull API endpoints
class Environments < Grape::API
......
# frozen_string_literal: true
module API
class Events < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class Features < Grape::API
before { authenticated_as_admin! }
......
# frozen_string_literal: true
module API
class Files < Grape::API
FILE_ENDPOINT_REQUIREMENTS = API::PROJECT_ENDPOINT_REQUIREMENTS.merge(file_path: API::NO_SLASH_URL_PART_REGEX)
......
# frozen_string_literal: true
module API
class GroupBoards < Grape::API
include BoardsResponses
......
# frozen_string_literal: true
module API
class GroupMilestones < Grape::API
include MilestoneResponses
......
# frozen_string_literal: true
module API
class GroupVariables < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class Groups < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
module Helpers
include Gitlab::Utils
......@@ -381,9 +383,10 @@ module API
# lifted from https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb#L60
trace = exception.backtrace
message = "\n#{exception.class} (#{exception.message}):\n"
message = ["\n#{exception.class} (#{exception.message}):\n"]
message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code)
message << " " << trace.join("\n ")
message = message.join
API.logger.add Logger::FATAL, message
......
# frozen_string_literal: true
module API
module Helpers
module BadgesHelpers
......
# frozen_string_literal: true
module API
module Helpers
module CommonHelpers
......
# frozen_string_literal: true
module API
module Helpers
module CustomAttributes
......
# frozen_string_literal: true
module API
module Helpers
module CustomValidators
......
# frozen_string_literal: true
module API
module Helpers
module HeadersHelpers
......
# frozen_string_literal: true
module API
module Helpers
module InternalHelpers
......
# frozen_string_literal: true
# rubocop:disable GitlabSecurity/PublicSend
module API
......
# frozen_string_literal: true
module API
module Helpers
module NotesHelpers
......
# frozen_string_literal: true
module API
module Helpers
module Pagination
......
# frozen_string_literal: true
module API
module Helpers
module ProjectSnapshotsHelpers
......
# frozen_string_literal: true
module API
module Helpers
module ProjectsHelpers
......
# frozen_string_literal: true
module API
module Helpers
module RelatedResourcesHelpers
......
# frozen_string_literal: true
module API
module Helpers
module Runner
......
# frozen_string_literal: true
module API
# Internal access API
class Internal < Grape::API
......
# frozen_string_literal: true
module API
class Issues < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class JobArtifacts < Grape::API
before { authenticate_non_get! }
......
# frozen_string_literal: true
module API
class Jobs < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
# Keys API
class Keys < Grape::API
......
# frozen_string_literal: true
module API
class Labels < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class Lint < Grape::API
namespace :ci do
......
# frozen_string_literal: true
module API
class Markdown < Grape::API
params do
......
# frozen_string_literal: true
module API
class Members < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
# MergeRequestDiff API
class MergeRequestDiffs < Grape::API
......
# frozen_string_literal: true
module API
class MergeRequests < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
module MilestoneResponses
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module API
class Namespaces < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class Notes < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
# notification_settings API
class NotificationSettings < Grape::API
......
# frozen_string_literal: true
module API
class PagesDomains < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
# Concern for declare pagination params.
#
......
# frozen_string_literal: true
module API
class PipelineSchedules < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class Pipelines < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class ProjectExport < Grape::API
before do
......
# frozen_string_literal: true
module API
class ProjectHooks < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class ProjectImport < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class ProjectMilestones < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class ProjectSnapshots < Grape::API
helpers ::API::Helpers::ProjectSnapshotsHelpers
......
# frozen_string_literal: true
module API
class ProjectSnippets < Grape::API
include PaginationParams
......
# frozen_string_literal: true
require_dependency 'declarative_policy'
module API
......
# frozen_string_literal: true
module API
module ProjectsRelationBuilder
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module API
class ProtectedBranches < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class ProtectedTags < Grape::API
include PaginationParams
......
# frozen_string_literal: true
require 'mime/types'
module API
......
# frozen_string_literal: true
module API
class Runner < Grape::API
helpers ::API::Helpers::Runner
......
# frozen_string_literal: true
module API
class Runners < Grape::API
include PaginationParams
......
# frozen_string_literal: true
# Encapsulate a scope used for authorization, such as `api`, or `read_user`
module API
class Scope
......
# frozen_string_literal: true
module API
class Search < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class Settings < Grape::API
before { authenticated_as_admin! }
......
# frozen_string_literal: true
require 'sidekiq/api'
module API
......
# frozen_string_literal: true
module API
# Snippets API
class Snippets < Grape::API
......
# frozen_string_literal: true
module API
class Subscriptions < Grape::API
before { authenticate! }
......
# frozen_string_literal: true
module API
class SystemHooks < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class Tags < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class Templates < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
module TimeTrackingEndpoints
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module API
class Todos < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class Triggers < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class Users < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class Variables < Grape::API
include PaginationParams
......
# frozen_string_literal: true
module API
class Version < Grape::API
before { authenticate! }
......
# frozen_string_literal: true
module API
class Wikis < Grape::API
helpers do
......
# frozen_string_literal: true
require 'backup/files'
module Backup
......
# frozen_string_literal: true
require 'backup/files'
module Backup
......
# frozen_string_literal: true
require 'yaml'
module Backup
......
# frozen_string_literal: true
require 'open3'
require_relative 'helper'
......
# frozen_string_literal: true
module Backup
module Helper
def access_denied_error(path)
......
# frozen_string_literal: true
require 'backup/files'
module Backup
......
# frozen_string_literal: true
module Backup
class Manager
ARCHIVES_TO_BACKUP = %w[uploads builds artifacts pages lfs registry].freeze
......
# frozen_string_literal: true
require 'backup/files'
module Backup
......
# frozen_string_literal: true
require 'backup/files'
module Backup
......
# frozen_string_literal: true
require 'yaml'
module Backup
......
# frozen_string_literal: true
require 'backup/files'
module Backup
......
......@@ -11,10 +11,6 @@ describe Backup::Manager do
allow(progress).to receive(:puts)
allow(progress).to receive(:print)
allow_any_instance_of(String).to receive(:color) do |string, _color|
string
end
@old_progress = $progress # rubocop:disable Style/GlobalVars
$progress = progress # rubocop:disable Style/GlobalVars
end
......
......@@ -11,10 +11,6 @@ describe Backup::Repository do
allow(FileUtils).to receive(:mkdir_p).and_return(true)
allow(FileUtils).to receive(:mv).and_return(true)
allow_any_instance_of(String).to receive(:color) do |string, _color|
string
end
allow_any_instance_of(described_class).to receive(:progress).and_return(progress)
end
......
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