Commit f74ca33a authored by Douwe Maan's avatar Douwe Maan

Enable Style/ClassCheck

parent f3a83dc8
......@@ -110,7 +110,7 @@ Style/ClassAndModuleChildren:
# Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.
Style/ClassCheck:
Enabled: false
Enabled: true
# Use self when defining module/class methods.
Style/ClassMethods:
......
......@@ -23,7 +23,7 @@ module IssuablesHelper
def issuable_json_path(issuable)
project = issuable.project
if issuable.kind_of?(MergeRequest)
if issuable.is_a?(MergeRequest)
namespace_project_merge_request_path(project.namespace, project, issuable.iid, :json)
else
namespace_project_issue_path(project.namespace, project, issuable.iid, :json)
......
......@@ -33,7 +33,7 @@ module NamespacesHelper
end
def namespace_icon(namespace, size = 40)
if namespace.kind_of?(Group)
if namespace.is_a?(Group)
group_icon(namespace)
else
avatar_icon(namespace.owner.email, size)
......
......@@ -257,7 +257,7 @@ module Ci
return unless regex
matches = text.scan(Regexp.new(regex)).last
matches = matches.last if matches.kind_of?(Array)
matches = matches.last if matches.is_a?(Array)
coverage = matches.gsub(/\d+(\.\d+)?/).first
if coverage.present?
......
......@@ -27,7 +27,7 @@ class Commit
class << self
def decorate(commits, project)
commits.map do |commit|
if commit.kind_of?(Commit)
if commit.is_a?(Commit)
commit
else
self.new(commit, project)
......
......@@ -356,7 +356,7 @@ module SystemNoteService
note: cross_reference_note_content(gfm_reference)
}
if noteable.kind_of?(Commit)
if noteable.is_a?(Commit)
note_options.merge!(noteable_type: 'Commit', commit_id: noteable.id)
else
note_options[:noteable] = noteable
......
......@@ -32,9 +32,9 @@ class FileSizeValidator < ActiveModel::EachValidator
end
def validate_each(record, attribute, value)
raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") unless value.kind_of? CarrierWave::Uploader::Base
raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") unless value.is_a? CarrierWave::Uploader::Base
value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String)
value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.is_a?(String)
CHECKS.each do |key, validity_check|
next unless check_value = options[key]
......
......@@ -5,7 +5,7 @@ module Gitlab
attr_reader :raw_changes
def initialize(changes)
@raw_changes = changes.kind_of?(String) ? changes.lines : changes
@raw_changes = changes.is_a?(String) ? changes.lines : changes
end
def each(&block)
......
......@@ -16,7 +16,7 @@ module LoginHelpers
# login_as(user)
def login_as(user_or_role)
@user =
if user_or_role.kind_of?(User)
if user_or_role.is_a?(User)
user_or_role
else
create(user_or_role)
......
......@@ -38,7 +38,7 @@ module AccessMatchers
end
def description_for(user, type)
if user.kind_of?(User)
if user.is_a?(User)
# User#inspect displays too much information for RSpec's descriptions
"be #{type} for the specified user"
else
......
......@@ -12,7 +12,7 @@
module Select2Helper
def select2(value, options = {})
raise ArgumentError, 'options must be a Hash' unless options.kind_of?(Hash)
raise ArgumentError, 'options must be a Hash' unless options.is_a?(Hash)
selector = options.fetch(:from)
......
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