Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

block output doesn't work with frozen string literal #16

Closed
andrcuns opened this issue Mar 4, 2020 · 3 comments
Closed

block output doesn't work with frozen string literal #16

andrcuns opened this issue Mar 4, 2020 · 3 comments

Comments

@andrcuns
Copy link

andrcuns commented Mar 4, 2020

Looks like the internal logic tries to change existing string when # frozen_string_literal: true is present and output_style is set to block. Did not try to dig deeper, but here is the stacktrace:

Traceback (most recent call last):
	5: from .../.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/simplecov-0.18.5/lib/simplecov/defaults.rb:27:in `block in <top (required)>'
	4: from .../.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/simplecov-0.18.5/lib/simplecov.rb:202:in `at_exit_behavior'
	3: from .../.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/simplecov-0.18.5/lib/simplecov.rb:214:in `run_exit_tasks!'
	2: from .../.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/simplecov-0.18.5/lib/simplecov/configuration.rb:196:in `block in at_exit'
	1: from .../.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/simplecov-0.18.5/lib/simplecov/result.rb:49:in `format!'
.../.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/simplecov-console-0.7.0/lib/simplecov-console.rb:79:in `format': can't modify frozen String (FrozenError)
@chetan
Copy link
Owner

chetan commented Mar 4, 2020

Where are you enabling this flag? It sounds like you are using it from the cli via --enable=frozen_strong_literal or some other global flag, correct?

@andrcuns
Copy link
Author

andrcuns commented Mar 4, 2020

Pretty much in every ruby file both in my personal as well as work related projects I use the frozen string literal comment on top of the ruby files which is enforced by rubocop rule.
I would imagine many projects do that as it might become the default behavior in future ruby versions.

@chetan
Copy link
Owner

chetan commented Mar 4, 2020

Fixed in 0.7.1

@chetan chetan closed this as completed Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants