-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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 rubocop config and warnings #15503
Conversation
@@ -2,7 +2,8 @@ require: | |||
- rubocop-rails | |||
|
|||
AllCops: | |||
TargetRubyVersion: 2.4 | |||
TargetRubyVersion: 2.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The minimum supported version of Mastodon is currently 2.5.
@@ -2,7 +2,8 @@ require: | |||
- rubocop-rails | |||
|
|||
AllCops: | |||
TargetRubyVersion: 2.4 | |||
TargetRubyVersion: 2.5 | |||
NewCops: disable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New cops can be falsely detected, so I thought it wouldn't be necessary to actively enable them. The current unconfigured state is pending and the new cop remains disabled.
By setting it explicitly, the warning that prompts you to set the new cop will not be displayed.
@errors = {} | ||
@original_field = attributes | ||
string_limit = account.local? ? 255 : 2047 | ||
super( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same thing can be achieved by giving hash to the initializer of ActiveModelSerializers::Model
.
app/models/account.rb
Outdated
@verified_at = Time.now.utc | ||
@attributes['verified_at'] = @verified_at | ||
self.verified_at = Time.now.utc | ||
@original_field['verified_at'] = @verified_at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to maintain this process to propagate the changes to the fields of account. I changed the name of the instance variable because it was a little confusing.
@@ -1,6 +1,6 @@ | |||
# frozen_string_literal: true | |||
|
|||
class PublicFeed < Feed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The methods defined in the Feed weren't used at all, so it didn't seem necessary to inherit them.
@name = attributes['name'].strip[0, string_limit] | ||
@value = attributes['value'].strip[0, string_limit] | ||
@verified_at = attributes['verified_at']&.to_datetime | ||
@errors = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errors
didn't seem to be used
Due to the version upgrade of rubocop, the number of new warnings has increased.