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

Handle undefined DidYouMean constants in UnknownEnv cop #297

Merged
merged 1 commit into from
Jul 21, 2020
Merged

Handle undefined DidYouMean constants in UnknownEnv cop #297

merged 1 commit into from
Jul 21, 2020

Conversation

taylorthurlow
Copy link
Contributor

The rubocop gem itself has a closed issue here:

rubocop/rubocop#7979

It details the fact that the DidYouMean constants are sometimes not
loaded even though the DidYouMean gem has been a part of Ruby since 2.3,
and should be required by default. The rubocop gem maintainers
determined this to be an upstream issue.

Here are some other relevant links to issues/PRs:

ruby/did_you_mean#117
rubocop/rubocop#8143

My solution is mostly a band-aid fix to handle this problem until it is
fixed - use the DidYouMean spell checker if it is defined, otherwise
skip spell checking if it is not.

The changes to the specs might be considered "questionable", as I also added a
defined? check to the spec. This should also fix the issue noted in the
associated spec file about DidYouMean being undefined in CI. While this message
is more or less correct, the issue is obviously, based on this PR, not specific
to JRuby or CI.


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.
  • If this is a new cop, consider making a corresponding update to the Rails Style Guide.
  • 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.

@taylorthurlow taylorthurlow marked this pull request as ready for review July 20, 2020 18:12
CHANGELOG.md Outdated Show resolved Hide resolved
@taylorthurlow
Copy link
Contributor Author

@koic Applied your review edit, thanks for doing that.

Copy link
Member

@koic koic left a comment

Choose a reason for hiding this comment

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

This looks good to me. Can you squash your commits into one?

The rubocop gem itself has a closed issue here:

rubocop/rubocop#7979

It details the fact that the DidYouMean constants are sometimes not
loaded even though the DidYouMean gem has been a part of Ruby since 2.3,
and should be required by default. The rubocop gem maintainers
determined this to be an upstream issue.

Here are some other relevant links to issues/PRs:

ruby/did_you_mean#117
rubocop/rubocop#8143

My solution is mostly a band-aid fix to handle this problem until it is
fixed - use the DidYouMean spell checker if it is defined, otherwise
skip spell checking if it is not.
@taylorthurlow
Copy link
Contributor Author

@koic Squashed 👍

@koic koic merged commit fe1754f into rubocop:master Jul 21, 2020
@koic
Copy link
Member

koic commented Jul 21, 2020

Thanks!

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