-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Rubocop linting and performance violations #948
Conversation
@@ -52,9 +52,9 @@ def contribution_blueprint_options | |||
end | |||
|
|||
def filter_params | |||
return {} unless allowed_params&.to_h.any? | |||
return {} unless allowed_params.to_h.any? |
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 don't think allowed_params
can be nil?
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.
Right. It can be empty/blank or it can raise an error, but it can't be nil
. This may have been left over from a previous iteration where that wasn't the case
def given_inputs | ||
# FIXME: ActiveInteraction::Base#given? seems to have a bug recognizing multipart date params | ||
raw_inputs = @_interaction_inputs | ||
inputs.select do |key| | ||
given?(key) || ( | ||
raw_inputs.key?(:"#{key}(1i)") && | ||
raw_inputs.key?(:"#{key}(2i)") && | ||
raw_inputs.key?(:"#{key}(3i)") | ||
) | ||
end | ||
end |
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.
Moved to the end of the file.
@@ -543,56 +543,56 @@ | |||
# end | |||
|
|||
# rubocop:enable Layout/CommentIndentation | |||
end |
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.
Everything below here in this file is just whitespace change; moved the class definitions below out of the block above.
@@ -1,7 +1,7 @@ | |||
class AddAutoGeneratedToCommunicationLog < ActiveRecord::Migration[6.0] | |||
def up | |||
add_column :communication_logs, :auto_generated, :boolean | |||
change_column_default :communication_logs, :auto_generated, :false | |||
change_column_default :communication_logs, :auto_generated, false |
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.
Fixing but :false
seems to set the default correctly.
@@ -7,13 +7,14 @@ | |||
importer = Importers::SubmissionResponseImporter.new(User.first, csv) | |||
importer.import(path) | |||
|
|||
# TODO process offers and old_offers as well |
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've tried to interpret the meaning of the pre-existing comment here.
77961b8
to
eef7c99
Compare
eef7c99
to
f422ae3
Compare
f422ae3
to
be847ac
Compare
Some instances require more analysis or knowledge so have left todos instead of fixing. https://docs.rubocop.org/rubocop/cops_lint.html#lintuselessassignment
Some of these instances didn't appear to need safe navigation. Others were smells, IMO, so left as todos. https://docs.rubocop.org/rubocop/cops_lint.html#lintsafenavigationchain
Fixing violations of the following: * Lint/BooleanSymbol * Lint/Debugger * Lint/DuplicateMethods * Lint/IneffectiveAccessModifier * Lint/RedundantStringCoercion
Reviewed in person with @svileshina . |
Why
Building on #935, fixes violations of
Lint/*
andPerformance/*
rules.What
See individual commits for the list of rule violations addressed. Diffs probably also make more sense one commit at a time.
In many instances, i left
rubocop:todo
s instead of fixing the violation (this is likerubocop:disable
but reveals that we really want to fix the violation instead of disable it).See inline PR comments for specific questions.
Testing
Relying on our existing suite to catch any regressions.
Next Steps
?
Outstanding Questions, Concerns and Other Notes
?
Pre-Merge Checklist