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 RSpec/ExampleWording handle "it will" future tense #1752

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

jdufresne
Copy link
Contributor

@jdufresne jdufresne commented Dec 8, 2023

Fixes #1751

Replace this text with a summary of the changes in your PR. The more detailed you are, the better.


Before submitting the PR make sure the following are checked:

  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Updated documentation.
  • Added an entry to the CHANGELOG.md if the new code introduces user-observable changes.
  • The build (bundle exec rake) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).

If you have modified an existing cop's configuration options:

  • Set VersionChanged: "<<next>>" in config/default.yml.

Copy link
Member

@pirj pirj left a comment

Choose a reason for hiding this comment

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

Thank you!

config/default.yml Outdated Show resolved Hide resolved
@jdufresne jdufresne force-pushed the future-tense branch 2 times, most recently from cd92d7e to d346fd1 Compare December 8, 2023 23:47
@jdufresne
Copy link
Contributor Author

What is the project's preferred way to satisfy these offenses in the code? To me, breaking these small functions into smaller functions doesn't feel like a win.

lib/rubocop/cop/rspec/example_wording.rb:70:9: C: Metrics/MethodLength: Method has too many lines. [12/10]
        def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler ...
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/rubocop/rspec/wording.rb:20:7: C: Metrics/MethodLength: Method has too many lines. [12/10]
      def rewrite ...
      ^^^^^^^^^^^

@ydah
Copy link
Member

ydah commented Dec 10, 2023

What is the project's preferred way to satisfy these offenses in the code? To me, breaking these small functions into smaller functions doesn't feel like a win.

lib/rubocop/cop/rspec/example_wording.rb:70:9: C: Metrics/MethodLength: Method has too many lines. [12/10]
        def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler ...
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/rubocop/rspec/wording.rb:20:7: C: Metrics/MethodLength: Method has too many lines. [12/10]
      def rewrite ...
      ^^^^^^^^^^^

You may want to silence the offense with a disable comment. 
refs: https://docs.rubocop.org/rubocop/configuration.html#disabling-cops-within-source-code

@jdufresne
Copy link
Contributor Author

@ydah Thanks! I took this approach in the latest revision.

Copy link
Member

@ydah ydah left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you.

@bquorning bquorning merged commit e46837f into rubocop:master Dec 11, 2023
22 checks passed
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.

RSpec/ExampleWording: autocorrect "it will" (future tense) to the present tense
4 participants