Rubocop fails with undefined StringIO

Posted . Visible to the public.

If your rubocop run fails with a stack like

rubocop-1.61.0/lib/rubocop/server/socket_reader.rb:36:in `ensure in read!': undefined method `string' for nil:NilClass (NoMethodError)
        Cache.stderr_path.write(stderr.string)
                                      ^^^^^^^
...
rubocop-1.61.0/lib/rubocop/server/socket_reader.rb:27:in `read!': uninitialized constant RuboCop::Server::SocketReader::StringIO (NameError)

        stderr = StringIO.new
                 ^^^^^^^^

this card might help you.

In old versions of rubocop stringio was used but not required. This was fixed in v1.68.0 Show archive.org snapshot .

Upgrading makandra-rubocop to v15.0.0 will lift rubocop from 1.61 to 1.70.

Warning

after an upgrade, make sure to terminate all running rubocop server processes (ps aux | grep rubocop, then kill the pid)

Profile picture of Daniel Straßner
Daniel Straßner
Last edit
Daniel Straßner
License
Source code in this card is licensed under the MIT License.
Posted by Daniel Straßner to makandra dev (2025-12-16 10:20)