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

Fix shadowing outer local variable and other warnings #1274

Merged
merged 7 commits into from
Feb 14, 2022

Conversation

Spone
Copy link
Collaborator

@Spone Spone commented Feb 11, 2022

Summary

This fixes the following warnings that are output when running the tests:

/home/runner/work/view_component/view_component/lib/view_component/slotable_v2.rb:279: warning: shadowing outer local variable - args
/home/runner/work/view_component/view_component/app/helpers/preview_helper.rb:30: warning: shadowing outer local variable - template
/home/runner/work/view_component/view_component/test/sandbox/app/components/jbuilder_component.json.jbuilder:1: warning: `frozen_string_literal' is ignored after any tokens
/home/runner/work/view_component/view_component/test/view_component/slotable_v2_test.rb:481: warning: shadowing outer local variable - c
/home/runner/work/view_component/view_component/test/view_component/tasks_test.rb:16: warning: ambiguous first argument; put parentheses or a space even after `/' operator
Run options: --seed 12208

# Running:

/home/runner/work/view_component/view_component/lib/view_component/preview.rb:76: warning: shadowing outer local variable - preview_path

Other Information

I did not find how to fix those:

/home/runner/work/view_component/view_component/lib/view_component/polymorphic_slots.rb:41: warning: method redefined; discarding old header
/home/runner/work/view_component/view_component/lib/view_component/polymorphic_slots.rb:41: warning: previous definition of header was here
/home/runner/work/view_component/view_component/lib/view_component/polymorphic_slots.rb:41: warning: method redefined; discarding old items
/home/runner/work/view_component/view_component/lib/view_component/polymorphic_slots.rb:41: warning: previous definition of items was here

I also took care of this:

The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file.

Please also note that can also opt-in to new cops by default by adding this to your config:
  AllCops:
    NewCops: enable
Layout/SpaceBeforeBrackets: # (new in 1.7)
  Enabled: true
For more information: https://docs.rubocop.org/rubocop/versioning.html

@Spone Spone self-assigned this Feb 11, 2022
Copy link
Contributor

@BlakeWilliams BlakeWilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning those warnings up!

@Spone
Copy link
Collaborator Author

Spone commented Feb 14, 2022

@elia should we merge this before #1277?

@elia
Copy link
Collaborator

elia commented Feb 14, 2022

@elia should we merge this before #1277?

@Spone sure! 🙌 I'll rebase once this is merged 👍

@Spone Spone merged commit 18c27ad into main Feb 14, 2022
@Spone Spone deleted the fix-shadowing-outer-local-variable branch February 14, 2022 17:35
BlakeWilliams pushed a commit that referenced this pull request Feb 15, 2022
* Fix shadowing outer local variable warnings

* Fix other warnings

* Add CHANGELOG entry

* Lint

* Add config for new Layout/SpaceBeforeBrackets cop
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.

3 participants