summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-02-22 11:25:50 -0600
committerDouwe Maan <douwe@selenight.nl>2017-02-23 09:32:22 -0600
commitf74ca33a32fbf810b377cf480e996fb383d8f400 (patch)
treeb49de25e505da3ee7ca44493c4934b1add025130
parentf3a83dc8fc377357291fd25d333f5b5a3616fae9 (diff)
downloadgitlab-ce-f74ca33a32fbf810b377cf480e996fb383d8f400.tar.gz
Enable Style/ClassCheck
-rw-r--r--.rubocop.yml2
-rw-r--r--app/helpers/issuables_helper.rb2
-rw-r--r--app/helpers/namespaces_helper.rb2
-rw-r--r--app/models/ci/build.rb2
-rw-r--r--app/models/commit.rb2
-rw-r--r--app/services/system_note_service.rb2
-rw-r--r--lib/file_size_validator.rb4
-rw-r--r--lib/gitlab/changes_list.rb2
-rw-r--r--spec/support/login_helpers.rb2
-rw-r--r--spec/support/matchers/access_matchers.rb2
-rw-r--r--spec/support/select2_helper.rb2
11 files changed, 12 insertions, 12 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index 2ce32ca5002..af26abec80f 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -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:
diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb
index b65edb4049c..715072290c6 100644
--- a/app/helpers/issuables_helper.rb
+++ b/app/helpers/issuables_helper.rb
@@ -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)
diff --git a/app/helpers/namespaces_helper.rb b/app/helpers/namespaces_helper.rb
index dc5ae8edbb2..2e3a15bc1b9 100644
--- a/app/helpers/namespaces_helper.rb
+++ b/app/helpers/namespaces_helper.rb
@@ -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)
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index de9fe352059..7e21eb22e27 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -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?
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 8f6179f183e..dc971e710ff 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -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)
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb
index 5cb4401d69d..55b548a12f9 100644
--- a/app/services/system_note_service.rb
+++ b/app/services/system_note_service.rb
@@ -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
diff --git a/lib/file_size_validator.rb b/lib/file_size_validator.rb
index 440dd44ece7..eb19ab45ac3 100644
--- a/lib/file_size_validator.rb
+++ b/lib/file_size_validator.rb
@@ -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]
diff --git a/lib/gitlab/changes_list.rb b/lib/gitlab/changes_list.rb
index 95308aca95f..5b32fca00a4 100644
--- a/lib/gitlab/changes_list.rb
+++ b/lib/gitlab/changes_list.rb
@@ -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)
diff --git a/spec/support/login_helpers.rb b/spec/support/login_helpers.rb
index dd4c7287655..9ffb00be0b8 100644
--- a/spec/support/login_helpers.rb
+++ b/spec/support/login_helpers.rb
@@ -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)
diff --git a/spec/support/matchers/access_matchers.rb b/spec/support/matchers/access_matchers.rb
index ceddb656596..7d238850520 100644
--- a/spec/support/matchers/access_matchers.rb
+++ b/spec/support/matchers/access_matchers.rb
@@ -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
diff --git a/spec/support/select2_helper.rb b/spec/support/select2_helper.rb
index d30cc8ff9f2..0d526045012 100644
--- a/spec/support/select2_helper.rb
+++ b/spec/support/select2_helper.rb
@@ -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)