Skip to content

Conversation

@yahonda
Copy link
Collaborator

@yahonda yahonda commented Jan 9, 2021

This pull request enables Layout/SpaceBeforeBrackets cop, which has not been enabled at rails/rails repository. Actually, Rails code does not have any offenses detected by this cop then I have no plan to open a pull request to Rails repository to enable it.

This cop should work with RuboCop 1.8 which includes rubocop/rubocop#9291

$ bundle exec rubocop -a
Inspecting 71 files
...........................C...........................................

Offenses:

lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:495:39: C: [Corrected] Layout/SpaceBeforeBrackets: Remove the space before the opening brackets.
          @do_not_prefetch_primary_key [table_name] = do_not_prefetch = !has_primary_key?(table_name, owner, desc_table_name)
                                      ^

71 files inspected, 1 offense detected, 1 offense corrected

Tip: Based on detected gems, the following RuboCop extension libraries might be helpful:
  * rubocop-rake (http://github.com/rubocop-hq/rubocop-rake)
  * rubocop-rspec (http://github.com/rubocop-hq/rubocop-rspec)

You can opt out of this message by adding the following to your config (see https://docs.rubocop.org/rubocop/extensions.html#extension-suggestions for more options):
  AllCops:
    SuggestExtensions: false
$

Refer rubocop/rubocop#9305

This cop should work with RuboCop 1.8 which includes rubocop/rubocop#9291

```ruby
$ bundle exec rubocop -a
Inspecting 71 files
...........................C...........................................

Offenses:

lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:495:39: C: [Corrected] Layout/SpaceBeforeBrackets: Remove the space before the opening brackets.
          @do_not_prefetch_primary_key [table_name] = do_not_prefetch = !has_primary_key?(table_name, owner, desc_table_name)
                                      ^

71 files inspected, 1 offense detected, 1 offense corrected

Tip: Based on detected gems, the following RuboCop extension libraries might be helpful:
  * rubocop-rake (http://github.com/rubocop-hq/rubocop-rake)
  * rubocop-rspec (http://github.com/rubocop-hq/rubocop-rspec)

You can opt out of this message by adding the following to your config (see https://docs.rubocop.org/rubocop/extensions.html#extension-suggestions for more options):
  AllCops:
    SuggestExtensions: false
$
```
Refer rubocop/rubocop#9305
@yahonda yahonda requested a review from koic January 9, 2021 12:12
@yahonda
Copy link
Collaborator Author

yahonda commented Jan 12, 2021

@koic I did not explain the background for asking for a review for this pull request.
Usually, Oracle enhanced adapter .rubocop.yml follows that of Rails configuration but this one is kind of exception.

@koic
Copy link
Collaborator

koic commented Jan 12, 2021

TBH, I'm not sure if it's better to make an exception (enhanced) rule. I get it that Layout/SpaceBeforeBrackets cop doesn't registered an offense in Rails repo, but can you consider proposing to enable the cop to Rails repo for preparing the future?
Of course I don't have a strong opinion, so I think I could merge this without proposing it to Rails.

@yahonda
Copy link
Collaborator Author

yahonda commented Jan 12, 2021

Thanks for the review and comment. Yeah, let me consider to propose this cop to Rails repository.

@yahonda
Copy link
Collaborator Author

yahonda commented Jan 12, 2021

I'm going to merge this pull request.

@yahonda yahonda merged commit dee5ec0 into rsim:master Jan 12, 2021
@yahonda yahonda deleted the enable_layout_space_before_brackets_cop branch February 23, 2022 14:09
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