Skip to content

Support v4 of colored2 gem to make danger compatible with --enable-frozen-string-literal RUBYOPT#1513

Merged
manicmaniac merged 3 commits into
danger:masterfrom
eiskrenkov:bump-colored2
Apr 3, 2025
Merged

Support v4 of colored2 gem to make danger compatible with --enable-frozen-string-literal RUBYOPT#1513
manicmaniac merged 3 commits into
danger:masterfrom
eiskrenkov:bump-colored2

Conversation

@eiskrenkov

Copy link
Copy Markdown
Contributor

Hey all, first of all thank you for an amazing gem, love it!

In my team we just tried running Rails app using RUBYOPT=--enable-frozen-string-literal and got a green CI, except danger failed at the very end:

Results:
bundler: failed to load command: danger (/usr/local/bundle/bin/danger)
/usr/local/bundle/gems/colored2-3.1.2/lib/colored2/ascii_decorator.rb:67:in 'Colored2::AsciiDecorator#decorate': can't modify frozen String: "" (FrozenError)
	from /usr/local/bundle/gems/colored2-3.1.2/lib/colored2.rb:26:in 'String#surround_with_color'
	from /usr/local/bundle/gems/colored2-3.1.2/lib/colored2.rb:51:in 'block (3 levels) in String#included'
	from /usr/local/bundle/gems/danger-9.4.3/lib/danger/danger_core/dangerfile.rb:223:in 'block (2 levels) in Danger::Dangerfile#print_results'
	from /usr/local/bundle/gems/danger-9.4.3/lib/danger/danger_core/dangerfile.rb:219:in 'Array#each'
	from /usr/local/bundle/gems/danger-9.4.3/lib/danger/danger_core/dangerfile.rb:219:in 'block in Danger::Dangerfile#print_results'
	from /usr/local/bundle/gems/cork-0.3.0/lib/cork/board.rb:184:in 'Cork::Board#section'
	from /usr/local/bundle/gems/danger-9.4.3/lib/danger/danger_core/dangerfile.rb:218:in 'Danger::Dangerfile#print_results'
	from /usr/local/bundle/gems/danger-9.4.3/lib/danger/danger_core/dangerfile.rb:295:in 'Danger::Dangerfile#run'
	from /usr/local/bundle/gems/danger-9.4.3/lib/danger/danger_core/executor.rb:28:in 'Danger::Executor#run'
	from /usr/local/bundle/gems/danger-9.4.3/lib/danger/commands/runner.rb:73:in 'Danger::Runner#run'
	from /usr/local/bundle/gems/claide-1.1.0/lib/claide/command.rb:334:in 'CLAide::Command.run'
	from /usr/local/bundle/gems/danger-9.4.3/bin/danger:5:in '<top (required)>'
	from /usr/local/bundle/bin/danger:25:in 'Kernel#load'
	from /usr/local/bundle/bin/danger:25:in '<top (required)>'
	from /usr/local/lib/ruby/3.4.0/bundler/cli/exec.rb:59:in 'Kernel.load'
	from /usr/local/lib/ruby/3.4.0/bundler/cli/exec.rb:59:in 'Bundler::CLI::Exec#kernel_load'
	from /usr/local/lib/ruby/3.4.0/bundler/cli/exec.rb:23:in 'Bundler::CLI::Exec#run'
	from /usr/local/lib/ruby/3.4.0/bundler/cli.rb:452:in 'Bundler::CLI#exec'
	from /usr/local/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/command.rb:28:in 'Bundler::Thor::Command#run'
	from /usr/local/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in 'Bundler::Thor::Invocation#invoke_command'
	from /usr/local/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor.rb:538:in 'Bundler::Thor.dispatch'
	from /usr/local/lib/ruby/3.4.0/bundler/cli.rb:35:in 'Bundler::CLI.dispatch'
	from /usr/local/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/base.rb:584:in 'Bundler::Thor::Base::ClassMethods#start'
	from /usr/local/lib/ruby/3.4.0/bundler/cli.rb:29:in 'Bundler::CLI.start'
	from /usr/local/lib/ruby/gems/3.4.0/gems/bundler-2.6.2/exe/bundle:28:in 'block in <top (required)>'
	from /usr/local/lib/ruby/3.4.0/bundler/friendly_errors.rb:117:in 'Bundler.with_friendly_errors'
	from /usr/local/lib/ruby/gems/3.4.0/gems/bundler-2.6.2/exe/bundle:20:in '<top (required)>'
	from /usr/local/bin/bundle:25:in 'Kernel#load'
	from /usr/local/bin/bundle:25:in '<main>'

This was "fixed" by adding # frozen_string_literal: false in colored2 here, in version 4.0

@eiskrenkov eiskrenkov changed the title Bump colored2 to v4 Bump colored2 to v4 to make danger compatible with --enable-frozen-string-literal RUBYOPT Mar 21, 2025
Comment thread danger.gemspec Outdated
@eiskrenkov eiskrenkov changed the title Bump colored2 to v4 to make danger compatible with --enable-frozen-string-literal RUBYOPT Support v4 of colored2 gem to make danger compatible with --enable-frozen-string-literal RUBYOPT Apr 2, 2025
@eiskrenkov

Copy link
Copy Markdown
Contributor Author

Got it, @manicmaniac! Done

@manicmaniac manicmaniac left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution 🎉

@manicmaniac manicmaniac merged commit ad3cf77 into danger:master Apr 3, 2025
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

Successfully merging this pull request may close these issues.

2 participants