Description
Since Ruby 2.3 there has been an option to freeze all string literals. This improves both performance by eliminating unnecessary allocations for duplicate strings and reliability by preventing mutation of values.
A comment can be added to the top of each Ruby file to freeze all string literals:
# frozen_string_literal: true
The RuboCop linting tool can be used to used to ensure that this is present for all files. Additional checks can be used to identity and remove existing calls to `.freeze` that are redundant once this comment is added.
Attachments
Issue Links
- links to