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

Enable and autocorrect the CustomErrorClass cop

parent c8efec8d1471
......@@ -6,7 +6,7 @@ module Entry
# Factory class responsible for fabricating entry objects.
#
class Factory
class InvalidFactory < StandardError; end
InvalidFactory = Class.new(StandardError)
def initialize(entry)
@entry = entry
......
......@@ -6,7 +6,7 @@ module Entry
# Base abstract class for each configuration entry node.
#
class Node
class InvalidError < StandardError; end
InvalidError = Class.new(StandardError)
attr_reader :config, :metadata
attr_accessor :key, :parent, :description
......
......@@ -2,7 +2,7 @@ module Gitlab
module Ci
class Config
class Loader
class FormatError < StandardError; end
FormatError = Class.new(StandardError)
def initialize(config)
@config = YAML.safe_load(config, [Symbol], [], true)
......
......@@ -4,8 +4,7 @@ class File
include Gitlab::Routing.url_helpers
include IconsHelper
class MissingResolution < ResolutionError
end
MissingResolution = Class.new(ResolutionError)
CONTEXT_LINES = 3
......
module Gitlab
module Conflict
class FileCollection
class ConflictSideMissing < StandardError
end
ConflictSideMissing = Class.new(StandardError)
attr_reader :merge_request, :our_commit, :their_commit
......
module Gitlab
module Conflict
class Parser
class UnresolvableError < StandardError
end
class UnmergeableFile < UnresolvableError
end
class UnsupportedEncoding < UnresolvableError
end
UnresolvableError = Class.new(StandardError)
UnmergeableFile = Class.new(UnresolvableError)
UnsupportedEncoding = Class.new(UnresolvableError)
# Recoverable errors - the conflict can be resolved in an editor, but not with
# sections.
class ParserError < StandardError
end
class UnexpectedDelimiter < ParserError
end
class MissingEndDelimiter < ParserError
end
ParserError = Class.new(StandardError)
UnexpectedDelimiter = Class.new(ParserError)
MissingEndDelimiter = Class.new(ParserError)
def parse(text, our_path:, their_path:, parent_file: nil)
raise UnmergeableFile if text.blank? # Typically a binary file
......
module Gitlab
module Conflict
class ResolutionError < StandardError
end
ResolutionError = Class.new(StandardError)
end
end
......@@ -4,19 +4,19 @@
# Inspired in great part by Discourse's Email::Receiver
module Gitlab
module Email
class ProcessingError < StandardError; end
class EmailUnparsableError < ProcessingError; end
class SentNotificationNotFoundError < ProcessingError; end
class ProjectNotFound < ProcessingError; end
class EmptyEmailError < ProcessingError; end
class AutoGeneratedEmailError < ProcessingError; end
class UserNotFoundError < ProcessingError; end
class UserBlockedError < ProcessingError; end
class UserNotAuthorizedError < ProcessingError; end
class NoteableNotFoundError < ProcessingError; end
class InvalidNoteError < ProcessingError; end
class InvalidIssueError < ProcessingError; end
class UnknownIncomingEmail < ProcessingError; end
ProcessingError = Class.new(StandardError)
EmailUnparsableError = Class.new(ProcessingError)
SentNotificationNotFoundError = Class.new(ProcessingError)
ProjectNotFound = Class.new(ProcessingError)
EmptyEmailError = Class.new(ProcessingError)
AutoGeneratedEmailError = Class.new(ProcessingError)
UserNotFoundError = Class.new(ProcessingError)
UserBlockedError = Class.new(ProcessingError)
UserNotAuthorizedError = Class.new(ProcessingError)
NoteableNotFoundError = Class.new(ProcessingError)
InvalidNoteError = Class.new(ProcessingError)
InvalidIssueError = Class.new(ProcessingError)
UnknownIncomingEmail = Class.new(ProcessingError)
class Receiver
def initialize(raw)
......
......@@ -2,7 +2,7 @@
module Gitlab
module Git
class Diff
class TimeoutError < StandardError; end
TimeoutError = Class.new(StandardError)
include Gitlab::Git::EncodingHelper
# Diff properties
......
......@@ -10,9 +10,9 @@ class Repository
SEARCH_CONTEXT_LINES = 3
class NoRepository < StandardError; end
class InvalidBlobName < StandardError; end
class InvalidRef < StandardError; end
NoRepository = Class.new(StandardError)
InvalidBlobName = Class.new(StandardError)
InvalidRef = Class.new(StandardError)
# Full path to repo
attr_reader :path
......
module Gitlab
module ImportExport
class Error < StandardError; end
Error = Class.new(StandardError)
end
end
......@@ -5,7 +5,7 @@
#
module Gitlab
module OAuth
class SignupDisabledError < StandardError; end
SignupDisabledError = Class.new(StandardError)
class User
attr_accessor :auth_hash, :gl_user
......
module Gitlab
class RouteMap
class FormatError < StandardError; end
FormatError = Class.new(StandardError)
def initialize(data)
begin
......
module Gitlab
module Serializer
class Pagination
class InvalidResourceError < StandardError; end
InvalidResourceError = Class.new(StandardError)
include ::API::Helpers::Pagination
def initialize(request, response)
......
......@@ -2,7 +2,7 @@
module Gitlab
class Shell
class Error < StandardError; end
Error = Class.new(StandardError)
KeyAdder = Struct.new(:io) do
def add_key(id, key)
......
......@@ -4,7 +4,7 @@ module Template
module Finders
class RepoTemplateFinder < BaseTemplateFinder
# Raised when file is not found
class FileNotFoundError < StandardError; end
FileNotFoundError = Class.new(StandardError)
def initialize(project, base_dir, extension, categories = {})
@categories = categories
......
module Gitlab
class UpdatePathError < StandardError; end
UpdatePathError = Class.new(StandardError)
end
module Mattermost
class ClientError < Mattermost::Error; end
ClientError = Class.new(Mattermost::Error)
class Client
attr_reader :user
......
module Mattermost
class Error < StandardError; end
Error = Class.new(StandardError)
end
......@@ -5,7 +5,7 @@ def message
end
end
class ConnectionError < Mattermost::Error; end
ConnectionError = Class.new(Mattermost::Error)
# This class' prime objective is to obtain a session token on a Mattermost
# instance with SSO configured where this GitLab instance is the provider.
......
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