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

Rubocop linting and performance violations #948

Merged
merged 5 commits into from
May 18, 2021
Merged

Rubocop linting and performance violations #948

merged 5 commits into from
May 18, 2021

Conversation

solebared
Copy link
Collaborator

Why

Building on #935, fixes violations of Lint/* and Performance/* 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:todos instead of fixing the violation (this is like rubocop: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

  • Security & accessibility have been considered
  • Tests have been added, or an explanation has been given why the features cannot be tested
  • Documentation and comments have been added to the codebase where required
  • Entry added to CHANGELOG.md if appropriate
  • Outstanding questions and concerns have been resolved
  • Any next steps have been turned into Issues or Discussions as appropriate

@@ -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?
Copy link
Collaborator Author

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?

Copy link
Collaborator

@h-m-m h-m-m May 1, 2021

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

Comment on lines -23 to -33
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
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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.

Base automatically changed from rubocop/semantic-blocks to main May 18, 2021 21:18
@solebared
Copy link
Collaborator Author

Reviewed in person with @svileshina .

@solebared solebared merged commit b24a188 into main May 18, 2021
@solebared solebared deleted the rubocop/lint branch May 18, 2021 21:30
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.

2 participants