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 Error: The Style/TrailingCommaInLiteral cop no longer exists #27

Closed
wants to merge 1 commit into from

Conversation

zoras
Copy link
Contributor

@zoras zoras commented Mar 16, 2018

  1. Disable Encoding and FrozenStringLiteralComment as it is enabled by default in newer versions of Rubocop

  2. Fix Error: The Style/TrailingCommaInLiteral cop no longer exists. Please use Style/TrailingCommaInArrayLiteral and/or Style/TrailingCommaInHashLiteral instead.
    (obsolete configuration found in ../ruby/2.5.0/lib/ruby/gems/2.5.0/gems/fix-db-schema-conflicts-3.0.2/.rubocop_schema.49.yml, please update it)

…y default in newer versions of Rubocop

2. Fix Error: The `Style/TrailingCommaInLiteral` cop no longer exists. Please use `Style/TrailingCommaInArrayLiteral` and/or `Style/TrailingCommaInHashLiteral` instead.
(obsolete configuration found in ../ruby/2.5.0/lib/ruby/gems/2.5.0/gems/fix-db-schema-conflicts-3.0.2/.rubocop_schema.49.yml, please update it)
@Tolsto
Copy link

Tolsto commented Mar 16, 2018

This will break all Rubocops where 0.49 =< VERSION < 0.53. I suggest to bump the required Rubocop version to 0.49, rename the current rubocop_schema.49.yml to rubocop_schema.yml and commit your proposed Rubocop schema as rubocop_schema.53.yml.

@Tolsto
Copy link

Tolsto commented Mar 20, 2018

@jakeonrails Is this repository/project still maintained?

@zoras
Copy link
Contributor Author

zoras commented Mar 28, 2018

@Tolsto I'm not sure about rebasing and overriding the original yml file. My concern is that it will break compatibility with rubocop versions older than 0.49.0 for this gem.

Again, the changes in this PR are spread over 3 different released versions of rubocop, so adding separate versioned rubocop_schema.x.yml files may not be the long term solution either.

  1. Style/FrozenStringLiteralComment enabled by default for Ruby 2.3+ in v0.37.1 [Fix #2739] FrozenStringLiteralComment when_needed adds a comment to all files targeted to Ruby 2.3+ rubocop/rubocop#2802
  2. Style/Encoding enabled by default in v0.50.0 Enable Style/Encoding by default rubocop/rubocop#4445
  3. Splitting Style/TrailingCommaInLiteral into Style/TrailingCommaInArrayLiteral & Style/TrailingCommaInHashLiteral in v0.53.0 [Fix #3394] Separate Array & Hash Literal Comma configuration rubocop/rubocop#5307

However, as removal of Style/TrailingCommaInLiteral breaks the gem, it can be certainly specified in separate .rubocop_schema.53.yml. I'm wondering if rubocop's cops can be specified/enabled wrt rubocop version itself.

Also, not sure what/how @jakeonrails plans on managing these issues in future?

@Tolsto
Copy link

Tolsto commented Mar 28, 2018

Rubocop is a fast moving project and 0.49 was released on 2017/05/24. It doesn't really make sense to support Rubocop versions older than 1 year since virtually all projects can easily migrate to newer Rubocop versions by using the todo file workflow. In my opinion, this gem shouldn't support any Rubocop version older than 6 months. But this is a decision that's up to @jakeonrails

@davidlibrera
Copy link

davidlibrera commented Apr 9, 2018

I don't think that this gem should run rubocop. I run rubocop in my project if I want.
In my opinion this gem should not care about rubocop.

Reading tests I supposed that rubocop will run only to ensure test passing. (Spec has a here document with an example of schema.rb, so running rubocop on schema.rb could ensure than the expected file and the generate file are identical)

@rosscooperman
Copy link
Contributor

We should probably close this since there are 2 open PRs that address the same issue but in a way that won't break 0.49 =< VERSION < 0.53.

@Gusarov2k
Copy link

Add to your .rubocop.yml
`
inherit_mode:
merge:
Exclude:

AllCops:
Exclude:
- vendor/bundle/**/*
`

@bak1an
Copy link
Collaborator

bak1an commented Mar 5, 2019

Thanks @zoras

Closing in favor of #33

@bak1an bak1an closed this Mar 5, 2019
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

6 participants