Skip to content

Commit 54c4a3b

Browse files
committed
fix: fix Rubocop Lint/UselessConstantScoping offense
1 parent 4372a20 commit 54c4a3b

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +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: 1
10-
Lint/UselessConstantScoping:
11-
Exclude:
12-
- 'lib/git/branch.rb'
13-
149
# Offense count: 68
1510
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
1611
Metrics/AbcSize:

lib/git/branch.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,6 @@ def to_s
9393
@full
9494
end
9595

96-
private
97-
98-
def check_if_create
99-
@base.lib.branch_new(@name)
100-
rescue StandardError
101-
nil
102-
end
103-
104-
def determine_current
105-
@base.lib.branch_current == @name
106-
end
107-
10896
BRANCH_NAME_REGEXP = %r{
10997
^
11098
# Optional 'refs/remotes/' at the beggining to specify a remote tracking branch
@@ -116,6 +104,8 @@ def determine_current
116104
$
117105
}x
118106

107+
private
108+
119109
# Given a full branch name return an Array containing the remote and branch names.
120110
#
121111
# Removes 'remotes' from the beggining of the name (if present).
@@ -143,5 +133,15 @@ def parse_name(name)
143133
branch_name = match[:branch_name]
144134
[remote, branch_name]
145135
end
136+
137+
def check_if_create
138+
@base.lib.branch_new(@name)
139+
rescue StandardError
140+
nil
141+
end
142+
143+
def determine_current
144+
@base.lib.branch_current == @name
145+
end
146146
end
147147
end

0 commit comments

Comments
 (0)