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

Explicitly Disable Style/Encoding (support RuboCop >= 0.50.0) #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tonyta
Copy link

@tonyta tonyta commented Oct 25, 2017

As of RuboCop v0.50.0, the Style/Encoding cop is now enabled by default and configured to remove the encoding magic-comment. This will strip the comment from the top of db/schema.rb, deviating from the expected behavior.

Disabling this cop will ensure that fix_db_schema_conflicts will output consistently regardless of RuboCop version.

This change was tested locally using RuboCop 0.49.1. 0.50.0, and 0.51.0.

Before:

$ bundle exec rspec
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Randomized with seed 34080
..F

Failures:

  1) Fix DB Schema Conflicts generates a sorted schema with no extra spacing
     Failure/Error: expect(generated).to eq(expected)
     
       expected: "# encoding: UTF-8\n"
            got: "\n"
     
       (compared using ==)
     
       Diff:
       @@ -1,2 +1 @@
       -# encoding: UTF-8
       
     # ./spec/integration/integration_spec.rb:16:in `block (3 levels) in <top (required)>'
     # ./spec/integration/integration_spec.rb:13:in `each'
     # ./spec/integration/integration_spec.rb:13:in `block (2 levels) in <top (required)>'

Finished in 3.56 seconds (files took 0.11922 seconds to load)
3 examples, 1 failure

Failed examples:

rspec ./spec/integration/integration_spec.rb:7 # Fix DB Schema Conflicts generates a sorted schema with no extra spacing

Randomized with seed 34080

After:

$ bundle exec rspec
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Randomized with seed 64151
...

Finished in 4.14 seconds (files took 0.16542 seconds to load)
3 examples, 0 failures

Randomized with seed 64151

As of RuboCop v0.50.0, the Style/Encoding cop is now enabled by default
and configured to remove the encoding magic-comment. This deviates from
the expected behavior in specs and changes the behavior of this gem.

Disabling this cop will ensure that fix_db_schema_conflicts will output
consistently regardless of RuboCop version.

Change in RuboCop:
  rubocop/rubocop#4445
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.

1 participant