Skip to content

Commit 57edc79

Browse files
committed
fix: fix Rubocop Naming/PredicatePrefix offense
1 parent d33f7a8 commit 57edc79

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +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: 3
10-
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
11-
# NamePrefix: is_, has_, have_, does_
12-
# ForbiddenPrefixes: is_, has_, have_, does_
13-
# AllowedMethods: is_a?
14-
# MethodDefinitionMacros: define_method, define_singleton_method
15-
Naming/PredicatePrefix:
16-
Exclude:
17-
- 'spec/**/*'
18-
- 'lib/git/base.rb'
19-
209
# Offense count: 2
2110
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
2211
# SupportedStyles: snake_case, normalcase, non_integer

lib/git/base.rb

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,23 +253,38 @@ def set_working(work_dir, check = true)
253253
end
254254

255255
# returns +true+ if the branch exists locally
256-
def is_local_branch?(branch)
256+
def local_branch?(branch)
257257
branch_names = branches.local.map(&:name)
258258
branch_names.include?(branch)
259259
end
260260

261+
def is_local_branch?(branch) # rubocop:disable Naming/PredicatePrefix
262+
Git.deprecated('Git::Base#is_local_branch? is deprecated. Use Git::Base#local_branch? instead.')
263+
local_branch?(branch)
264+
end
265+
261266
# returns +true+ if the branch exists remotely
262-
def is_remote_branch?(branch)
267+
def remote_branch?(branch)
263268
branch_names = branches.remote.map(&:name)
264269
branch_names.include?(branch)
265270
end
266271

272+
def is_remote_branch?(branch) # rubocop:disable Naming/PredicatePrefix
273+
Git.deprecated('Git::Base#is_remote_branch? is deprecated. Use Git::Base#remote_branch? instead.')
274+
remote_branch?(branch)
275+
end
276+
267277
# returns +true+ if the branch exists
268-
def is_branch?(branch)
278+
def branch?(branch)
269279
branch_names = branches.map(&:name)
270280
branch_names.include?(branch)
271281
end
272282

283+
def is_branch?(branch) # rubocop:disable Naming/PredicatePrefix
284+
Git.deprecated('Git::Base#is_branch? is deprecated. Use Git::Base#branch? instead.')
285+
branch?(branch)
286+
end
287+
273288
# this is a convenience method for accessing the class that wraps all the
274289
# actual 'git' forked system calls. At some point I hope to replace the Git::Lib
275290
# class with one that uses native methods or libgit C bindings

0 commit comments

Comments
 (0)