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

Enforcing frozen string literals with pragma comment. #428

Merged
merged 3 commits into from
Jan 4, 2018

Conversation

pat
Copy link
Contributor

@pat pat commented Jan 4, 2018

A slightly different take on #354 - instead of relying on dependencies to be frozen-string-literal friendly, this PR adds the pragma comment to all Ruby files, and then string literals are frozen for Ruby versions that support it.

This ensures the test suite can remain green while supporting frozen string literals, separate of whether dependencies do. If/when dependencies are all supporting frozen string literals, then perhaps the env flag (as noted in the Travis CI config in #354) can be set as well.

#! /usr/bin/env ruby
# coding: utf-8
# frozen_string_literal: true
# warn_indent: true
Copy link
Owner

Choose a reason for hiding this comment

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

warn_ident? warn_past_scope?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I missed these unexpected changes - seems Pragmater got confused. I'll fix that up.

@@ -27,8 +33,6 @@ def associate_locations(code)

def test_associate
ast, associations = associate(<<-END)
#!/usr/bin/env ruby
Copy link
Owner

Choose a reason for hiding this comment

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

You shouldn't remove these. They're testing the behavior of the comment associator, and this code is not ever run.

@whitequark whitequark merged commit 4fc80b5 into whitequark:master Jan 4, 2018
@whitequark
Copy link
Owner

Thanks for the PR!

@pat
Copy link
Contributor Author

pat commented Jan 4, 2018

No worries - thanks for merging :)

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