A story that failed using "bundle exec rubocop -a"

■ Situation Make a simple fix for staff migration Conflict occurs Update your local main branch git merge Do the main branch and resolve the conflict I got some errors in "bundle exec rubocop", so I ran "bundle exec rubocop -a" I do "bundle exec rubocop", but the following error is not resolved

console


# bundle exec rubocop

app/models/user.rb:47:3: C: Rails/UniqueValidationWithoutIndex: Uniqueness validation should be with a unique index.
  validates :email, presence: true, length: { maximum: 70 }, ...

However, I haven't touched this file this time, so I don't know the cause.

As a result, we verified and solved it by the following method.

・ Test execution of main branch just in case → 0 errors ・ Therefore, it is predicted that "bundle exec rubocop -a" may be doing something. ・ As a result of checking, it was found that the description (comment) that ignores the rubocop warning was automatically deleted.

I returned the deleted description and got 0 errors!

Regarding the description that ignores the rubocop warning I think the following will be helpful. (Maybe it's old?)

https://qiita.com/tbpgr/items/a9000c5c6fa92a46c206

Recommended Posts

A story that failed using "bundle exec rubocop -a"
Why you need a bundle exec
A story that separates business logic and model
A story that took time to establish a connection
The story that docker had a hard time
A story about making a Builder that inherits the Builder
A story about creating a service that proposes improvements to a website using a machine learning API
A story that failed when connecting to CloudSQL by running Sprint-boot with kubernetes (GKE)
A small story that is sometimes useful in Maven
A story that ended up taking a break when using the Linked List with a light feeling