-
-
Notifications
You must be signed in to change notification settings - Fork 719
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 layout 4 #11300
Merged
mkllnk
merged 5 commits into
openfoodfoundation:master
from
macanudo527:fix_rubocop_layout_3
Jul 31, 2023
Merged
Fix rubocop layout 4 #11300
mkllnk
merged 5 commits into
openfoodfoundation:master
from
macanudo527:fix_rubocop_layout_3
Jul 31, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Inspecting 1480 files ...................................................................................................................................................................................................................................W..........................W........................................................W................W..............W................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ Offenses: app/models/calculator/flexi_rate.rb:38:7: W: [Corrected] Lint/AmbiguousOperatorPrecedence: Wrap expressions with varying precedence with parentheses to avoid ambiguity. count * preferred_additional_item.to_f + preferred_first_item.to_f ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ app/models/enterprise.rb:362:12: W: [Corrected] Lint/AmbiguousOperatorPrecedence: Wrap expressions with varying precedence with parentheses to avoid ambiguity. cat << "sells_" + sells ^^^^^^^^^^^^^^^^ app/models/enterprise.rb:496:21: W: [Corrected] Lint/AmbiguousOperatorPrecedence: Wrap expressions with varying precedence with parentheses to avoid ambiguity. phone_number && "https://wa.me/" + phone_number.tr('+ ', '') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ app/models/spree/ability.rb:27:33: W: [Corrected] Lint/AmbiguousOperatorPrecedence: Wrap expressions with varying precedence with parentheses to avoid ambiguity. order.user == user || order.token && token == order.token ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ app/models/spree/ability.rb:30:33: W: [Corrected] Lint/AmbiguousOperatorPrecedence: Wrap expressions with varying precedence with parentheses to avoid ambiguity. order.user == user || order.token && token == order.token ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ app/models/spree/line_item.rb:205:16: W: [Corrected] Lint/AmbiguousOperatorPrecedence: Wrap expressions with varying precedence with parentheses to avoid ambiguity. (price + fees / quantity).round(2) ^^^^^^^^^^^^^^^ app/models/spree/preferences/store.rb:28:11: W: [Corrected] Lint/AmbiguousOperatorPrecedence: Wrap expressions with varying precedence with parentheses to avoid ambiguity. should_persist? && Spree::Preference.where(key: key).exists? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1480 files inspected, 7 offenses detected, 7 offenses corrected
Inspecting 1480 files ..............W......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... Offenses: app/components/product_component.rb:23:51: W: [Corrected] Lint/RedundantCopDisableDirective: Unnecessary disabling of Metrics/MethodLength. # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength ^^^^^^^^^^^^^^^^^^^^ app/components/product_component.rb:50:50: W: [Corrected] Lint/RedundantCopEnableDirective: Unnecessary enabling of Metrics/MethodLength. # rubocop:enable Metrics/CyclomaticComplexity, Metrics/MethodLength ^^^^^^^^^^^^^^^^^^^^ 1480 files inspected, 2 offenses detected, 2 offenses corrected
Inspecting 1480 files ........................................................................................................................................................................................................................................................................................................................................W............................W.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. Offenses: app/models/spree/line_item.rb:283:55: W: [Corrected] Lint/SafeNavigationChain: Do not chain ordinary method call after safe navigation operator. self.final_weight_volume = variant&.unit_value * quantity ^^^^^^^^^^^ app/models/spree/line_item.rb:283:57: C: [Corrected] Layout/SpaceAroundMethodCallOperator: Avoid using spaces around a method call operator. self.final_weight_volume = variant&.unit_value&. * quantity ^ app/models/spree/stock/availability_validator.rb:31:77: W: [Corrected] Lint/SafeNavigationChain: Do not chain ordinary method call after safe navigation operator. return line_item.order.shipments.first if line_item.order&.shipments.any? ^^^^^ 1480 files inspected, 3 offenses detected, 3 offenses corrected
Inspecting 1480 files ........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................W............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... Offenses: lib/reporting/queries/query_interface.rb:18:30: W: [Corrected] Lint/UnusedMethodArgument: Unused method argument - default. If it's necessary, use _ or _default as an argument name to indicate that it won't be used. If it's unnecessary, remove it. def sum_grouped(field, default = 0) ^^^^^^^ lib/reporting/queries/query_interface.rb:22:26: W: [Corrected] Lint/UnusedMethodArgument: Unused method argument - default. If it's necessary, use _ or _default as an argument name to indicate that it won't be used. If it's unnecessary, remove it. def sum_new(field, default = 0) ^^^^^^^ 1480 files inspected, 2 offenses detected, 2 offenses corrected
Inspecting 1480 files ...................................................................................................................................................................C.......C..........C...............................................................................................................................................................................................................C...........................................................................................................C.........C...............................................................................................................................................................................................................................................................C........................................CC...C............................................................................................................................................................................................................................................................................................................................C.....................................................................................................................................................................................................C..............C.........C..CC.......C.....................................................................................................C............... Offenses: app/helpers/application_helper.rb:41:32: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def ng_form_for(name, *args, &block) ^^^^^^ app/helpers/application_helper.rb:44:75: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. form_for(name, *(args << options.merge(builder: AngularFormBuilder)), &block) ^^^^^^ app/helpers/application_helper.rb:49:37: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def method_missing(method, *args, &block) ^^^^^^ app/helpers/link_helper.rb:4:57: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def link_to_service(baseurl, name, html_options = {}, &block) ^^^^^^ app/helpers/link_helper.rb:8:51: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. link_to ext_url(baseurl, name), html_options, &block ^^^^^^ app/helpers/spree/admin/base_helper.rb:6:56: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def field_container(model, method, options = {}, &block) ^^^^^^ app/helpers/spree/admin/base_helper.rb:13:29: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. capture(&block), ^^^^^^ app/reflexes/application_reflex.rb:29:19: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def with_locale(&block) ^^^^^^ app/reflexes/application_reflex.rb:30:43: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. I18n.with_locale(current_user.locale, &block) ^^^^^^ app/services/cache_service.rb:8:43: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def self.cache(cache_key, options = {}, &block) ^^^^^^ app/services/cache_service.rb:9:48: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. Rails.cache.fetch cache_key.to_s, options, &block ^^^^^^ app/services/cache_service.rb:14:58: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def self.cached_data_by_class(cache_key, cached_class, &block) ^^^^^^ app/services/cache_service.rb:16:23: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. &block ^^^^^^ app/services/cache_service.rb:25:34: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def self.home_stats(statistic, &block) ^^^^^^ app/services/cache_service.rb:28:47: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. race_condition_ttl: 10, &block) ^^^^^^ app/services/current_order_locker.rb:12:31: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def self.around(controller, &block) ^^^^^^ app/services/current_order_locker.rb:13:55: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. lock_order_and_variants(controller.current_order, &block) ^^^^^^ lib/reporting/reports/enterprise_fee_summary/scope.rb:392:28: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def chain_to_scope(&block) ^^^^^^ lib/reporting/reports/enterprise_fee_summary/scope.rb:393:41: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. @scope = @scope.instance_eval(&block) ^^^^^^ lib/spree/core/controller_helpers/respond_with.rb:7:34: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def respond_with(*resources, &block) ^^^^^^ lib/spree/core/controller_helpers/respond_with.rb:13:64: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. return unless (collector = retrieve_collector_from_mimes(&block)) ^^^^^^ lib/spree/core/delegate_belongs_to.rb:80:39: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def class_def(name, method = nil, &blk) ^^^^ lib/spree/core/delegate_belongs_to.rb:81:54: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. class_eval { method.nil? ? define_method(name, &blk) : define_method(name, method) } ^^^^ lib/spree/core/environment_extension.rb:22:31: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def create_method(name, &block) ^^^^^^ lib/spree/core/environment_extension.rb:23:51: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. self.class.__send__(:define_method, name, &block) ^^^^^^ spec/models/enterprise_caching_spec.rb:144:13: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def later(&block) ^^^^^^ spec/models/enterprise_caching_spec.rb:145:36: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. Timecop.travel(1.day.from_now, &block) ^^^^^^ spec/support/embedded_pages_helper.rb:5:26: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def on_embedded_page(&block) ^^^^^^ spec/support/embedded_pages_helper.rb:6:28: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. within_frame :frame, &block ^^^^^^ spec/support/preferences_helper.rb:11:31: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def reset_spree_preferences(&config_block) ^^^^^^^^^^^^^ spec/support/preferences_helper.rb:16:33: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. configure_spree_preferences(&config_block) if block_given? ^^^^^^^^^^^^^ spec/support/request/shop_workflow.rb:87:37: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def within_variant(variant = nil, &block) ^^^^^^ spec/support/request/shop_workflow.rb:90:22: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. within(selector, &block) ^^^^^^ spec/support/request/ui_component_helper.rb:4:23: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def browse_as_small(&block) ^^^^^^ spec/support/request/ui_component_helper.rb:5:39: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. browse_with_window_size(640, 480, &block) ^^^^^^ spec/support/request/ui_component_helper.rb:8:24: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def browse_as_medium(&block) ^^^^^^ spec/support/request/ui_component_helper.rb:9:40: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. browse_with_window_size(1024, 768, &block) ^^^^^^ spec/support/request/web_helper.rb:52:23: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def within_row(num, &block) ^^^^^^ spec/support/request/web_helper.rb:53:54: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. within("table.index tbody tr:nth-child(#{num})", &block) ^^^^^^ spec/swagger_helper.rb:77:19: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def param(args, &block) ^^^^^^ spec/swagger_helper.rb:78:45: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. public_send(:let, args) { instance_eval(&block) } ^^^^^^ spec/system/support/capybara_setup.rb:20:27: C: [Corrected] Naming/BlockForwarding: Use anonymous block forwarding. def using_session(name, &block) ^^^^^^ 1480 files inspected, 42 offenses detected, 42 offenses corrected
macanudo527
force-pushed
the
fix_rubocop_layout_3
branch
from
July 30, 2023 12:29
349df4e
to
60cd84d
Compare
mkllnk
approved these changes
Jul 31, 2023
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.
Wow, these are so helpful. Thankyou for applying this free automagic code improvement. :-)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What? Why?
This fixes 5 more rubocop rules that are violated in our codebase. It was generated automatically with the rubocop-autocorrect.sh script.
What should we test?
No testing is required since these are safe corrections
Release notes
Changelog Category: Technical changes
The title of the pull request will be included in the release notes.
Dependencies
Documentation updates
Documentation updates