Skip to content

Commit 41a9a50

Browse files
committed
Resolved Metrics/AbcSize: Assignment Branch Condition size for initialize is too high. [<5, 27, 1> 27.48/20]
1 parent 7d52b34 commit 41a9a50

File tree

2 files changed

+36
-20
lines changed

2 files changed

+36
-20
lines changed

_gem/lib/go_gem/rake_task.rb

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,26 +65,9 @@ def initialize(gem_name)
6565
yield(self) if block_given?
6666

6767
namespace(task_namespace) do
68-
desc "Run #{go_bin_path} test"
69-
task(:test) do
70-
within_target_dir do
71-
sh RakeTask.build_env_vars, "#{go_bin_path} test #{go_test_args} ./..."
72-
end
73-
end
74-
75-
desc "Run #{go_bin_path} test -race"
76-
task(:testrace) do
77-
within_target_dir do
78-
sh RakeTask.build_env_vars, "#{go_bin_path} test #{go_test_args} -race ./..."
79-
end
80-
end
81-
82-
desc "Run #{go_bin_path} fmt"
83-
task(:fmt) do
84-
within_target_dir do
85-
sh "#{go_bin_path} fmt ./..."
86-
end
87-
end
68+
define_go_test_task
69+
define_go_testrace_task
70+
define_go_fmt_task
8871
end
8972
end
9073

@@ -129,6 +112,33 @@ def self.build_env_vars
129112

130113
private
131114

115+
def define_go_test_task
116+
desc "Run #{go_bin_path} test"
117+
task(:test) do
118+
within_target_dir do
119+
sh RakeTask.build_env_vars, "#{go_bin_path} test #{go_test_args} ./..."
120+
end
121+
end
122+
end
123+
124+
def define_go_testrace_task
125+
desc "Run #{go_bin_path} test -race"
126+
task(:testrace) do
127+
within_target_dir do
128+
sh RakeTask.build_env_vars, "#{go_bin_path} test #{go_test_args} -race ./..."
129+
end
130+
end
131+
end
132+
133+
def define_go_fmt_task
134+
desc "Run #{go_bin_path} fmt"
135+
task(:fmt) do
136+
within_target_dir do
137+
sh "#{go_bin_path} fmt ./..."
138+
end
139+
end
140+
end
141+
132142
# @yield
133143
def within_target_dir
134144
Dir.chdir(target_dir) do # rubocop:disable Style/ExplicitBlockArgument

_gem/sig/go_gem/rake_task.rbs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ module GoGem
3232

3333
private
3434

35+
def define_go_test_task: () -> void
36+
37+
def define_go_testrace_task: () -> void
38+
39+
def define_go_fmt_task: () -> void
40+
3541
def within_target_dir: () { () -> void } -> void
3642

3743
def ext_dir: () -> String

0 commit comments

Comments
 (0)