Skip to content

Commit 8d39fe4

Browse files
committed
fix: fix Rubocop Lint/StructNewOverride offense
1 parent d00fc94 commit 8d39fe4

File tree

5 files changed

+12
-16
lines changed

5 files changed

+12
-16
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +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: 8
10-
Lint/StructNewOverride:
11-
Exclude:
12-
- 'tests/units/test_command_line_error.rb'
13-
- 'tests/units/test_failed_error.rb'
14-
- 'tests/units/test_signaled_error.rb'
15-
- 'tests/units/test_timeout_error.rb'
169

1710
# Offense count: 2
1811
# Configuration parameters: AllowComments, AllowNil.

tests/units/test_command_line_error.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@
44

55
class TestCommandLineError < Test::Unit::TestCase
66
def test_initializer
7-
status = Struct.new(:to_s).new('pid 89784 exit 1')
7+
status = Struct.new { def to_s = 'pid 89784 exit 1' }.new
88
result = Git::CommandLineResult.new(%w[git status], status, 'stdout', 'stderr')
9-
109
error = Git::CommandLineError.new(result)
1110

1211
assert(error.is_a?(Git::Error))
1312
assert_equal(result, error.result)
1413
end
1514

1615
def test_to_s
17-
status = Struct.new(:to_s).new('pid 89784 exit 1')
16+
status = Struct.new { def to_s = 'pid 89784 exit 1' }.new
1817
result = Git::CommandLineResult.new(%w[git status], status, 'stdout', 'stderr')
1918

2019
error = Git::CommandLineError.new(result)

tests/units/test_failed_error.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class TestFailedError < Test::Unit::TestCase
66
def test_initializer
7-
status = Struct.new(:to_s).new('pid 89784 exit 1')
7+
status = Struct.new { def to_s = 'pid 89784 exit 1' }.new
88
result = Git::CommandLineResult.new(%w[git status], status, 'stdout', 'stderr')
99

1010
error = Git::FailedError.new(result)
@@ -13,7 +13,7 @@ def test_initializer
1313
end
1414

1515
def test_to_s
16-
status = Struct.new(:to_s).new('pid 89784 exit 1')
16+
status = Struct.new { def to_s = 'pid 89784 exit 1' }.new
1717
result = Git::CommandLineResult.new(%w[git status], status, 'stdout', 'stderr')
1818

1919
error = Git::FailedError.new(result)

tests/units/test_signaled_error.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
class TestSignaledError < Test::Unit::TestCase
66
def test_initializer
7-
status = Struct.new(:to_s).new('pid 65628 SIGKILL (signal 9)') # `kill -9 $$`
7+
# `kill -9 $$`
8+
status = Struct.new { def to_s = 'pid 65628 SIGKILL (signal 9)' }.new
89
result = Git::CommandLineResult.new(%w[git status], status, '', 'uncaught signal')
910

1011
error = Git::SignaledError.new(result)
@@ -13,7 +14,8 @@ def test_initializer
1314
end
1415

1516
def test_to_s
16-
status = Struct.new(:to_s).new('pid 65628 SIGKILL (signal 9)') # `kill -9 $$`
17+
# `kill -9 $$`
18+
status = Struct.new { def to_s = 'pid 65628 SIGKILL (signal 9)' }.new
1719
result = Git::CommandLineResult.new(%w[git status], status, '', 'uncaught signal')
1820

1921
error = Git::SignaledError.new(result)

tests/units/test_timeout_error.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
class TestTimeoutError < Test::Unit::TestCase
66
def test_initializer
7-
status = Struct.new(:to_s).new('pid 65628 SIGKILL (signal 9)') # `kill -9 $$`
7+
# `kill -9 $$`
8+
status = Struct.new { def to_s = 'pid 65628 SIGKILL (signal 9)' }.new
89
result = Git::CommandLineResult.new(%w[git status], status, 'stdout', 'stderr')
910
timeout_diration = 10
1011

@@ -14,7 +15,8 @@ def test_initializer
1415
end
1516

1617
def test_to_s
17-
status = Struct.new(:to_s).new('pid 65628 SIGKILL (signal 9)') # `kill -9 $$`
18+
# `kill -9 $$`
19+
status = Struct.new { def to_s = 'pid 65628 SIGKILL (signal 9)' }.new
1820
result = Git::CommandLineResult.new(%w[git status], status, 'stdout', 'Waiting...')
1921
timeout_duration = 10
2022

0 commit comments

Comments
 (0)