Commit 811e598f authored by Sean McGivern's avatar Sean McGivern
Browse files

Enable and autocorrect the CustomErrorClass cop

parent c8efec8d1471
......@@ -5,7 +5,7 @@ class Projects::BlobController < Projects::ApplicationController
include ActionView::Helpers::SanitizeHelper
# Raised when given an invalid file path
class InvalidPathError < StandardError; end
InvalidPathError = Class.new(StandardError)
before_action :require_non_empty_project, except: [:new, :create]
before_action :authorize_download_code!
......
......@@ -19,7 +19,7 @@ class Project < ActiveRecord::Base
extend Gitlab::ConfigHelper
class BoardLimitExceeded < StandardError; end
BoardLimitExceeded = Class.new(StandardError)
NUMBER_OF_PERMITTED_BOARDS = 1
UNKNOWN_IMPORT_URL = 'http://unknown.git'.freeze
......
......@@ -7,7 +7,7 @@ class ProjectWiki
'AsciiDoc' => :asciidoc
}.freeze unless defined?(MARKUPS)
class CouldNotCreateWikiError < StandardError; end
CouldNotCreateWikiError = Class.new(StandardError)
# Returns a string describing what went wrong after
# an operation fails.
......
class PipelineSerializer < BaseSerializer
class InvalidResourceError < StandardError; end
InvalidResourceError = Class.new(StandardError)
entity PipelineEntity
......
module Commits
class ChangeService < ::BaseService
class ValidationError < StandardError; end
class ChangeError < StandardError; end
ValidationError = Class.new(StandardError)
ChangeError = Class.new(StandardError)
def execute
@start_project = params[:start_project] || @project
......
module Files
class BaseService < ::BaseService
class ValidationError < StandardError; end
ValidationError = Class.new(StandardError)
def execute
@start_project = params[:start_project] || @project
......
module Files
class MultiService < Files::BaseService
class FileChangedError < StandardError; end
FileChangedError = Class.new(StandardError)
ACTIONS = %w[create update delete move].freeze
......
module Files
class UpdateService < Files::BaseService
class FileChangedError < StandardError; end
FileChangedError = Class.new(StandardError)
def commit
repository.update_file(current_user, @file_path, @file_content,
......
module Issues
class MoveService < Issues::BaseService
class MoveError < StandardError; end
MoveError = Class.new(StandardError)
def execute(issue, new_project)
@old_issue = issue
......
module MergeRequests
class ResolveService < MergeRequests::BaseService
class MissingFiles < Gitlab::Conflict::ResolutionError
end
MissingFiles = Class.new(Gitlab::Conflict::ResolutionError)
attr_accessor :conflicts, :rugged, :merge_index, :merge_request
......
......@@ -2,7 +2,7 @@ module Projects
class DestroyService < BaseService
include Gitlab::ShellAdapter
class DestroyError < StandardError; end
DestroyError = Class.new(StandardError)
DELETED_FLAG = '+deleted'.freeze
......
......@@ -2,7 +2,7 @@ module Projects
class ImportService < BaseService
include Gitlab::ShellAdapter
class Error < StandardError; end
Error = Class.new(StandardError)
def execute
add_repository_to_project unless project.gitlab_project_import?
......
......@@ -9,7 +9,7 @@
module Projects
class TransferService < BaseService
include Gitlab::ShellAdapter
class TransferError < StandardError; end
TransferError = Class.new(StandardError)
def execute(new_namespace)
if allowed_transfer?(current_user, project, new_namespace)
......
......@@ -160,13 +160,10 @@ def oauth2_bearer_token_error_handler
# Exceptions
#
class MissingTokenError < StandardError; end
class TokenNotFoundError < StandardError; end
class ExpiredError < StandardError; end
class RevokedError < StandardError; end
MissingTokenError = Class.new(StandardError)
TokenNotFoundError = Class.new(StandardError)
ExpiredError = Class.new(StandardError)
RevokedError = Class.new(StandardError)
class InsufficientScopeError < StandardError
attr_reader :scopes
......
module Bitbucket
module Error
class Unauthorized < StandardError
end
Unauthorized = Class.new(StandardError)
end
end
module Ci
class GitlabCiYamlProcessor
class ValidationError < StandardError; end
ValidationError = Class.new(StandardError)
include Gitlab::Ci::Config::Entry::LegacyValidationHelpers
......
......@@ -2,7 +2,7 @@
# file path string when combined in a request parameter
module ExtractsPath
# Raised when given an invalid file path
class InvalidPathError < StandardError; end
InvalidPathError = Class.new(StandardError)
# Given a string containing both a Git tree-ish, such as a branch or tag, and
# a filesystem path joined by forward slashes, attempts to separate the two.
......
......@@ -5,7 +5,7 @@
#
module Gitlab
module Access
class AccessDeniedError < StandardError; end
AccessDeniedError = Class.new(StandardError)
NO_ACCESS = 0
GUEST = 10
......
module Gitlab
module Auth
class MissingPersonalTokenError < StandardError; end
MissingPersonalTokenError = Class.new(StandardError)
SCOPES = [:api, :read_user].freeze
DEFAULT_SCOPES = [:api].freeze
......
......@@ -6,7 +6,7 @@ module Ci
module Build
module Artifacts
class Metadata
class ParserError < StandardError; end
ParserError = Class.new(StandardError)
VERSION_PATTERN = /^[\w\s]+(\d+\.\d+\.\d+)/
INVALID_PATH_PATTERN = %r{(^\.?\.?/)|(/\.?\.?/)}
......
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