Skip to content

Conversation

@faisal
Copy link
Contributor

@faisal faisal commented Dec 15, 2025

This is a fix to #548

This should actually fix the problem, in contrast to #551 which only works around it by limiting how far forward we pick up clog and flay versions. WE SHOULD ONLY TAKE ONE OF THESE CHANGES.

Details (courtesy of @neckhair): We freeze the DEFAULT_OPTIONS hash before sending it to Flog's initializer but Flog 4.9.0 then tries to modify the hash, resulting in #548. Following @zenspider's comments (see below), this PR patches the initializer to use a non-frozen clone of DEFAULT_OPTIONS instead.

Check list:

@faisal
Copy link
Contributor Author

faisal commented Dec 15, 2025

@etagwerker -- If we take this fix then we don't need #551, and vice versa. But we do need one of them (or a different fix entirely).

@faisal faisal force-pushed the dont_freeze_flog_DEFAULT_OPTIONS_hash branch from dbbaca2 to 9f3ceae Compare December 15, 2025 17:56
@faisal faisal changed the title Address regression introduced when running on Flog 4.9.0 OPTION 1: Address regression introduced when running on Flog 4.9.0 Dec 15, 2025
@jjulian
Copy link

jjulian commented Dec 17, 2025

My team ran into this issue, and after some review, I think this is the best fix. 👍

Copy link

@zenspider zenspider left a comment

Choose a reason for hiding this comment

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

added some critique to reduce the change needed... I'm prolly gonna dup on my end at some point since I think frozen hash literals are somewhere in our future

methods: true
}.freeze
}
# rubocop:enable Style/MutableConstant

Choose a reason for hiding this comment

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

why bother un-freezing?


def initialize
super(DEFAULT_OPTIONS)
super(DEFAULT_OPTIONS.clone)

Choose a reason for hiding this comment

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

#>>> {}.freeze.dup.frozen?
# => false
#>>> {}.freeze.clone.frozen?
# => true
#>>> {}.freeze.clone(freeze: false).frozen?
# => false

@zenspider
Copy link

My take: I don't agree with robocop that all literals should be frozen, but I don't have a problem with it in this specific case. But I think calling dup or clone(freeze: false) on the super line makes the most sense.

We freeze the DEFAULT_OPTIONS hash before sending it to Flog's initializer, but Flog 4.9.0 tries to modify it, causing multiple tests to fail.
This patch changes the initializer to clone DEFAULT_OPTIONS to a non-frozen hash.
@faisal faisal force-pushed the dont_freeze_flog_DEFAULT_OPTIONS_hash branch from 9f3ceae to 13d634b Compare December 22, 2025 11:36
@faisal
Copy link
Contributor Author

faisal commented Dec 22, 2025

Thank you for the investigation. I used clone(freeze: false) for clarity.

Copy link

@zenspider zenspider left a comment

Choose a reason for hiding this comment

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

ltgm

@etagwerker etagwerker merged commit 64e8a23 into whitesmith:main Dec 23, 2025
26 checks passed
@faisal faisal deleted the dont_freeze_flog_DEFAULT_OPTIONS_hash branch December 24, 2025 09:31
@y-yagi
Copy link
Contributor

y-yagi commented Jan 6, 2026

@etagwerker
Sorry to ping you, but do you have a plan to release a new gem including this change?
You changed the VERSION by c1d6750, but v4.12.0 hasn't been released to rubygems yet.

@faisal
Copy link
Contributor Author

faisal commented Jan 6, 2026

@etagwerker Sorry to ping you, but do you have a plan to release a new gem including this change? You changed the VERSION by c1d6750, but v4.12.0 hasn't been released to rubygems yet.

Not speaking for the project or for @etagwerker here:

We've been discussing how to proceed with releases. In the meantime, it looks like @zenspider changed how Flog deals with the options hash in recent Flog updates, and in my testing that got Rubycritic 4.11.0 working again. Are you able to update Flog?

@y-yagi
Copy link
Contributor

y-yagi commented Jan 6, 2026

Thanks for your information!

Are you able to update Flog?

I updated Flog, and rubycritic works again.

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.

5 participants