Skip to content

Commit d33f7a8

Browse files
committed
fix: fix Rubocop Naming/PredicateMethod offense
1 parent b4297a5 commit d33f7a8

File tree

4 files changed

+8
-19
lines changed

4 files changed

+8
-19
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 5
10-
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods.
11-
# AllowedMethods: call
12-
Naming/PredicateMethod:
13-
Exclude:
14-
- 'lib/git/branch.rb'
15-
- 'lib/git/lib.rb'
16-
- 'tests/units/test_command_line.rb'
17-
189
# Offense count: 3
1910
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
2011
# NamePrefix: is_, has_, have_, does_

lib/git/branch.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def delete
5656
@base.lib.branch_delete(@name)
5757
end
5858

59-
def current
60-
determine_current
59+
def current # rubocop:disable Naming/PredicateMethod
60+
@base.lib.branch_current == @name
6161
end
6262

6363
def contains?(commit)
@@ -139,9 +139,5 @@ def check_if_create
139139
rescue StandardError
140140
nil
141141
end
142-
143-
def determine_current
144-
@base.lib.branch_current == @name
145-
end
146142
end
147143
end

lib/git/lib.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,9 @@ def meets_required_version?
15121512
(current_command_version <=> required_command_version) >= 0
15131513
end
15141514

1515-
def self.warn_if_old_command(lib)
1515+
def self.warn_if_old_command(lib) # rubocop:disable Naming/PredicateMethod
1516+
Git::Deprecation.warn('Git::Lib#warn_if_old_command is deprecated. Use meets_required_version?.')
1517+
15161518
return true if @version_checked
15171519

15181520
@version_checked = true

tests/units/test_command_line.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ def err_writer
4242
nil
4343
end
4444

45-
def normalize
45+
def normalize # rubocop:disable Naming/PredicateMethod
4646
false
4747
end
4848

49-
def chomp
49+
def chomp # rubocop:disable Naming/PredicateMethod
5050
false
5151
end
5252

53-
def merge
53+
def merge # rubocop:disable Naming/PredicateMethod
5454
false
5555
end
5656

0 commit comments

Comments
 (0)