Git Product home page Git Product logo

magic_frozen_string_literal's Issues

Needs ability to exclude directories

Many rubyists will install gems into a project local subdirectory like vendor/bundle with bundler. This is very useful when users don't have permissions to muck with system installed gems. Unfortunately this gem considers vendor/bundle as part of the application repo and attempts to add the comment to all gem files.

A solution could be to always ignore vendor/bundle, but a more general solution would be to allow an --exclude to be passed from the CLI.

A workaround is to, 1) rm -rf vendor/bundle 2) magic_frozen_string_literal 3) reinstall the local gems.

Feel free to categorize as wontfix. The code is simple enough that it might not be worth adding many features.

Immutable string literals will no longer be default in Ruby 3

Per this thread from 3 months ago:

I consider this for years. I REALLY like the idea but I am sure introducing this could cause HUGE compatibility issue, even bigger than Ruby 1.9. So I officially abandon making frozen-string-literals default (for Ruby3).
This does not mean we are going to remove the frozen-string-literal feature that can be specified by magic comments.
Matz.

Maybe the README should be updated given this.

Override newline code

Hi,

I use your magic_frozen_string_literal command on Windows and found that the command overrides newline code.

$ ruby -v
ruby 2.5.3p105 (2018-10-18 revision 65156) [x64-mingw32]

Before:
before

After:
after

I think that the command should not override newline code.

Should Rakefile, Procfile, etc. handling be added?

I noticed belatedly that Rakefile and other similarly-named files do not get handled. I wonder if adding support for such files is desirable. I think for Rakefile it may be, but likely not worthwhile for other files.

Performance comparisons or anecdotes?

I'm brainstorming about how to test performance of my apps before and after using the gem with Ruby 2.3. Has anyone done this and would like to share the results?

files with a #! (shebang) at the top are corrupted by the magic comment

We had a couple files with a .rb extension that had a #! (shebang) at the top that were corrupted by the magic comment. It would probably be best if those files didn't have the .rb extension, but they did. The calling code was running them without a ruby in front. Without the #! at the top, they stopped working.

frozen_string_literal broke assets pipeline in *.js.erb

I have a js.erb file like this

//= require xxxx
var xxx = <%= XXX.to_json.html_safe %>

after running magic_frozen_string_literal, it become

<%# frozen_string_literal: true %>
//= require xxxx
var xxx = <%= XXX.to_json.html_safe %>

But the first line <%# frozen_string_literal: true %> seems to make //= require xxxx not working

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.