-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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 #7064] Multiline when then cop #7114
Conversation
57c53a4
to
ede08cf
Compare
Only |
There's a PR to add a cop named `MultilineWhenThen`, which detects `then` in multiline `when`. rubocop/rubocop#7114 It refers to `MultilineIfThen` cop, which is based on `no-then` rule here. So this commit adds `when` description and example to `no-then` rule, making newly added `MultilineWhenThen` cop based on the style guide. FYI, the discussion about this feature is here: rubocop/rubocop#7064
There's a PR to add a cop named `MultilineWhenThen`, which detects `then` in multiline `when`. rubocop/rubocop#7114 It refers to `MultilineIfThen` cop, which is based on `no-then` rule here. So this commit adds `when` description and example to `no-then` rule, making newly added `MultilineWhenThen` cop based on the style guide. FYI, the discussion about this feature is here: rubocop/rubocop#7064
e04bb76
to
9aaaddd
Compare
There's a PR to add a cop named `MultilineWhenThen`, which detects `then` in multiline `when`. rubocop/rubocop#7114 It refers to `MultilineIfThen` cop, which is based on `no-then` rule here. So this commit adds `when` description and example to `no-then` rule, making newly added `MultilineWhenThen` cop based on the style guide. FYI, the discussion about this feature is here: rubocop/rubocop#7064
There's a PR to add a cop named `MultilineWhenThen`, which detects `then` in multiline `when`. rubocop/rubocop#7114 It refers to `MultilineIfThen` cop, which is based on `no-then` rule here. So this commit adds `when` description and example to `no-then` rule, making newly added `MultilineWhenThen` cop based on the style guide. FYI, the discussion about this feature is here: rubocop/rubocop#7064
There's a PR to add a cop named `MultilineWhenThen`, which detects `then` in multiline `when`. rubocop/rubocop#7114 It refers to `MultilineIfThen` cop, which is based on `no-then` rule here. So this commit adds `when` description and example to `no-then` rule, making newly added `MultilineWhenThen` cop based on the style guide. FYI, the discussion about this feature is here: rubocop/rubocop#7064
be6fae2
to
6734aca
Compare
This PR detects problems that have been reviewed several times as follows. - rubocop#7114 (comment) - rubocop#7140 (comment) And this PR fixes existing descriptions found using this added spec. The following is an example of detection. ```console % bundle exec rspec spec/project_spec.rb:30 Run options: include {:focus=>true, :locations=>{"./spec/project_spec.rb"=>[30]}} Randomized with seed 57903 F Failures: 1) RuboCop Project default configuration file have a period at EOL of description Failure/Error: expect(description).to match(/\.\z/) expected "Checks for flip-flops" to match /\.\z/ Diff: @@ -1,2 +1,2 @@ -/\.\z/ +"Checks for flip-flops" # ./spec/project_spec.rb:34:in `block (4 levels) in <top (required)>' # ./spec/project_spec.rb:31:in `each' # ./spec/project_spec.rb:31:in `block (3 levels) in <top (required)>' Finished in 0.07499 seconds (files took 1.61 seconds to load) 1 example, 1 failure Failed examples: rspec ./spec/project_spec.rb:30 # RuboCop Project default configuration file have a period at EOL of description Randomized with seed 57903 ```
6734aca
to
afa3a6c
Compare
This PR detects problems that have been reviewed several times as follows. - #7114 (comment) - #7140 (comment) And this PR fixes existing descriptions found using this added spec. The following is an example of detection. ```console % bundle exec rspec spec/project_spec.rb:30 Run options: include {:focus=>true, :locations=>{"./spec/project_spec.rb"=>[30]}} Randomized with seed 57903 F Failures: 1) RuboCop Project default configuration file have a period at EOL of description Failure/Error: expect(description).to match(/\.\z/) expected "Checks for flip-flops" to match /\.\z/ Diff: @@ -1,2 +1,2 @@ -/\.\z/ +"Checks for flip-flops" # ./spec/project_spec.rb:34:in `block (4 levels) in <top (required)>' # ./spec/project_spec.rb:31:in `each' # ./spec/project_spec.rb:31:in `block (3 levels) in <top (required)>' Finished in 0.07499 seconds (files took 1.61 seconds to load) 1 example, 1 failure Failed examples: rspec ./spec/project_spec.rb:30 # RuboCop Project default configuration file have a period at EOL of description Randomized with seed 57903 ```
afa3a6c
to
491262e
Compare
5100c15
to
858c23d
Compare
@okuramasafumi The specs are currently failing. You'll also have to rebase on top of |
@bbatsov Thanks, I'll fix and rebase it when I have time (hopefully next week). |
This cop check the use of the `then` keyword in multi-line when statements. Its name comes from `Style/MultilineIfThen` cop. This cop is enabled by default because `Style/MultilineIfThen` cop is enabled by default.
858c23d
to
1452d41
Compare
@bbatsov I rebased on master and fixed the failing specs. I also added some specs so that the cop is more robust. |
Thanks! |
This cop check the use of the
then
keyword in multi-line whenstatements.
Its name comes from
Style/MultilineIfThen
cop.This cop is enabled by default because
Style/MultilineIfThen
cop isenabled by default.
Related issue is #7064
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).and description in grammatically correct, complete sentences.
bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.