わからない。
以下、rubocop 実行時に遭遇したケースを強引に再現。
別途 rspec 実行時にも遭遇したので、rubocop 固有の問題ではないはず。
Alpine Linux 3.7 (musl) のスレッドスタックサイズが glibc と比べて小さい(80k)事で、Ruby 2.4.3 では発生しないが Ruby 2.5.0 では発生する、という実行環境固有の問題と考えるべきだろうか。
ruby:2.5.0-alpine3.7
[docker-for-mac]% docker container run --rm -it ruby:2.5.0-alpine3.7 sh
# gem install rubocop
# cat <<\RUBY > sample.rb
require 'rails_helper'
RSpec.describe MyClass do
describe '#my_method' do
subject { MyClass.new.my_method(arg) }
context 'when ...' do
context 'when ...' do
context 'when ...' do
context 'when ...' do
let(:arg) { create(:arg, :trait, attr: x) }
it 'should be ...' do
YourClass.new(
x: X.x(
y: Y.y(
z: Z.z(
a: A.a(
b: B.b
)
)
)
)
)
end
end
end
end
end
end
end
RUBY
# rubocop sample.rb
Inspecting 1 file
0 files inspected, no offenses detected
Traceback (most recent call last):
264: from /usr/local/bundle/bin/rubocop:23:in `<main>'
263: from /usr/local/bundle/bin/rubocop:23:in `load'
262: from /usr/local/bundle/gems/rubocop-0.52.1/bin/rubocop:12:in `<top (required)>'
261: from /usr/local/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
260: from /usr/local/bundle/gems/rubocop-0.52.1/bin/rubocop:13:in `block in <top (required)>'
259: from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/cli.rb:38:in `run'
258: from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/cli.rb:78:in `execute_runners'
257: from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/cli.rb:150:in `execute_runner'
... 252 levels...
4: from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/ast/node.rb:172:in `each'
3: from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/ast/node.rb:174:in `block in each_child_node'
2: from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/cop/variable_force.rb:102:in `block in process_children'
1: from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/cop/variable_force.rb:369:in `scanned_node?'
/usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/cop/variable_force.rb:369:in `any?': stack level too deep (SystemStackError)
ruby:2.5.0-stretch
[docker-for-mac]% docker container run --rm -it ruby:2.5.0-stretch sh
# gem install rubocop
# cat <<\RUBY > sample.rb
require 'rails_helper'
RSpec.describe MyClass do
describe '#my_method' do
subject { MyClass.new.my_method(arg) }
context 'when ...' do
context 'when ...' do
context 'when ...' do
context 'when ...' do
let(:arg) { create(:arg, :trait, attr: x) }
it 'should be ...' do
YourClass.new(
x: X.x(
y: Y.y(
z: Z.z(
a: A.a(
b: B.b
)
)
)
)
)
end
end
end
end
end
end
end
RUBY
# rubocop sample.rb
Inspecting 1 file
.
1 file inspected, no offenses detected
ruby:2.4.3-alpine3.7
[docker-for-mac]% docker container run --rm -it ruby:2.4.3-alpine3.7 sh
# gem install rubocop
# cat <<\RUBY > sample.rb
require 'rails_helper'
RSpec.describe MyClass do
describe '#my_method' do
subject { MyClass.new.my_method(arg) }
context 'when ...' do
context 'when ...' do
context 'when ...' do
context 'when ...' do
let(:arg) { create(:arg, :trait, attr: x) }
it 'should be ...' do
YourClass.new(
x: X.x(
y: Y.y(
z: Z.z(
a: A.a(
b: B.b
)
)
)
)
)
end
end
end
end
end
end
end
RUBY
# rubocop sample.rb
Inspecting 1 file
.
1 file inspected, no offenses detected
--- 2.4/alpine3.7/Dockerfile 2017-12-28 20:34:43.000000000 +0900
+++ 2.5/alpine3.7/Dockerfile 2017-12-28 20:34:43.000000000 +0900
@@ -7,9 +7,9 @@
echo 'update: --no-document'; \
} >> /usr/local/etc/gemrc
-ENV RUBY_MAJOR 2.4
-ENV RUBY_VERSION 2.4.3
-ENV RUBY_DOWNLOAD_SHA256 23677d40bf3b7621ba64593c978df40b1e026d8653c74a0599f0ead78ed92b51
+ENV RUBY_MAJOR 2.5
+ENV RUBY_VERSION 2.5.0
+ENV RUBY_DOWNLOAD_SHA256 1da0afed833a0dab94075221a615c14487b05d0c407f991c8080d576d985b49b
ENV RUBYGEMS_VERSION 2.7.4
ENV BUNDLER_VERSION 1.16.1
gcc:6.3
[docker-for-mac]% docker container run --rm -it gcc:6.3 bash
# curl -s https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.0.tar.xz | tar -xJf -
# cd ruby-2.5.0
# ./configure && make && make install
# gem install rubocop
# cat <<\RUBY > sample.rb
require 'rails_helper'
RSpec.describe MyClass do
describe '#my_method' do
subject { MyClass.new.my_method(arg) }
context 'when ...' do
context 'when ...' do
context 'when ...' do
context 'when ...' do
let(:arg) { create(:arg, :trait, attr: x) }
it 'should be ...' do
YourClass.new(
x: X.x(
y: Y.y(
z: Z.z(
a: A.a(
b: B.b
)
)
)
)
)
end
end
end
end
end
end
end
RUBY
# rubocop sample.rb
Inspecting 1 file
.
1 file inspected, no offenses detected
gcc:6.4
[docker-for-mac]% docker container run --rm -it gcc:6.4 bash
# curl -s https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.0.tar.xz | tar -xJf -
# cd ruby-2.5.0
# ./configure && make && make install
# gem install rubocop
# cat <<\RUBY > sample.rb
require 'rails_helper'
RSpec.describe MyClass do
describe '#my_method' do
subject { MyClass.new.my_method(arg) }
context 'when ...' do
context 'when ...' do
context 'when ...' do
context 'when ...' do
let(:arg) { create(:arg, :trait, attr: x) }
it 'should be ...' do
YourClass.new(
x: X.x(
y: Y.y(
z: Z.z(
a: A.a(
b: B.b
)
)
)
)
)
end
end
end
end
end
end
end
RUBY
# rubocop sample.rb
Inspecting 1 file
.
1 file inspected, no offenses detected