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

Fix an error for Naming/InclusiveLanguage string with invalid byte sequence in UTF-8 #10610

Merged
merged 1 commit into from May 7, 2022

Conversation

ydah
Copy link
Member

@ydah ydah commented May 7, 2022

This fixes an issue when CheckStrings: true and string with invalid byte sequence in UTF-8
would cause an error in the Naming/InclusiveLanguage cop.

In fact, when we ran RuboCop on this repository's own code as follows, an error occurred.

rubocop.yml

Naming/InclusiveLanguage:
+  CheckStrings: true
  FlaggedTerms:
    behaviour:
      Suggestions:
        - behavior
    offence:
      Suggestions:
        - offense
  Exclude:
    - lib/rubocop/cop/naming/inclusive_language.rb

command

bundle exec rubocop --only Naming/InclusiveLanguage

result

6 errors occurred:
An error occurred while Naming/InclusiveLanguage cop was inspecting /Users/ydah/rubocop/spec/rubocop/cop/layout/end_of_line_spec.rb.
An error occurred while Naming/InclusiveLanguage cop was inspecting /Users/ydah/rubocop/spec/rubocop/cop/lint/percent_string_array_spec.rb.
An error occurred while Naming/InclusiveLanguage cop was inspecting /Users/ydah/rubocop/spec/rubocop/cop/lint/percent_symbol_array_spec.rb.
An error occurred while Naming/InclusiveLanguage cop was inspecting /Users/ydah/rubocop/spec/rubocop/cop/lint/syntax_spec.rb.
An error occurred while Naming/InclusiveLanguage cop was inspecting /Users/ydah/rubocop/spec/rubocop/path_util_spec.rb.
An error occurred while Naming/InclusiveLanguage cop was inspecting /Users/ydah/rubocop/spec/rubocop/result_cache_spec.rb.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
https://github.com/rubocop/rubocop/issues

Mention the following information in the issue report:
1.29.0 (using Parser 3.1.2.0, rubocop-ast 1.17.0, running on ruby 3.1.0 x86_64-darwin21)

Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • 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.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

@ydah ydah marked this pull request as ready for review May 7, 2022 15:51
@koic koic merged commit 0866f79 into rubocop:master May 7, 2022
@koic
Copy link
Member

koic commented May 7, 2022

Good catch!

@ydah ydah deleted the fix_inclusive_language branch May 7, 2022 22:07
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.

None yet

2 participants