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

Make Rails/UnknownEnv cop aware of Rails.env == 'unknown_env' #156

Merged
merged 1 commit into from
Nov 16, 2019

Conversation

pocke
Copy link
Contributor

@pocke pocke commented Nov 15, 2019

Rails/UnknownEnv is not aware of Rails.env == 'unknown_env' style comparetion.

# It has a typo, but the cop does not detect any offense for the code!
if Rails.env == 'proudction'
end

This pull request adds the check to Rails/UnknownEnv cop.

Note

This pull request also change the offense message.
I removed ? from the environment name in the message.

- Unknown environment `proudction?`. Did you mean `production?`?
+ Unknown environment `proudction`. Did you mean `production`?

Because production? is not an environment name.


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

@pocke pocke force-pushed the Rails/UnknownEnv-more-detection branch from e1477ff to 23caaa0 Compare November 15, 2019 12:43
@koic koic merged commit 72c0fdd into rubocop:master Nov 16, 2019
@koic
Copy link
Member

koic commented Nov 16, 2019

Thanks!

@pocke pocke deleted the Rails/UnknownEnv-more-detection branch November 17, 2019 04:34
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