-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
Rails/UnknownEnv
support Rails.env.local?
by default for Rails 7.1
#893
Labels
feature request
Request for new functionality
Comments
Here are the steps to reproduce. git clone https://github.com/yahonda/sampleapp.git
cd sampleapp
bundle
bundle exec rubocop $ bundle exec rubocop
Inspecting 31 files
.........C.....................
Offenses:
app/models/user.rb:2:16: C: Rails/UnknownEnv: Unknown environment local.
if Rails.env.local?
^^^^^^
31 files inspected, 1 offense detected
$ How $ bin/rails c
Loading development environment (Rails 7.1.0.alpha)
irb(main):001:0> Rails.env.local?
=> true
irb(main):002:0> Rails.env
=> "development"
irb(main):003:0> |
FYI Rails.env.local? is a kind of syntax sugar for $ RAILS_ENV=test bin/rails c
Loading test environment (Rails 7.1.0.alpha)
irb(main):001:0> Rails.env.local?
=> true
irb(main):002:0> Rails.env
=> "test"
irb(main):003:0> exit $ RAILS_ENV=production bin/rails c
Loading production environment (Rails 7.1.0.alpha)
irb(main):001:0> Rails.env.local?
=> false
irb(main):002:0> Rails.env
=> "production"
irb(main):003:0> exit
$ |
(I think you meant to write |
Right. updated the previous comment. |
ghiculescu
added a commit
to ghiculescu/rubocop-rails
that referenced
this issue
Dec 23, 2022
9 tasks
ghiculescu
added a commit
to ghiculescu/rubocop-rails
that referenced
this issue
Dec 23, 2022
…nEnv` from Rails 7.1 onward. Fixes rubocop#893
ghiculescu
added a commit
to ghiculescu/rubocop-rails
that referenced
this issue
Dec 23, 2022
…nEnv` from Rails 7.1 onward. Fixes rubocop#893
sambostock
added a commit
to sambostock/rubocop-rails
that referenced
this issue
Jan 6, 2023
ghiculescu
added a commit
to ghiculescu/rubocop-rails
that referenced
this issue
Jan 6, 2023
…nEnv` from Rails 7.1 onward. Fixes rubocop#893
ghiculescu
added a commit
to ghiculescu/rubocop-rails
that referenced
this issue
Jan 6, 2023
…nEnv` from Rails 7.1 onward. Fixes rubocop#893
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
rails/rails#46786 has been merged to Rails main.
When this feature is released in Rails 7.1, I prefer
Rails/UnknownEnv
cop allowsRails.env.local?
by default.Describe the solution you'd like
Rails/UnknownEnv
cop allowsRails.env.local?
by default for Rails 7.1.Describe alternatives you've considered
Update
.rubocop.yml
manually as rubocop/rubocop#4956 (comment) does.Additional context
It may be a little bit early to open this feature request because Rails 7.1 is not released.
The text was updated successfully, but these errors were encountered: