Skip to content

Commit cf89db2

Browse files
committed
Fix warning with frozen string
1 parent 4ee06e6 commit cf89db2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

app/models/commit.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen-string-literal: true
2+
13
class Commit < ApplicationRecord
24
has_many :contributions, dependent: :destroy
35
has_many :contributors, through: :contributions
@@ -196,7 +198,7 @@ def cache_diff(repo)
196198
# git show, and is an expensive operation. So, we do this only for those
197199
# commits where this is needed, and cache the result in the database.
198200
def extract_changelog
199-
changelog = ''
201+
changelog = +''
200202
in_changelog = false
201203
diff.each_line do |line|
202204
if line =~ /^diff --git/

test/models/commit_test.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen-string-literal: true
2+
13
require 'test_helper'
24
require 'ostruct'
35

@@ -22,7 +24,7 @@ def test_import
2224
tcomm = Time.current
2325
tauth = 1.day.ago
2426

25-
message = <<-MSG.strip_heredoc
27+
message = +<<-MSG.strip_heredoc
2628
\u{1f4a3}
2729
2830
We are relying on hash inequality in tests
@@ -32,8 +34,8 @@ def test_import
3234
sha1 = "b5ed79468289c15a685a82694dcf1adf773c91d#{i}"
3335
rugged_commit = OpenStruct.new
3436
rugged_commit.oid = sha1
35-
rugged_commit.author = {name: 'Juanjo', email: '[email protected]', time: tauth}
36-
rugged_commit.committer = {name: 'David', email: '[email protected]', time: tcomm}
37+
rugged_commit.author = {name: +'Juanjo', email: +'[email protected]', time: tauth}
38+
rugged_commit.committer = {name: +'David', email: +'[email protected]', time: tcomm}
3739
rugged_commit.message = message
3840
rugged_commit.parents = parents
3941

0 commit comments

Comments
 (0)