summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2024-08-21 13:45:13 +0000
committerGo MAEDA <maeda@farend.jp>2024-08-21 13:45:13 +0000
commitc2eb20e434e4d796c55703a2fcf002dbb9418a8d (patch)
treec0824cf8a025d888a18b7352b159643987718b5f
parent7cc62836b5d9b6994b12bc9513cf94bbb6a2ff82 (diff)
downloadredmine-c2eb20e434e4d796c55703a2fcf002dbb9418a8d.tar.gz
redmine-c2eb20e434e4d796c55703a2fcf002dbb9418a8d.zip
Fix RuboCop offense Style/ClassEqualityComparison (#39887).
git-svn-id: https://svn.redmine.org/redmine/trunk@22978 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--.rubocop_todo.yml7
-rw-r--r--app/models/principal.rb2
2 files changed, 1 insertions, 8 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 574a8daab..3c218d853 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -758,13 +758,6 @@ Style/CaseLikeIf:
Style/ClassAndModuleChildren:
Enabled: false
-# This cop supports unsafe autocorrection (--autocorrect-all).
-# Configuration parameters: AllowedMethods, AllowedPatterns.
-# AllowedMethods: ==, equal?, eql?
-Style/ClassEqualityComparison:
- Exclude:
- - 'app/models/principal.rb'
-
# This cop supports safe autocorrection (--autocorrect).
Style/ClassMethods:
Exclude:
diff --git a/app/models/principal.rb b/app/models/principal.rb
index 6ea19e60d..59aac3078 100644
--- a/app/models/principal.rb
+++ b/app/models/principal.rb
@@ -159,7 +159,7 @@ class Principal < ApplicationRecord
return -1 if principal.nil?
return nil unless principal.is_a?(Principal)
- if self.class.name == principal.class.name
+ if self.instance_of?(principal.class)
self.to_s.casecmp(principal.to_s)
else
# groups after users