Skip to content

Commit e9d9c4f

Browse files
committed
fix: fix Rubocop Naming/AccessorMethodName offense
1 parent c7946b0 commit e9d9c4f

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

.rubocop_todo.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +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: 12
10-
# Configuration parameters: AllowedMethods, AllowedPatterns.
11-
Metrics/PerceivedComplexity:
12-
Max: 22
13-
14-
# Offense count: 1
15-
Naming/AccessorMethodName:
16-
Exclude:
17-
- 'lib/git/object.rb'
18-
199
# Offense count: 1
2010
# Configuration parameters: ForbiddenDelimiters.
2111
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
@@ -110,3 +100,8 @@ Metrics/CyclomaticComplexity:
110100
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
111101
Metrics/MethodLength:
112102
Max: 51
103+
104+
# Offense count: 12
105+
# Configuration parameters: AllowedMethods, AllowedPatterns.
106+
Metrics/PerceivedComplexity:
107+
Max: 22

lib/git/object.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def initialize(base, sha, init = nil)
159159
@message = nil
160160
return unless init
161161

162-
set_commit(init)
162+
from_data(init)
163163
end
164164

165165
def message
@@ -211,7 +211,12 @@ def diff_parent
211211
diff(parent)
212212
end
213213

214-
def set_commit(data)
214+
def set_commit(data) # rubocop:disable Naming/AccessorMethodName
215+
Git.deprecation('Git::Object::Commit#set_commit is deprecated. Use #from_data instead.')
216+
from_data(data)
217+
end
218+
219+
def from_data(data)
215220
@sha ||= data['sha']
216221
@committer = Git::Author.new(data['committer'])
217222
@author = Git::Author.new(data['author'])
@@ -231,7 +236,7 @@ def check_commit
231236
return if @tree
232237

233238
data = @base.lib.cat_file_commit(@objectish)
234-
set_commit(data)
239+
from_data(data)
235240
end
236241
end
237242

0 commit comments

Comments
 (0)