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