From ea9c7767400378206fcca1be35eb39a5fd30c04e Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Mon, 4 Sep 2023 21:54:30 +0100 Subject: [PATCH] vendor/bundle/ruby: cleanup unneeded files --- .gitignore | 220 +--- Library/Homebrew/livecheck/livecheck.rb | 2 +- .../gems/activesupport-6.1.7.6/MIT-LICENSE | 20 + .../core_ext/module/aliasing.rb | 31 - .../core_ext/module/anonymous.rb | 30 - .../core_ext/module/attr_internal.rb | 38 - .../core_ext/module/attribute_accessors.rb | 206 --- .../module/attribute_accessors_per_thread.rb | 148 --- .../core_ext/module/concerning.rb | 140 -- .../core_ext/module/delegation.rb | 330 ----- .../core_ext/module/deprecation.rb | 25 - .../core_ext/module/introspection.rb | 63 - .../core_ext/module/redefine_method.rb | 40 - .../core_ext/module/remove_method.rb | 17 - .../active_support/core_ext/numeric/bytes.rb | 66 - .../core_ext/numeric/conversions.rb | 140 -- .../active_support/core_ext/numeric/time.rb | 66 - .../core_ext/string/inflections.rb | 293 ----- .../core_ext/string/multibyte.rb | 58 - .../lib/active_support/i18n.rb | 16 - .../lib/active_support/inflections.rb | 72 - .../lib/active_support/inflector.rb | 9 - .../active_support/inflector/inflections.rb | 255 ---- .../lib/active_support/inflector/methods.rb | 400 ------ .../active_support/inflector/transliterate.rb | 147 --- .../lib/active_support/lazy_load_hooks.rb | 81 -- .../lib/active_support/multibyte.rb | 23 - .../2.6.0/gems/addressable-2.8.5/LICENSE.txt | 202 +++ .../ruby/2.6.0/gems/bindata-2.4.15/LICENSE | 25 + .../gems/concurrent-ruby-1.2.2/LICENSE.txt | 21 + .../2.6.0/gems/did_you_mean-1.6.3/LICENSE.txt | 22 + .../ruby/2.6.0/gems/i18n-1.14.1/MIT-LICENSE | 20 + .../ruby/2.6.0/gems/plist-3.7.0/LICENSE.txt | 20 + .../gems/public_suffix-5.0.3/LICENSE.txt | 22 + .../ruby/2.6.0/gems/rack-3.0.8/lib/rack.rb | 71 - .../lib/rack/auth/abstract/handler.rb | 41 - .../lib/rack/auth/abstract/request.rb | 49 - .../gems/rack-3.0.8/lib/rack/auth/basic.rb | 59 - .../gems/rack-3.0.8/lib/rack/auth/digest.rb | 256 ---- .../rack-3.0.8/lib/rack/auth/digest/md5.rb | 1 - .../rack-3.0.8/lib/rack/auth/digest/nonce.rb | 1 - .../rack-3.0.8/lib/rack/auth/digest/params.rb | 1 - .../lib/rack/auth/digest/request.rb | 1 - .../gems/rack-3.0.8/lib/rack/body_proxy.rb | 47 - .../2.6.0/gems/rack-3.0.8/lib/rack/builder.rb | 277 ---- .../2.6.0/gems/rack-3.0.8/lib/rack/cascade.rb | 70 - .../2.6.0/gems/rack-3.0.8/lib/rack/chunked.rb | 120 -- .../gems/rack-3.0.8/lib/rack/common_logger.rb | 88 -- .../rack-3.0.8/lib/rack/conditional_get.rb | 86 -- .../2.6.0/gems/rack-3.0.8/lib/rack/config.rb | 22 - .../gems/rack-3.0.8/lib/rack/constants.rb | 64 - .../rack-3.0.8/lib/rack/content_length.rb | 34 - .../gems/rack-3.0.8/lib/rack/content_type.rb | 33 - .../gems/rack-3.0.8/lib/rack/deflater.rb | 158 --- .../gems/rack-3.0.8/lib/rack/directory.rb | 205 --- .../2.6.0/gems/rack-3.0.8/lib/rack/etag.rb | 68 - .../2.6.0/gems/rack-3.0.8/lib/rack/events.rb | 157 --- .../2.6.0/gems/rack-3.0.8/lib/rack/file.rb | 9 - .../2.6.0/gems/rack-3.0.8/lib/rack/files.rb | 216 --- .../2.6.0/gems/rack-3.0.8/lib/rack/head.rb | 26 - .../2.6.0/gems/rack-3.0.8/lib/rack/headers.rb | 154 --- .../2.6.0/gems/rack-3.0.8/lib/rack/lint.rb | 907 ------------- .../2.6.0/gems/rack-3.0.8/lib/rack/lock.rb | 29 - .../2.6.0/gems/rack-3.0.8/lib/rack/logger.rb | 22 - .../gems/rack-3.0.8/lib/rack/media_type.rb | 43 - .../rack-3.0.8/lib/rack/method_override.rb | 56 - .../2.6.0/gems/rack-3.0.8/lib/rack/mime.rb | 693 ---------- .../2.6.0/gems/rack-3.0.8/lib/rack/mock.rb | 3 - .../gems/rack-3.0.8/lib/rack/mock_request.rb | 166 --- .../gems/rack-3.0.8/lib/rack/mock_response.rb | 126 -- .../gems/rack-3.0.8/lib/rack/multipart.rb | 44 - .../lib/rack/multipart/generator.rb | 99 -- .../rack-3.0.8/lib/rack/multipart/parser.rb | 434 ------ .../lib/rack/multipart/uploaded_file.rb | 45 - .../gems/rack-3.0.8/lib/rack/null_logger.rb | 48 - .../gems/rack-3.0.8/lib/rack/query_parser.rb | 253 ---- .../gems/rack-3.0.8/lib/rack/recursive.rb | 66 - .../gems/rack-3.0.8/lib/rack/reloader.rb | 112 -- .../2.6.0/gems/rack-3.0.8/lib/rack/request.rb | 777 ----------- .../gems/rack-3.0.8/lib/rack/response.rb | 393 ------ .../rack-3.0.8/lib/rack/rewindable_input.rb | 113 -- .../2.6.0/gems/rack-3.0.8/lib/rack/runtime.rb | 35 - .../gems/rack-3.0.8/lib/rack/sendfile.rb | 167 --- .../rack-3.0.8/lib/rack/show_exceptions.rb | 403 ------ .../gems/rack-3.0.8/lib/rack/show_status.rb | 123 -- .../2.6.0/gems/rack-3.0.8/lib/rack/static.rb | 187 --- .../rack-3.0.8/lib/rack/tempfile_reaper.rb | 33 - .../2.6.0/gems/rack-3.0.8/lib/rack/urlmap.rb | 99 -- .../2.6.0/gems/rack-3.0.8/lib/rack/utils.rb | 654 ---------- .../2.6.0/gems/rack-3.0.8/lib/rack/version.rb | 34 - .../lib/rubocop-capybara.rb | 24 - .../lib/rubocop/capybara/config_formatter.rb | 56 - .../rubocop/capybara/description_extractor.rb | 70 - .../lib/rubocop/capybara/version.rb | 10 - .../cop/capybara/current_path_expectation.rb | 148 --- .../lib/rubocop/cop/capybara/match_style.rb | 58 - .../cop/capybara/mixin/capybara_help.rb | 131 -- .../cop/capybara/mixin/css_selector.rb | 111 -- .../rubocop/cop/capybara/negation_matcher.rb | 104 -- .../rubocop/cop/capybara/specific_actions.rb | 93 -- .../rubocop/cop/capybara/specific_finders.rb | 126 -- .../rubocop/cop/capybara/specific_matcher.rb | 88 -- .../cop/capybara/visibility_matcher.rb | 71 - .../lib/rubocop/cop/capybara_cops.rb | 9 - .../config/default.yml | 367 ------ .../config/obsoletion.yml | 7 - .../lib/rubocop-performance.rb | 11 - .../rubocop/cop/mixin/regexp_metacharacter.rb | 76 -- .../lib/rubocop/cop/mixin/sort_block.rb | 35 - .../cop/performance/ancestors_include.rb | 52 - .../array_semi_infinite_range_slice.rb | 79 -- .../big_decimal_with_numeric_argument.rb | 53 - .../lib/rubocop/cop/performance/bind_call.rb | 77 -- .../block_given_with_explicit_block.rb | 53 - .../lib/rubocop/cop/performance/caller.rb | 67 - .../cop/performance/case_when_splat.rb | 176 --- .../lib/rubocop/cop/performance/casecmp.rb | 103 -- .../cop/performance/chain_array_allocation.rb | 74 -- .../performance/collection_literal_in_loop.rb | 138 -- .../cop/performance/compare_with_block.rb | 111 -- .../performance/concurrent_monotonic_time.rb | 42 - .../cop/performance/constant_regexp.rb | 71 - .../lib/rubocop/cop/performance/count.rb | 142 -- .../rubocop/cop/performance/delete_prefix.rb | 91 -- .../rubocop/cop/performance/delete_suffix.rb | 91 -- .../lib/rubocop/cop/performance/detect.rb | 136 -- .../cop/performance/double_start_end_with.rb | 106 -- .../lib/rubocop/cop/performance/end_with.rb | 79 -- .../lib/rubocop/cop/performance/fixed_size.rb | 98 -- .../lib/rubocop/cop/performance/flat_map.rb | 87 -- .../performance/inefficient_hash_search.rb | 99 -- .../rubocop/cop/performance/io_readlines.rb | 112 -- .../rubocop/cop/performance/map_compact.rb | 99 -- .../cop/performance/method_object_as_block.rb | 32 - .../rubocop/cop/performance/open_struct.rb | 50 - .../rubocop/cop/performance/range_include.rb | 55 - .../cop/performance/redundant_block_call.rb | 105 -- .../redundant_equality_comparison_block.rb | 137 -- .../cop/performance/redundant_match.rb | 63 - .../cop/performance/redundant_merge.rb | 195 --- .../cop/performance/redundant_sort_block.rb | 50 - .../redundant_split_regexp_argument.rb | 64 - .../cop/performance/redundant_string_chars.rb | 131 -- .../rubocop/cop/performance/regexp_match.rb | 280 ---- .../rubocop/cop/performance/reverse_each.rb | 59 - .../rubocop/cop/performance/reverse_first.rb | 73 -- .../lib/rubocop/cop/performance/select_map.rb | 60 - .../lib/rubocop/cop/performance/size.rb | 75 -- .../rubocop/cop/performance/sort_reverse.rb | 54 - .../lib/rubocop/cop/performance/squeeze.rb | 64 - .../lib/rubocop/cop/performance/start_with.rb | 79 -- .../performance/string_identifier_argument.rb | 67 - .../rubocop/cop/performance/string_include.rb | 59 - .../cop/performance/string_replacement.rb | 160 --- .../lib/rubocop/cop/performance/sum.rb | 269 ---- .../lib/rubocop/cop/performance/times_map.rb | 76 -- .../cop/performance/unfreeze_string.rb | 67 - .../cop/performance/uri_default_parser.rb | 40 - .../lib/rubocop/cop/performance_cops.rb | 54 - .../lib/rubocop/performance.rb | 14 - .../lib/rubocop/performance/inject.rb | 18 - .../lib/rubocop/performance/version.rb | 14 - .../rubocop-rails-2.19.1/config/default.yml | 1160 ----------------- .../config/obsoletion.yml | 17 - .../rubocop-rails-2.19.1/lib/rubocop-rails.rb | 34 - .../rubocop/cop/mixin/active_record_helper.rb | 106 -- .../mixin/active_record_migrations_helper.rb | 32 - .../cop/mixin/class_send_node_helper.rb | 20 - .../rubocop/cop/mixin/enforce_superclass.rb | 40 - .../lib/rubocop/cop/mixin/index_method.rb | 165 --- .../rubocop/cop/mixin/migrations_helper.rb | 26 - .../rubocop/cop/mixin/target_rails_version.rb | 16 - .../action_controller_flash_before_render.rb | 112 -- .../cop/rails/action_controller_test_case.rb | 47 - .../lib/rubocop/cop/rails/action_filter.rb | 107 -- .../lib/rubocop/cop/rails/action_order.rb | 116 -- .../cop/rails/active_record_aliases.rb | 47 - .../rails/active_record_callbacks_order.rb | 143 -- .../cop/rails/active_record_override.rb | 79 -- .../cop/rails/active_support_aliases.rb | 60 - .../cop/rails/active_support_on_load.rb | 70 - .../lib/rubocop/cop/rails/add_column_index.rb | 61 - .../cop/rails/after_commit_override.rb | 81 -- .../cop/rails/application_controller.rb | 36 - .../lib/rubocop/cop/rails/application_job.rb | 45 - .../rubocop/cop/rails/application_mailer.rb | 39 - .../rubocop/cop/rails/application_record.rb | 40 - .../lib/rubocop/cop/rails/arel_star.rb | 47 - .../lib/rubocop/cop/rails/assert_not.rb | 42 - .../rails/attribute_default_block_value.rb | 90 -- .../lib/rubocop/cop/rails/belongs_to.rb | 90 -- .../lib/rubocop/cop/rails/blank.rb | 168 --- .../rubocop/cop/rails/bulk_change_table.rb | 294 ----- .../lib/rubocop/cop/rails/compact_blank.rb | 111 -- .../lib/rubocop/cop/rails/content_tag.rb | 93 -- .../cop/rails/create_table_with_timestamps.rb | 98 -- .../lib/rubocop/cop/rails/date.rb | 166 --- .../lib/rubocop/cop/rails/default_scope.rb | 61 - .../lib/rubocop/cop/rails/delegate.rb | 136 -- .../rubocop/cop/rails/delegate_allow_blank.rb | 36 - .../deprecated_active_model_errors_methods.rb | 168 --- .../rubocop/cop/rails/dot_separated_keys.rb | 71 - .../cop/rails/duplicate_association.rb | 56 - .../lib/rubocop/cop/rails/duplicate_scope.rb | 46 - .../rubocop/cop/rails/duration_arithmetic.rb | 98 -- .../lib/rubocop/cop/rails/dynamic_find_by.rb | 136 -- .../cop/rails/eager_evaluation_log_message.rb | 82 -- .../lib/rubocop/cop/rails/enum_hash.rb | 75 -- .../lib/rubocop/cop/rails/enum_uniqueness.rb | 63 - .../cop/rails/environment_comparison.rb | 116 -- .../cop/rails/environment_variable_access.rb | 67 - .../lib/rubocop/cop/rails/exit.rb | 61 - .../rubocop/cop/rails/expanded_date_range.rb | 102 -- .../lib/rubocop/cop/rails/file_path.rb | 125 -- .../lib/rubocop/cop/rails/find_by.rb | 74 -- .../lib/rubocop/cop/rails/find_by_id.rb | 94 -- .../lib/rubocop/cop/rails/find_each.rb | 75 -- .../lib/rubocop/cop/rails/freeze_time.rb | 79 -- .../cop/rails/has_and_belongs_to_many.rb | 26 - .../rails/has_many_or_has_one_dependent.rb | 143 -- .../cop/rails/helper_instance_variable.rb | 67 - .../cop/rails/http_positional_arguments.rb | 146 --- .../lib/rubocop/cop/rails/http_status.rb | 164 --- .../lib/rubocop/cop/rails/i18n_lazy_lookup.rb | 96 -- .../cop/rails/i18n_locale_assignment.rb | 37 - .../rubocop/cop/rails/i18n_locale_texts.rb | 110 -- .../cop/rails/ignored_columns_assignment.rb | 50 - .../ignored_skip_action_filter_option.rb | 87 -- .../lib/rubocop/cop/rails/index_by.rb | 65 - .../lib/rubocop/cop/rails/index_with.rb | 68 - .../lib/rubocop/cop/rails/inquiry.rb | 39 - .../lib/rubocop/cop/rails/inverse_of.rb | 252 ---- .../rails/lexically_scoped_action_filter.rb | 205 --- .../lib/rubocop/cop/rails/link_to_blank.rb | 97 -- .../lib/rubocop/cop/rails/mailer_name.rb | 90 -- .../lib/rubocop/cop/rails/match_route.rb | 120 -- .../rubocop/cop/rails/migration_class_name.rb | 63 - .../lib/rubocop/cop/rails/negate_include.rb | 42 - .../lib/rubocop/cop/rails/not_null_column.rb | 71 - .../lib/rubocop/cop/rails/order_by_id.rb | 51 - .../lib/rubocop/cop/rails/output.rb | 68 - .../lib/rubocop/cop/rails/output_safety.rb | 104 -- .../lib/rubocop/cop/rails/pick.rb | 64 - .../lib/rubocop/cop/rails/pluck.rb | 96 -- .../lib/rubocop/cop/rails/pluck_id.rb | 59 - .../lib/rubocop/cop/rails/pluck_in_where.rb | 71 - .../cop/rails/pluralization_grammar.rb | 102 -- .../lib/rubocop/cop/rails/presence.rb | 152 --- .../lib/rubocop/cop/rails/present.rb | 156 --- .../lib/rubocop/cop/rails/rake_environment.rb | 112 -- .../rubocop/cop/rails/read_write_attribute.rb | 112 -- .../rubocop/cop/rails/redundant_allow_nil.rb | 99 -- .../cop/rails/redundant_foreign_key.rb | 77 -- ...ndant_presence_validation_on_belongs_to.rb | 257 ---- .../redundant_receiver_in_with_options.rb | 138 -- .../cop/rails/redundant_travel_back.rb | 57 - .../cop/rails/reflection_class_name.rb | 86 -- .../lib/rubocop/cop/rails/refute_methods.rb | 97 -- .../cop/rails/relative_date_constant.rb | 112 -- .../lib/rubocop/cop/rails/render_inline.rb | 41 - .../rubocop/cop/rails/render_plain_text.rb | 71 - .../lib/rubocop/cop/rails/request_referer.rb | 55 - .../rubocop/cop/rails/require_dependency.rb | 38 - .../rubocop/cop/rails/response_parsed_body.rb | 57 - .../rubocop/cop/rails/reversible_migration.rb | 326 ----- .../reversible_migration_method_definition.rb | 66 - .../lib/rubocop/cop/rails/root_join_chain.rb | 72 - .../cop/rails/root_pathname_methods.rb | 238 ---- .../lib/rubocop/cop/rails/root_public_path.rb | 59 - .../lib/rubocop/cop/rails/safe_navigation.rb | 99 -- .../cop/rails/safe_navigation_with_blank.rb | 50 - .../lib/rubocop/cop/rails/save_bang.rb | 342 ----- .../lib/rubocop/cop/rails/schema_comment.rb | 104 -- .../lib/rubocop/cop/rails/scope_args.rb | 34 - .../lib/rubocop/cop/rails/short_i18n.rb | 71 - .../cop/rails/skips_model_validations.rb | 124 -- .../cop/rails/squished_sql_heredocs.rb | 87 -- .../lib/rubocop/cop/rails/strip_heredoc.rb | 56 - .../cop/rails/table_name_assignment.rb | 44 - .../cop/rails/three_state_boolean_column.rb | 73 -- .../lib/rubocop/cop/rails/time_zone.rb | 254 ---- .../rubocop/cop/rails/time_zone_assignment.rb | 37 - .../lib/rubocop/cop/rails/to_formatted_s.rb | 46 - .../rubocop/cop/rails/to_s_with_argument.rb | 78 -- .../top_level_hash_with_indifferent_access.rb | 49 - .../cop/rails/transaction_exit_statement.rb | 99 -- .../rubocop/cop/rails/uniq_before_pluck.rb | 96 -- .../rails/unique_validation_without_index.rb | 172 --- .../lib/rubocop/cop/rails/unknown_env.rb | 94 -- .../cop/rails/unused_ignored_columns.rb | 76 -- .../lib/rubocop/cop/rails/validation.rb | 140 -- .../lib/rubocop/cop/rails/where_equals.rb | 102 -- .../lib/rubocop/cop/rails/where_exists.rb | 138 -- .../lib/rubocop/cop/rails/where_missing.rb | 118 -- .../lib/rubocop/cop/rails/where_not.rb | 101 -- .../where_not_with_multiple_conditions.rb | 55 - .../lib/rubocop/cop/rails_cops.rb | 134 -- .../rubocop-rails-2.19.1/lib/rubocop/rails.rb | 14 - .../lib/rubocop/rails/inject.rb | 18 - .../lib/rubocop/rails/schema_loader.rb | 61 - .../lib/rubocop/rails/schema_loader/schema.rb | 191 --- .../lib/rubocop/rails/version.rb | 14 - .../rubocop-rspec-2.20.0/config/default.yml | 1103 ---------------- .../config/obsoletion.yml | 23 - .../rubocop-rspec-2.20.0/lib/rubocop-rspec.rb | 67 - .../rubocop/cop/rspec/align_left_let_brace.rb | 49 - .../cop/rspec/align_right_let_brace.rb | 49 - .../lib/rubocop/cop/rspec/any_instance.rb | 40 - .../lib/rubocop/cop/rspec/around_block.rb | 97 -- .../lib/rubocop/cop/rspec/base.rb | 27 - .../lib/rubocop/cop/rspec/be.rb | 39 - .../lib/rubocop/cop/rspec/be_empty.rb | 44 - .../lib/rubocop/cop/rspec/be_eq.rb | 47 - .../lib/rubocop/cop/rspec/be_eql.rb | 61 - .../lib/rubocop/cop/rspec/be_nil.rb | 74 -- .../lib/rubocop/cop/rspec/before_after_all.rb | 51 - .../capybara/current_path_expectation.rb | 39 - .../cop/rspec/capybara/feature_methods.rb | 104 -- .../rubocop/cop/rspec/capybara/match_style.rb | 38 - .../cop/rspec/capybara/negation_matcher.rb | 33 - .../cop/rspec/capybara/specific_actions.rb | 29 - .../cop/rspec/capybara/specific_finders.rb | 24 - .../cop/rspec/capybara/specific_matcher.rb | 35 - .../cop/rspec/capybara/visibility_matcher.rb | 36 - .../lib/rubocop/cop/rspec/change_by_zero.rb | 148 --- .../lib/rubocop/cop/rspec/class_check.rb | 101 -- .../lib/rubocop/cop/rspec/contain_exactly.rb | 56 - .../lib/rubocop/cop/rspec/context_method.rb | 57 - .../lib/rubocop/cop/rspec/context_wording.rb | 117 -- .../lib/rubocop/cop/rspec/describe_class.rb | 85 -- .../lib/rubocop/cop/rspec/describe_method.rb | 52 - .../lib/rubocop/cop/rspec/describe_symbol.rb | 37 - .../lib/rubocop/cop/rspec/described_class.rb | 209 --- .../rspec/described_class_module_wrapping.rb | 38 - .../lib/rubocop/cop/rspec/dialect.rb | 71 - .../rubocop/cop/rspec/duplicated_metadata.rb | 58 - .../rubocop/cop/rspec/empty_example_group.rb | 184 --- .../lib/rubocop/cop/rspec/empty_hook.rb | 49 - .../cop/rspec/empty_line_after_example.rb | 82 -- .../rspec/empty_line_after_example_group.rb | 42 - .../cop/rspec/empty_line_after_final_let.rb | 40 - .../cop/rspec/empty_line_after_hook.rb | 82 -- .../cop/rspec/empty_line_after_subject.rb | 36 - .../lib/rubocop/cop/rspec/example_length.rb | 70 - .../cop/rspec/example_without_description.rb | 89 -- .../lib/rubocop/cop/rspec/example_wording.rb | 150 --- .../cop/rspec/excessive_docstring_spacing.rb | 101 -- .../lib/rubocop/cop/rspec/expect_actual.rb | 102 -- .../lib/rubocop/cop/rspec/expect_change.rb | 86 -- .../lib/rubocop/cop/rspec/expect_in_hook.rb | 50 - .../lib/rubocop/cop/rspec/expect_output.rb | 53 - .../attribute_defined_statically.rb | 128 -- .../consistent_parentheses_style.rb | 117 -- .../cop/rspec/factory_bot/create_list.rb | 260 ---- .../rspec/factory_bot/factory_class_name.rb | 56 - .../rspec/factory_bot/factory_name_style.rb | 74 -- .../cop/rspec/factory_bot/syntax_methods.rb | 89 -- .../lib/rubocop/cop/rspec/file_path.rb | 173 --- .../lib/rubocop/cop/rspec/focus.rb | 108 -- .../lib/rubocop/cop/rspec/hook_argument.rb | 134 -- .../cop/rspec/hooks_before_examples.rb | 81 -- .../cop/rspec/identical_equality_assertion.rb | 37 - .../cop/rspec/implicit_block_expectation.rb | 68 - .../lib/rubocop/cop/rspec/implicit_expect.rb | 100 -- .../lib/rubocop/cop/rspec/implicit_subject.rb | 167 --- .../lib/rubocop/cop/rspec/indexed_let.rb | 76 -- .../lib/rubocop/cop/rspec/instance_spy.rb | 74 -- .../rubocop/cop/rspec/instance_variable.rb | 96 -- .../lib/rubocop/cop/rspec/it_behaves_like.rb | 49 - .../rubocop/cop/rspec/iterated_expectation.rb | 74 -- .../lib/rubocop/cop/rspec/leading_subject.rb | 86 -- .../cop/rspec/leaky_constant_declaration.rb | 127 -- .../rubocop/cop/rspec/let_before_examples.rb | 97 -- .../lib/rubocop/cop/rspec/let_setup.rb | 74 -- .../lib/rubocop/cop/rspec/match_array.rb | 59 - .../lib/rubocop/cop/rspec/message_chain.rb | 28 - .../rubocop/cop/rspec/message_expectation.rb | 62 - .../lib/rubocop/cop/rspec/message_spies.rb | 90 -- .../rspec/missing_example_group_argument.rb | 35 - .../rubocop/cop/rspec/mixin/comments_help.rb | 38 - .../cop/rspec/mixin/empty_line_separation.rb | 59 - .../cop/rspec/mixin/final_end_location.rb | 19 - .../cop/rspec/mixin/inside_example_group.rb | 29 - .../rubocop/cop/rspec/mixin/location_help.rb | 37 - .../lib/rubocop/cop/rspec/mixin/metadata.rb | 49 - .../lib/rubocop/cop/rspec/mixin/namespace.rb | 23 - .../cop/rspec/mixin/skip_or_pending.rb | 39 - .../cop/rspec/mixin/top_level_group.rb | 54 - .../lib/rubocop/cop/rspec/mixin/variable.rb | 21 - .../rubocop/cop/rspec/multiple_describes.rb | 43 - .../cop/rspec/multiple_expectations.rb | 144 -- .../cop/rspec/multiple_memoized_helpers.rb | 148 --- .../rubocop/cop/rspec/multiple_subjects.rb | 97 -- .../lib/rubocop/cop/rspec/named_subject.rb | 153 --- .../lib/rubocop/cop/rspec/nested_groups.rb | 162 --- .../cop/rspec/no_expectation_example.rb | 102 -- .../lib/rubocop/cop/rspec/not_to_not.rb | 56 - .../rubocop/cop/rspec/overwriting_setup.rb | 74 -- .../lib/rubocop/cop/rspec/pending.rb | 70 - .../cop/rspec/pending_without_reason.rb | 159 --- .../rubocop/cop/rspec/predicate_matcher.rb | 337 ----- .../cop/rspec/rails/avoid_setup_hook.rb | 43 - .../cop/rspec/rails/have_http_status.rb | 53 - .../rubocop/cop/rspec/rails/http_status.rb | 203 --- .../cop/rspec/rails/inferred_spec_type.rb | 145 --- .../cop/rspec/rails/minitest_assertions.rb | 60 - .../rubocop/cop/rspec/rails/travel_around.rb | 92 -- .../lib/rubocop/cop/rspec/receive_counts.rb | 89 -- .../lib/rubocop/cop/rspec/receive_never.rb | 41 - .../lib/rubocop/cop/rspec/redundant_around.rb | 65 - .../rubocop/cop/rspec/repeated_description.rb | 98 -- .../lib/rubocop/cop/rspec/repeated_example.rb | 53 - .../cop/rspec/repeated_example_group_body.rb | 100 -- .../repeated_example_group_description.rb | 96 -- .../cop/rspec/repeated_include_example.rb | 105 -- .../lib/rubocop/cop/rspec/return_from_stub.rb | 169 --- .../lib/rubocop/cop/rspec/scattered_let.rb | 59 - .../lib/rubocop/cop/rspec/scattered_setup.rb | 86 -- .../lib/rubocop/cop/rspec/shared_context.rb | 107 -- .../lib/rubocop/cop/rspec/shared_examples.rb | 79 -- .../rspec/single_argument_message_chain.rb | 94 -- .../cop/rspec/skip_block_inside_example.rb | 46 - .../lib/rubocop/cop/rspec/sort_metadata.rb | 70 - .../lib/rubocop/cop/rspec/stubbed_mock.rb | 174 --- .../rubocop/cop/rspec/subject_declaration.rb | 46 - .../lib/rubocop/cop/rspec/subject_stub.rb | 155 --- .../cop/rspec/unspecified_exception.rb | 67 - .../rubocop/cop/rspec/variable_definition.rb | 77 -- .../lib/rubocop/cop/rspec/variable_name.rb | 68 - .../cop/rspec/verified_double_reference.rb | 111 -- .../lib/rubocop/cop/rspec/verified_doubles.rb | 52 - .../lib/rubocop/cop/rspec/void_expect.rb | 59 - .../lib/rubocop/cop/rspec/yield.rb | 82 -- .../lib/rubocop/cop/rspec_cops.rb | 126 -- .../rubocop-rspec-2.20.0/lib/rubocop/rspec.rb | 14 - .../lib/rubocop/rspec/align_let_brace.rb | 63 - .../lib/rubocop/rspec/concept.rb | 34 - .../lib/rubocop/rspec/config_formatter.rb | 66 - .../lib/rubocop/rspec/corrector/move_node.rb | 51 - .../rubocop/rspec/description_extractor.rb | 77 -- .../lib/rubocop/rspec/example.rb | 37 - .../lib/rubocop/rspec/example_group.rb | 67 - .../lib/rubocop/rspec/factory_bot.rb | 64 - .../lib/rubocop/rspec/factory_bot/language.rb | 37 - .../lib/rubocop/rspec/hook.rb | 79 -- .../lib/rubocop/rspec/inject.rb | 18 - .../lib/rubocop/rspec/language.rb | 217 --- .../rubocop/rspec/language/node_pattern.rb | 48 - .../lib/rubocop/rspec/node.rb | 19 - .../default_rspec_language_config_context.rb | 29 - .../lib/rubocop/rspec/version.rb | 10 - .../lib/rubocop/rspec/wording.rb | 81 -- .../rubocop-sorbet-0.7.3/config/default.yml | 266 ---- .../gems/rubocop-sorbet-0.7.3/config/rbi.yml | 272 ---- .../lib/rubocop-sorbet.rb | 11 - .../binding_constant_without_type_alias.rb | 105 -- .../sorbet/callback_conditionals_binding.rb | 170 --- .../cop/sorbet/constants_from_strings.rb | 55 - .../sorbet/forbid_include_const_literal.rb | 71 - .../sorbet/forbid_superclass_const_literal.rb | 44 - .../lib/rubocop/cop/sorbet/forbid_t_unsafe.rb | 30 - .../rubocop/cop/sorbet/forbid_t_untyped.rb | 33 - .../cop/sorbet/forbid_untyped_struct_props.rb | 64 - .../cop/sorbet/implicit_conversion_method.rb | 56 - .../cop/sorbet/mixin/target_sorbet_version.rb | 49 - ...mutable_constant_sorbet_aware_behaviour.rb | 32 - .../cop/sorbet/obsolete_strict_memoization.rb | 92 -- .../cop/sorbet/one_ancestor_per_line.rb | 80 -- .../forbid_extend_t_sig_helpers_in_shims.rb | 47 - .../forbid_rbi_outside_of_allowed_paths.rb | 67 - ...ingle_line_rbi_class_module_definitions.rb | 40 - .../cop/sorbet/redundant_extend_t_sig.rb | 49 - .../cop/sorbet/sigils/enforce_sigil_order.rb | 116 -- .../cop/sorbet/sigils/enforce_single_sigil.rb | 64 - .../rubocop/cop/sorbet/sigils/false_sigil.rb | 17 - .../rubocop/cop/sorbet/sigils/has_sigil.rb | 26 - .../rubocop/cop/sorbet/sigils/ignore_sigil.rb | 17 - .../rubocop/cop/sorbet/sigils/strict_sigil.rb | 17 - .../rubocop/cop/sorbet/sigils/strong_sigil.rb | 17 - .../rubocop/cop/sorbet/sigils/true_sigil.rb | 17 - .../rubocop/cop/sorbet/sigils/valid_sigil.rb | 187 --- .../signatures/allow_incompatible_override.rb | 76 -- .../signatures/checked_true_in_signature.rb | 54 - .../sorbet/signatures/empty_line_after_sig.rb | 57 - .../sorbet/signatures/enforce_signatures.rb | 148 --- .../signatures/keyword_argument_ordering.rb | 52 - .../signatures/signature_build_order.rb | 120 -- .../cop/sorbet/signatures/signature_cop.rb | 45 - .../lib/rubocop/cop/sorbet/type_alias_name.rb | 38 - .../lib/rubocop/cop/sorbet_cops.rb | 40 - .../lib/rubocop/sorbet.rb | 16 - .../lib/rubocop/sorbet/inject.rb | 22 - .../lib/rubocop/sorbet/version.rb | 7 - .../ruby/2.6.0/gems/ruby-macho-4.0.0/LICENSE | 21 + .../lib/ruby-progressbar.rb | 12 - .../lib/ruby-progressbar/base.rb | 234 ---- .../ruby-progressbar/calculators/length.rb | 98 -- .../lib/ruby-progressbar/components/bar.rb | 102 -- .../ruby-progressbar/components/percentage.rb | 27 - .../lib/ruby-progressbar/components/rate.rb | 39 - .../lib/ruby-progressbar/components/time.rb | 101 -- .../lib/ruby-progressbar/components/title.rb | 13 - .../errors/invalid_progress_error.rb | 4 - .../lib/ruby-progressbar/format/formatter.rb | 27 - .../lib/ruby-progressbar/format/molecule.rb | 61 - .../lib/ruby-progressbar/format/string.rb | 38 - .../lib/ruby-progressbar/output.rb | 71 - .../lib/ruby-progressbar/outputs/non_tty.rb | 47 - .../lib/ruby-progressbar/outputs/null.rb | 33 - .../lib/ruby-progressbar/outputs/tty.rb | 32 - .../lib/ruby-progressbar/progress.rb | 108 -- .../lib/ruby-progressbar/projector.rb | 14 - .../projectors/smoothed_average.rb | 71 - .../lib/ruby-progressbar/refinements.rb | 1 - .../refinements/progress_enumerator.rb | 28 - .../lib/ruby-progressbar/throttle.rb | 25 - .../lib/ruby-progressbar/time.rb | 30 - .../lib/ruby-progressbar/timer.rb | 78 -- .../lib/ruby-progressbar/version.rb | 3 - .../lib/simplecov_json_formatter.rb | 36 - .../result_exporter.rb | 27 - .../result_hash_formatter.rb | 52 - .../source_file_formatter.rb | 65 - .../lib/simplecov_json_formatter/version.rb | 5 - .../ruby/2.6.0/gems/warning-1.3.0/MIT-LICENSE | 18 + 525 files changed, 426 insertions(+), 48810 deletions(-) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/MIT-LICENSE delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/aliasing.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/anonymous.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/attr_internal.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/attribute_accessors.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/concerning.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/delegation.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/deprecation.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/introspection.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/redefine_method.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/remove_method.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/numeric/bytes.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/numeric/conversions.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/numeric/time.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/string/inflections.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/string/multibyte.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/i18n.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflections.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflector.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflector/inflections.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflector/methods.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflector/transliterate.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/multibyte.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.5/LICENSE.txt create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/bindata-2.4.15/LICENSE create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.2.2/LICENSE.txt create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/did_you_mean-1.6.3/LICENSE.txt create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.14.1/MIT-LICENSE create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/plist-3.7.0/LICENSE.txt create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/public_suffix-5.0.3/LICENSE.txt delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/abstract/handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/abstract/request.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/basic.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest/md5.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest/nonce.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest/params.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest/request.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/body_proxy.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/builder.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/cascade.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/chunked.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/common_logger.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/conditional_get.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/config.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/constants.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/content_length.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/content_type.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/deflater.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/directory.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/etag.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/events.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/file.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/files.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/head.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/headers.rb delete mode 100755 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/lint.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/lock.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/logger.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/media_type.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/method_override.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/mime.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/mock.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/mock_request.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/mock_response.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/multipart.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/multipart/generator.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/multipart/parser.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/multipart/uploaded_file.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/null_logger.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/query_parser.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/recursive.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/reloader.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/request.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/response.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/rewindable_input.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/runtime.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/sendfile.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/show_exceptions.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/show_status.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/static.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/tempfile_reaper.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/urlmap.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/utils.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/version.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop-capybara.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/capybara/config_formatter.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/capybara/description_extractor.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/capybara/version.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/current_path_expectation.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/match_style.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/mixin/capybara_help.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/mixin/css_selector.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/negation_matcher.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/specific_actions.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/specific_finders.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/specific_matcher.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/visibility_matcher.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara_cops.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/default.yml delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/obsoletion.yml delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop-performance.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/mixin/regexp_metacharacter.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/mixin/sort_block.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/ancestors_include.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/bind_call.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/block_given_with_explicit_block.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/caller.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/case_when_splat.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/casecmp.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/chain_array_allocation.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/collection_literal_in_loop.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/compare_with_block.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/concurrent_monotonic_time.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/constant_regexp.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/count.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/delete_prefix.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/delete_suffix.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/detect.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/double_start_end_with.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/end_with.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/fixed_size.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/flat_map.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/inefficient_hash_search.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/io_readlines.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/map_compact.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/method_object_as_block.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/open_struct.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/range_include.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_block_call.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_match.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_merge.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_sort_block.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_string_chars.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/regexp_match.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_each.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_first.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/select_map.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/size.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sort_reverse.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/squeeze.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/start_with.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_identifier_argument.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_include.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_replacement.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sum.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/times_map.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/unfreeze_string.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/uri_default_parser.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance_cops.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/inject.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/version.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/config/default.yml delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/config/obsoletion.yml delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop-rails.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/active_record_helper.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/active_record_migrations_helper.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/class_send_node_helper.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/enforce_superclass.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/index_method.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/migrations_helper.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/target_rails_version.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/action_controller_flash_before_render.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/action_controller_test_case.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/action_filter.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/action_order.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_record_aliases.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_record_callbacks_order.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_record_override.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_support_aliases.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_support_on_load.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/add_column_index.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/after_commit_override.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/application_controller.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/application_job.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/application_mailer.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/application_record.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/arel_star.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/assert_not.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/attribute_default_block_value.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/belongs_to.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/blank.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/bulk_change_table.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/compact_blank.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/content_tag.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/create_table_with_timestamps.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/date.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/default_scope.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/delegate.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/delegate_allow_blank.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/dot_separated_keys.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/duplicate_association.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/duplicate_scope.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/duration_arithmetic.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/dynamic_find_by.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/eager_evaluation_log_message.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/enum_hash.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/enum_uniqueness.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/environment_comparison.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/environment_variable_access.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/exit.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/expanded_date_range.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/file_path.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/find_by.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/find_by_id.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/find_each.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/freeze_time.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/has_and_belongs_to_many.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/helper_instance_variable.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/http_positional_arguments.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/http_status.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/i18n_lazy_lookup.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/i18n_locale_assignment.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/i18n_locale_texts.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/ignored_columns_assignment.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/index_by.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/index_with.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/inquiry.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/inverse_of.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/link_to_blank.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/mailer_name.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/match_route.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/migration_class_name.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/negate_include.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/not_null_column.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/order_by_id.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/output.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/output_safety.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pick.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pluck.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pluck_id.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pluck_in_where.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pluralization_grammar.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/presence.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/present.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/rake_environment.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/read_write_attribute.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_allow_nil.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_foreign_key.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_travel_back.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/reflection_class_name.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/refute_methods.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/relative_date_constant.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/render_inline.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/render_plain_text.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/request_referer.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/require_dependency.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/response_parsed_body.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/reversible_migration.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/reversible_migration_method_definition.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/root_join_chain.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/root_pathname_methods.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/root_public_path.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/safe_navigation.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/safe_navigation_with_blank.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/save_bang.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/schema_comment.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/scope_args.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/short_i18n.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/skips_model_validations.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/squished_sql_heredocs.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/strip_heredoc.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/table_name_assignment.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/three_state_boolean_column.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/time_zone.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/time_zone_assignment.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/to_formatted_s.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/to_s_with_argument.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/transaction_exit_statement.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/uniq_before_pluck.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/unique_validation_without_index.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/unknown_env.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/unused_ignored_columns.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/validation.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_equals.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_exists.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_missing.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_not.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails_cops.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails/inject.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails/schema_loader.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails/schema_loader/schema.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails/version.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/config/default.yml delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/config/obsoletion.yml delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop-rspec.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/align_left_let_brace.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/align_right_let_brace.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/any_instance.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/around_block.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/base.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be_empty.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be_eq.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be_eql.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be_nil.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/before_after_all.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/feature_methods.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/match_style.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/negation_matcher.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/specific_actions.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/specific_finders.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/specific_matcher.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/change_by_zero.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/class_check.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/contain_exactly.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/context_method.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/context_wording.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/describe_class.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/describe_method.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/describe_symbol.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/described_class.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/described_class_module_wrapping.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/dialect.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/duplicated_metadata.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_example_group.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_hook.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_example.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_example_group.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_final_let.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_hook.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_subject.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/example_length.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/example_without_description.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/example_wording.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/expect_actual.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/expect_change.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/expect_in_hook.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/expect_output.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/consistent_parentheses_style.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/create_list.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/factory_name_style.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/file_path.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/focus.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/hook_argument.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/hooks_before_examples.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/identical_equality_assertion.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/implicit_block_expectation.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/implicit_expect.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/implicit_subject.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/indexed_let.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/instance_spy.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/instance_variable.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/it_behaves_like.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/iterated_expectation.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/leading_subject.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/leaky_constant_declaration.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/let_before_examples.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/let_setup.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/match_array.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/message_chain.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/message_expectation.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/message_spies.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/missing_example_group_argument.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/mixin/comments_help.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/mixin/empty_line_separation.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/mixin/final_end_location.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/mixin/inside_example_group.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/mixin/location_help.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/mixin/metadata.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/mixin/namespace.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/mixin/skip_or_pending.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/mixin/top_level_group.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/mixin/variable.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/multiple_describes.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/multiple_expectations.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/multiple_subjects.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/named_subject.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/nested_groups.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/no_expectation_example.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/not_to_not.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/overwriting_setup.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/pending.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/pending_without_reason.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/predicate_matcher.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/rails/avoid_setup_hook.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/rails/have_http_status.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/rails/http_status.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/rails/inferred_spec_type.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/rails/minitest_assertions.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/rails/travel_around.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/receive_counts.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/receive_never.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/redundant_around.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/repeated_description.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/repeated_example.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/repeated_example_group_body.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/repeated_example_group_description.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/repeated_include_example.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/return_from_stub.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/scattered_let.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/scattered_setup.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/shared_context.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/shared_examples.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/single_argument_message_chain.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/skip_block_inside_example.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/sort_metadata.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/stubbed_mock.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/subject_declaration.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/subject_stub.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/unspecified_exception.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/variable_definition.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/variable_name.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/verified_double_reference.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/verified_doubles.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/void_expect.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/yield.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec_cops.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/align_let_brace.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/concept.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/config_formatter.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/corrector/move_node.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/description_extractor.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/example.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/example_group.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/factory_bot.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/factory_bot/language.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/hook.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/inject.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/language.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/language/node_pattern.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/node.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/version.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/rspec/wording.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/config/default.yml delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/config/rbi.yml delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop-sorbet.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/binding_constant_without_type_alias.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/callback_conditionals_binding.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/constants_from_strings.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/forbid_include_const_literal.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/forbid_superclass_const_literal.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/forbid_t_unsafe.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/forbid_t_untyped.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/implicit_conversion_method.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/mixin/target_sorbet_version.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/obsolete_strict_memoization.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/one_ancestor_per_line.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/rbi/forbid_extend_t_sig_helpers_in_shims.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/rbi/forbid_rbi_outside_of_allowed_paths.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/rbi/single_line_rbi_class_module_definitions.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/redundant_extend_t_sig.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/sigils/enforce_single_sigil.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/sigils/false_sigil.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/sigils/has_sigil.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/sigils/ignore_sigil.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/sigils/strict_sigil.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/sigils/strong_sigil.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/sigils/true_sigil.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/sigils/valid_sigil.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/signatures/checked_true_in_signature.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/signatures/empty_line_after_sig.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/signatures/keyword_argument_ordering.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/signatures/signature_build_order.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/signatures/signature_cop.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet/type_alias_name.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/cop/sorbet_cops.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/sorbet.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/sorbet/inject.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-sorbet-0.7.3/lib/rubocop/sorbet/version.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-macho-4.0.0/LICENSE delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/base.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/calculators/length.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/components/bar.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/components/percentage.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/components/rate.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/components/time.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/components/title.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/errors/invalid_progress_error.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/format/formatter.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/format/molecule.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/format/string.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/output.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/non_tty.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/null.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/outputs/tty.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/progress.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/projector.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/projectors/smoothed_average.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/refinements.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/refinements/progress_enumerator.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/throttle.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/time.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/timer.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.13.0/lib/ruby-progressbar/version.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/simplecov_json_formatter-0.1.4/lib/simplecov_json_formatter.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/simplecov_json_formatter-0.1.4/lib/simplecov_json_formatter/result_exporter.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/simplecov_json_formatter-0.1.4/lib/simplecov_json_formatter/result_hash_formatter.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/simplecov_json_formatter-0.1.4/lib/simplecov_json_formatter/source_file_formatter.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/simplecov_json_formatter-0.1.4/lib/simplecov_json_formatter/version.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/warning-1.3.0/MIT-LICENSE diff --git a/.gitignore b/.gitignore index f81d112749a970..a94d0c41548661 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,7 @@ **/.yardoc # Unignore vendored gems +!**/vendor/bundle/ruby/*/gems/*/*LICENSE* !**/vendor/bundle/ruby/*/gems/*/lib !**/vendor/bundle/ruby/*/gems/addressable-*/data !**/vendor/bundle/ruby/*/gems/public_suffix-*/data @@ -51,181 +52,30 @@ !**/vendor/bundle/ruby/*/gems/rubocop-rspec-*/config !**/vendor/bundle/ruby/*/gems/rubocop-sorbet-*/config -# Ignore activesupport files we don't need -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/cache/ -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/array.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/array/conversions.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/array/extract.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/array/extract_options.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/array/grouping.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/array/inquiry.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/array/wrap.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/benchmark.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/big_decimal.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/big_decimal/conversions.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/class.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/class/attribute.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/class/attribute_accessors.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/class/subclasses.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/date.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/date/acts_like.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/date/blank.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/date/calculations.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/date/conversions.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/date/zones.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/date_and_time/calculations.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/date_and_time/compatibility.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/date_and_time/zones.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/date_time.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/date_time/acts_like.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/date_time/blank.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/date_time/calculations.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/date_time/compatibility.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/date_time/conversions.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/digest.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/digest/uuid.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/file.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/hash.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/hash/conversions.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/hash/indifferent_access.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/hash/reverse_merge.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/integer.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/integer/inflections.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/integer/multiple.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/integer/time.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/kernel.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/kernel/concern.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/kernel/reporting.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/kernel/singleton_class.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/load_error.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/marshal.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/module.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/name_error.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/numeric.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object/acts_like.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object/conversions.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object/inclusion.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object/instance_variables.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object/json.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object/to_param.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object/to_query.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object/with_options.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/range.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/range/compare_range.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/range/conversions.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/range/each.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/range/include_time_with_zone.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/range/overlaps.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/regexp.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/securerandom.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/string.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/string/access.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/string/behavior.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/string/conversions.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/string/inquiry.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/string/output_safety.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/string/starts_ends_with.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/string/strip.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/string/zones.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/symbol.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/symbol/starts_ends_with.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/time.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/time/acts_like.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/time/calculations.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/time/compatibility.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/time/conversions.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/time/zones.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/uri.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/concurrency/ -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/current_attributes/ -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/dependencies/ -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/deprecation/ -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/duration/ -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/json/ -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/locale/ -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/log_subscriber/ -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/messages/ -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/multibyte/ -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/notifications/ -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/number_helper/ -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/testing/ -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/values/ -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/xml_mini/ -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/actionable_error.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/all.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/array_inquirer.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/backtrace_cleaner.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/benchmarkable.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/builder.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/cache.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/callbacks.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/concern.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/configurable.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/configuration_file.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/current_attributes.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/dependencies.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/deprecation.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/descendants_tracker.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/digest.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/duration.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/encrypted_configuration.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/encrypted_file.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/environment_inquirer.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/evented_file_update_checker.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/execution_wrapper.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/executor.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/file_update_checker.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/fork_tracker.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/gem_version.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/gzip.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/hash_with_indifferent_access.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/i18n_railtie.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/json.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/key_generator.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/log_subscriber.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/logger.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/logger_silence.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/logger_thread_safe_level.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/message_encryptor.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/message_verifier.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/notifications.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/number_helper.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/option_merger.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/ordered_hash.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/ordered_options.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/parameter_filter.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/per_thread_registry.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/proxy_object.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/rails.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/railtie.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/reloader.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/rescuable.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/secure_compare_rotator.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/security_utils.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/string_inquirer.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/subscriber.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/tagged_logging.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/test_case.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/time.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/time_with_zone.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/version.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/xml_mini.rb -**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support.rb +# Ignore activesupport, except the ones we need. +**/vendor/bundle/ruby/*/gems/activesupport-*/lib/**/* +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/ +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/ +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/*/ +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/array/access.rb +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/enumerable.rb +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/file/atomic.rb +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/hash/deep_merge.rb +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/hash/deep_transform_values.rb +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/hash/except.rb +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/hash/keys.rb +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/hash/slice.rb +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object/blank.rb +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object/deep_dup.rb +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object/duplicable.rb +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object/try.rb +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/string/exclude.rb +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/string/filters.rb +!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/string/indent.rb # Ignore partially included gems where we don't need all files -**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/atomic/ -**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/atomic_reference/ -**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/collection/ -**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/concern/ -**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/executor/ -**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/synchronization/ -**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/thread_safe/ -**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/utility/ **/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/*/*.jar **/vendor/bundle/ruby/*/gems/i18n-*/lib/i18n/tests* -**/vendor/bundle/ruby/*/gems/thread_safe-*/lib/thread_safe/util **/vendor/gems/mechanize-*/.* **/vendor/gems/mechanize-*/*.md **/vendor/gems/mechanize-*/*.rdoc @@ -233,21 +83,11 @@ **/vendor/gems/mechanize-*/Gemfile **/vendor/gems/mechanize-*/Rakefile **/vendor/gems/mechanize-*/examples/ -**/vendor/gems/mechanize-*/lib/*.rb -**/vendor/gems/mechanize-*/lib/*.rb -**/vendor/gems/mechanize-*/lib/mechanize/http/agent.rb -**/vendor/gems/mechanize-*/lib/mechanize/http/*auth*.rb -**/vendor/gems/mechanize-*/lib/mechanize/c* -**/vendor/gems/mechanize-*/lib/mechanize/d* -**/vendor/gems/mechanize-*/lib/mechanize/e* -**/vendor/gems/mechanize-*/lib/mechanize/f* -**/vendor/gems/mechanize-*/lib/mechanize/h*.rb -**/vendor/gems/mechanize-*/lib/mechanize/i* -**/vendor/gems/mechanize-*/lib/mechanize/p* -**/vendor/gems/mechanize-*/lib/mechanize/r* -**/vendor/gems/mechanize-*/lib/mechanize/t* -**/vendor/gems/mechanize-*/lib/mechanize/u* -**/vendor/gems/mechanize-*/lib/mechanize/x* +**/vendor/gems/mechanize-*/lib/**/* +!**/vendor/gems/mechanize-*/lib/mechanize/ +!**/vendor/gems/mechanize-*/lib/mechanize/http/ +!**/vendor/gems/mechanize-*/lib/mechanize/http/content_disposition_parser.rb +!**/vendor/gems/mechanize-*/lib/mechanize/version.rb **/vendor/gems/mechanize-*/test/ # Ignore dependencies we don't wish to vendor @@ -281,6 +121,7 @@ **/vendor/bundle/ruby/*/gems/psych-*/ **/vendor/bundle/ruby/*/gems/pry-*/ **/vendor/bundle/ruby/*/gems/racc-*/ +**/vendor/bundle/ruby/*/gems/rack-*/ **/vendor/bundle/ruby/*/gems/rainbow-*/ **/vendor/bundle/ruby/*/gems/rbi-*/ **/vendor/bundle/ruby/*/gems/rdiscount-*/ @@ -299,9 +140,16 @@ **/vendor/bundle/ruby/*/gems/rspec-wait-*/ **/vendor/bundle/ruby/*/gems/rubocop-1*/ **/vendor/bundle/ruby/*/gems/rubocop-ast-*/ +**/vendor/bundle/ruby/*/gems/rubocop-capybara-*/ +**/vendor/bundle/ruby/*/gems/rubocop-performance-*/ +**/vendor/bundle/ruby/*/gems/rubocop-rails-*/ +**/vendor/bundle/ruby/*/gems/rubocop-rspec-*/ +**/vendor/bundle/ruby/*/gems/rubocop-sorbet-*/ **/vendor/bundle/ruby/*/gems/ruby-prof-*/ +**/vendor/bundle/ruby/*/gems/ruby-progressbar-*/ **/vendor/bundle/ruby/*/gems/simplecov-*/ **/vendor/bundle/ruby/*/gems/simplecov-html-*/ +**/vendor/bundle/ruby/*/gems/simplecov_json_formatter-*/ **/vendor/bundle/ruby/*/gems/simpleidn-*/ **/vendor/bundle/ruby/*/gems/sorbet-*/ !**/vendor/bundle/ruby/*/gems/sorbet-runtime-*/ diff --git a/Library/Homebrew/livecheck/livecheck.rb b/Library/Homebrew/livecheck/livecheck.rb index 87114521df78f1..0c031d8fd3d1ae 100644 --- a/Library/Homebrew/livecheck/livecheck.rb +++ b/Library/Homebrew/livecheck/livecheck.rb @@ -7,7 +7,6 @@ require "livecheck/skip_conditions" require "livecheck/strategy" require "addressable" -require "ruby-progressbar" require "uri" module Homebrew @@ -208,6 +207,7 @@ def run_checks( stderr.puts Formatter.headline("Running checks", color: :blue) end + require "ruby-progressbar" progress = ProgressBar.create( total: formulae_and_casks_total, progress_mark: "#", diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/MIT-LICENSE b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/MIT-LICENSE new file mode 100644 index 00000000000000..0a0ce3889a0c1c --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/MIT-LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2005-2022 David Heinemeier Hansson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/aliasing.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/aliasing.rb deleted file mode 100644 index 6f64d11627197e..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/aliasing.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class Module - # Allows you to make aliases for attributes, which includes - # getter, setter, and a predicate. - # - # class Content < ActiveRecord::Base - # # has a title attribute - # end - # - # class Email < Content - # alias_attribute :subject, :title - # end - # - # e = Email.find(1) - # e.title # => "Superstars" - # e.subject # => "Superstars" - # e.subject? # => true - # e.subject = "Megastars" - # e.title # => "Megastars" - def alias_attribute(new_name, old_name) - # The following reader methods use an explicit `self` receiver in order to - # support aliases that start with an uppercase letter. Otherwise, they would - # be resolved as constants instead. - module_eval <<-STR, __FILE__, __LINE__ + 1 - def #{new_name}; self.#{old_name}; end # def subject; self.title; end - def #{new_name}?; self.#{old_name}?; end # def subject?; self.title?; end - def #{new_name}=(v); self.#{old_name} = v; end # def subject=(v); self.title = v; end - STR - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/anonymous.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/anonymous.rb deleted file mode 100644 index d1c86b8722d51c..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/anonymous.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -class Module - # A module may or may not have a name. - # - # module M; end - # M.name # => "M" - # - # m = Module.new - # m.name # => nil - # - # +anonymous?+ method returns true if module does not have a name, false otherwise: - # - # Module.new.anonymous? # => true - # - # module M; end - # M.anonymous? # => false - # - # A module gets a name when it is first assigned to a constant. Either - # via the +module+ or +class+ keyword or by an explicit assignment: - # - # m = Module.new # creates an anonymous module - # m.anonymous? # => true - # M = m # m gets a name here as a side-effect - # m.name # => "M" - # m.anonymous? # => false - def anonymous? - name.nil? - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/attr_internal.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/attr_internal.rb deleted file mode 100644 index 3bd66ff3bcee59..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/attr_internal.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -class Module - # Declares an attribute reader backed by an internally-named instance variable. - def attr_internal_reader(*attrs) - attrs.each { |attr_name| attr_internal_define(attr_name, :reader) } - end - - # Declares an attribute writer backed by an internally-named instance variable. - def attr_internal_writer(*attrs) - attrs.each { |attr_name| attr_internal_define(attr_name, :writer) } - end - - # Declares an attribute reader and writer backed by an internally-named instance - # variable. - def attr_internal_accessor(*attrs) - attr_internal_reader(*attrs) - attr_internal_writer(*attrs) - end - alias_method :attr_internal, :attr_internal_accessor - - class << self; attr_accessor :attr_internal_naming_format end - self.attr_internal_naming_format = "@_%s" - - private - def attr_internal_ivar_name(attr) - Module.attr_internal_naming_format % attr - end - - def attr_internal_define(attr_name, type) - internal_name = attr_internal_ivar_name(attr_name).delete_prefix("@") - # use native attr_* methods as they are faster on some Ruby implementations - public_send("attr_#{type}", internal_name) - attr_name, internal_name = "#{attr_name}=", "#{internal_name}=" if type == :writer - alias_method attr_name, internal_name - remove_method internal_name - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/attribute_accessors.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/attribute_accessors.rb deleted file mode 100644 index 1db905ff658d47..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/attribute_accessors.rb +++ /dev/null @@ -1,206 +0,0 @@ -# frozen_string_literal: true - -# Extends the module object with class/module and instance accessors for -# class/module attributes, just like the native attr* accessors for instance -# attributes. -class Module - # Defines a class attribute and creates a class and instance reader methods. - # The underlying class variable is set to +nil+, if it is not previously - # defined. All class and instance methods created will be public, even if - # this method is called with a private or protected access modifier. - # - # module HairColors - # mattr_reader :hair_colors - # end - # - # HairColors.hair_colors # => nil - # HairColors.class_variable_set("@@hair_colors", [:brown, :black]) - # HairColors.hair_colors # => [:brown, :black] - # - # The attribute name must be a valid method name in Ruby. - # - # module Foo - # mattr_reader :"1_Badname" - # end - # # => NameError: invalid attribute name: 1_Badname - # - # To omit the instance reader method, pass - # instance_reader: false or instance_accessor: false. - # - # module HairColors - # mattr_reader :hair_colors, instance_reader: false - # end - # - # class Person - # include HairColors - # end - # - # Person.new.hair_colors # => NoMethodError - # - # You can set a default value for the attribute. - # - # module HairColors - # mattr_reader :hair_colors, default: [:brown, :black, :blonde, :red] - # end - # - # class Person - # include HairColors - # end - # - # Person.new.hair_colors # => [:brown, :black, :blonde, :red] - def mattr_reader(*syms, instance_reader: true, instance_accessor: true, default: nil, location: nil) - raise TypeError, "module attributes should be defined directly on class, not singleton" if singleton_class? - location ||= caller_locations(1, 1).first - - definition = [] - syms.each do |sym| - raise NameError.new("invalid attribute name: #{sym}") unless /\A[_A-Za-z]\w*\z/.match?(sym) - - definition << "def self.#{sym}; @@#{sym}; end" - - if instance_reader && instance_accessor - definition << "def #{sym}; @@#{sym}; end" - end - - sym_default_value = (block_given? && default.nil?) ? yield : default - class_variable_set("@@#{sym}", sym_default_value) unless sym_default_value.nil? && class_variable_defined?("@@#{sym}") - end - - module_eval(definition.join(";"), location.path, location.lineno) - end - alias :cattr_reader :mattr_reader - - # Defines a class attribute and creates a class and instance writer methods to - # allow assignment to the attribute. All class and instance methods created - # will be public, even if this method is called with a private or protected - # access modifier. - # - # module HairColors - # mattr_writer :hair_colors - # end - # - # class Person - # include HairColors - # end - # - # HairColors.hair_colors = [:brown, :black] - # Person.class_variable_get("@@hair_colors") # => [:brown, :black] - # Person.new.hair_colors = [:blonde, :red] - # HairColors.class_variable_get("@@hair_colors") # => [:blonde, :red] - # - # To omit the instance writer method, pass - # instance_writer: false or instance_accessor: false. - # - # module HairColors - # mattr_writer :hair_colors, instance_writer: false - # end - # - # class Person - # include HairColors - # end - # - # Person.new.hair_colors = [:blonde, :red] # => NoMethodError - # - # You can set a default value for the attribute. - # - # module HairColors - # mattr_writer :hair_colors, default: [:brown, :black, :blonde, :red] - # end - # - # class Person - # include HairColors - # end - # - # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red] - def mattr_writer(*syms, instance_writer: true, instance_accessor: true, default: nil, location: nil) - raise TypeError, "module attributes should be defined directly on class, not singleton" if singleton_class? - location ||= caller_locations(1, 1).first - - definition = [] - syms.each do |sym| - raise NameError.new("invalid attribute name: #{sym}") unless /\A[_A-Za-z]\w*\z/.match?(sym) - definition << "def self.#{sym}=(val); @@#{sym} = val; end" - - if instance_writer && instance_accessor - definition << "def #{sym}=(val); @@#{sym} = val; end" - end - - sym_default_value = (block_given? && default.nil?) ? yield : default - class_variable_set("@@#{sym}", sym_default_value) unless sym_default_value.nil? && class_variable_defined?("@@#{sym}") - end - - module_eval(definition.join(";"), location.path, location.lineno) - end - alias :cattr_writer :mattr_writer - - # Defines both class and instance accessors for class attributes. - # All class and instance methods created will be public, even if - # this method is called with a private or protected access modifier. - # - # module HairColors - # mattr_accessor :hair_colors - # end - # - # class Person - # include HairColors - # end - # - # HairColors.hair_colors = [:brown, :black, :blonde, :red] - # HairColors.hair_colors # => [:brown, :black, :blonde, :red] - # Person.new.hair_colors # => [:brown, :black, :blonde, :red] - # - # If a subclass changes the value then that would also change the value for - # parent class. Similarly if parent class changes the value then that would - # change the value of subclasses too. - # - # class Citizen < Person - # end - # - # Citizen.new.hair_colors << :blue - # Person.new.hair_colors # => [:brown, :black, :blonde, :red, :blue] - # - # To omit the instance writer method, pass instance_writer: false. - # To omit the instance reader method, pass instance_reader: false. - # - # module HairColors - # mattr_accessor :hair_colors, instance_writer: false, instance_reader: false - # end - # - # class Person - # include HairColors - # end - # - # Person.new.hair_colors = [:brown] # => NoMethodError - # Person.new.hair_colors # => NoMethodError - # - # Or pass instance_accessor: false, to omit both instance methods. - # - # module HairColors - # mattr_accessor :hair_colors, instance_accessor: false - # end - # - # class Person - # include HairColors - # end - # - # Person.new.hair_colors = [:brown] # => NoMethodError - # Person.new.hair_colors # => NoMethodError - # - # You can set a default value for the attribute. - # - # module HairColors - # mattr_accessor :hair_colors, default: [:brown, :black, :blonde, :red] - # end - # - # class Person - # include HairColors - # end - # - # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red] - def mattr_accessor(*syms, instance_reader: true, instance_writer: true, instance_accessor: true, default: nil, &blk) - location = caller_locations(1, 1).first - mattr_reader(*syms, instance_reader: instance_reader, instance_accessor: instance_accessor, default: default, location: location, &blk) - mattr_writer(*syms, instance_writer: instance_writer, instance_accessor: instance_accessor, default: default, location: location) - end - alias :cattr_accessor :mattr_accessor -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb deleted file mode 100644 index ea4034303e1c04..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +++ /dev/null @@ -1,148 +0,0 @@ -# frozen_string_literal: true - -# Extends the module object with class/module and instance accessors for -# class/module attributes, just like the native attr* accessors for instance -# attributes, but does so on a per-thread basis. -# -# So the values are scoped within the Thread.current space under the class name -# of the module. -class Module - # Defines a per-thread class attribute and creates class and instance reader methods. - # The underlying per-thread class variable is set to +nil+, if it is not previously defined. - # - # module Current - # thread_mattr_reader :user - # end - # - # Current.user # => nil - # Thread.current[:attr_Current_user] = "DHH" - # Current.user # => "DHH" - # - # The attribute name must be a valid method name in Ruby. - # - # module Foo - # thread_mattr_reader :"1_Badname" - # end - # # => NameError: invalid attribute name: 1_Badname - # - # To omit the instance reader method, pass - # instance_reader: false or instance_accessor: false. - # - # class Current - # thread_mattr_reader :user, instance_reader: false - # end - # - # Current.new.user # => NoMethodError - def thread_mattr_reader(*syms, instance_reader: true, instance_accessor: true, default: nil) # :nodoc: - syms.each do |sym| - raise NameError.new("invalid attribute name: #{sym}") unless /^[_A-Za-z]\w*$/.match?(sym) - - # The following generated method concatenates `name` because we want it - # to work with inheritance via polymorphism. - class_eval(<<-EOS, __FILE__, __LINE__ + 1) - def self.#{sym} - Thread.current["attr_" + name + "_#{sym}"] - end - EOS - - if instance_reader && instance_accessor - class_eval(<<-EOS, __FILE__, __LINE__ + 1) - def #{sym} - self.class.#{sym} - end - EOS - end - - Thread.current["attr_" + name + "_#{sym}"] = default unless default.nil? - end - end - alias :thread_cattr_reader :thread_mattr_reader - - # Defines a per-thread class attribute and creates a class and instance writer methods to - # allow assignment to the attribute. - # - # module Current - # thread_mattr_writer :user - # end - # - # Current.user = "DHH" - # Thread.current[:attr_Current_user] # => "DHH" - # - # To omit the instance writer method, pass - # instance_writer: false or instance_accessor: false. - # - # class Current - # thread_mattr_writer :user, instance_writer: false - # end - # - # Current.new.user = "DHH" # => NoMethodError - def thread_mattr_writer(*syms, instance_writer: true, instance_accessor: true, default: nil) # :nodoc: - syms.each do |sym| - raise NameError.new("invalid attribute name: #{sym}") unless /^[_A-Za-z]\w*$/.match?(sym) - - # The following generated method concatenates `name` because we want it - # to work with inheritance via polymorphism. - class_eval(<<-EOS, __FILE__, __LINE__ + 1) - def self.#{sym}=(obj) - Thread.current["attr_" + name + "_#{sym}"] = obj - end - EOS - - if instance_writer && instance_accessor - class_eval(<<-EOS, __FILE__, __LINE__ + 1) - def #{sym}=(obj) - self.class.#{sym} = obj - end - EOS - end - - public_send("#{sym}=", default) unless default.nil? - end - end - alias :thread_cattr_writer :thread_mattr_writer - - # Defines both class and instance accessors for class attributes. - # - # class Account - # thread_mattr_accessor :user - # end - # - # Account.user = "DHH" - # Account.user # => "DHH" - # Account.new.user # => "DHH" - # - # If a subclass changes the value, the parent class' value is not changed. - # Similarly, if the parent class changes the value, the value of subclasses - # is not changed. - # - # class Customer < Account - # end - # - # Customer.user = "Rafael" - # Customer.user # => "Rafael" - # Account.user # => "DHH" - # - # To omit the instance writer method, pass instance_writer: false. - # To omit the instance reader method, pass instance_reader: false. - # - # class Current - # thread_mattr_accessor :user, instance_writer: false, instance_reader: false - # end - # - # Current.new.user = "DHH" # => NoMethodError - # Current.new.user # => NoMethodError - # - # Or pass instance_accessor: false, to omit both instance methods. - # - # class Current - # thread_mattr_accessor :user, instance_accessor: false - # end - # - # Current.new.user = "DHH" # => NoMethodError - # Current.new.user # => NoMethodError - def thread_mattr_accessor(*syms, instance_reader: true, instance_writer: true, instance_accessor: true, default: nil) - thread_mattr_reader(*syms, instance_reader: instance_reader, instance_accessor: instance_accessor, default: default) - thread_mattr_writer(*syms, instance_writer: instance_writer, instance_accessor: instance_accessor) - end - alias :thread_cattr_accessor :thread_mattr_accessor -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/concerning.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/concerning.rb deleted file mode 100644 index 36f5f85937cf9f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/concerning.rb +++ /dev/null @@ -1,140 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concern" - -class Module - # = Bite-sized separation of concerns - # - # We often find ourselves with a medium-sized chunk of behavior that we'd - # like to extract, but only mix in to a single class. - # - # Extracting a plain old Ruby object to encapsulate it and collaborate or - # delegate to the original object is often a good choice, but when there's - # no additional state to encapsulate or we're making DSL-style declarations - # about the parent class, introducing new collaborators can obfuscate rather - # than simplify. - # - # The typical route is to just dump everything in a monolithic class, perhaps - # with a comment, as a least-bad alternative. Using modules in separate files - # means tedious sifting to get a big-picture view. - # - # = Dissatisfying ways to separate small concerns - # - # == Using comments: - # - # class Todo < ApplicationRecord - # # Other todo implementation - # # ... - # - # ## Event tracking - # has_many :events - # - # before_create :track_creation - # - # private - # def track_creation - # # ... - # end - # end - # - # == With an inline module: - # - # Noisy syntax. - # - # class Todo < ApplicationRecord - # # Other todo implementation - # # ... - # - # module EventTracking - # extend ActiveSupport::Concern - # - # included do - # has_many :events - # before_create :track_creation - # end - # - # private - # def track_creation - # # ... - # end - # end - # include EventTracking - # end - # - # == Mix-in noise exiled to its own file: - # - # Once our chunk of behavior starts pushing the scroll-to-understand-it - # boundary, we give in and move it to a separate file. At this size, the - # increased overhead can be a reasonable tradeoff even if it reduces our - # at-a-glance perception of how things work. - # - # class Todo < ApplicationRecord - # # Other todo implementation - # # ... - # - # include TodoEventTracking - # end - # - # = Introducing Module#concerning - # - # By quieting the mix-in noise, we arrive at a natural, low-ceremony way to - # separate bite-sized concerns. - # - # class Todo < ApplicationRecord - # # Other todo implementation - # # ... - # - # concerning :EventTracking do - # included do - # has_many :events - # before_create :track_creation - # end - # - # private - # def track_creation - # # ... - # end - # end - # end - # - # Todo.ancestors - # # => [Todo, Todo::EventTracking, ApplicationRecord, Object] - # - # This small step has some wonderful ripple effects. We can - # * grok the behavior of our class in one glance, - # * clean up monolithic junk-drawer classes by separating their concerns, and - # * stop leaning on protected/private for crude "this is internal stuff" modularity. - # - # === Prepending concerning - # - # concerning supports a prepend: true argument which will prepend the - # concern instead of using include for it. - module Concerning - # Define a new concern and mix it in. - def concerning(topic, prepend: false, &block) - method = prepend ? :prepend : :include - __send__(method, concern(topic, &block)) - end - - # A low-cruft shortcut to define a concern. - # - # concern :EventTracking do - # ... - # end - # - # is equivalent to - # - # module EventTracking - # extend ActiveSupport::Concern - # - # ... - # end - def concern(topic, &module_definition) - const_set topic, Module.new { - extend ::ActiveSupport::Concern - module_eval(&module_definition) - } - end - end - include Concerning -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/delegation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/delegation.rb deleted file mode 100644 index a44a3e7c748bd4..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/delegation.rb +++ /dev/null @@ -1,330 +0,0 @@ -# frozen_string_literal: true - -require "set" - -class Module - # Error generated by +delegate+ when a method is called on +nil+ and +allow_nil+ - # option is not used. - class DelegationError < NoMethodError; end - - RUBY_RESERVED_KEYWORDS = %w(alias and BEGIN begin break case class def defined? do - else elsif END end ensure false for if in module next nil not or redo rescue retry - return self super then true undef unless until when while yield) - DELEGATION_RESERVED_KEYWORDS = %w(_ arg args block) - DELEGATION_RESERVED_METHOD_NAMES = Set.new( - RUBY_RESERVED_KEYWORDS + DELEGATION_RESERVED_KEYWORDS - ).freeze - - # Provides a +delegate+ class method to easily expose contained objects' - # public methods as your own. - # - # ==== Options - # * :to - Specifies the target object name as a symbol or string - # * :prefix - Prefixes the new method with the target name or a custom prefix - # * :allow_nil - If set to true, prevents a +Module::DelegationError+ - # from being raised - # * :private - If set to true, changes method visibility to private - # - # The macro receives one or more method names (specified as symbols or - # strings) and the name of the target object via the :to option - # (also a symbol or string). - # - # Delegation is particularly useful with Active Record associations: - # - # class Greeter < ActiveRecord::Base - # def hello - # 'hello' - # end - # - # def goodbye - # 'goodbye' - # end - # end - # - # class Foo < ActiveRecord::Base - # belongs_to :greeter - # delegate :hello, to: :greeter - # end - # - # Foo.new.hello # => "hello" - # Foo.new.goodbye # => NoMethodError: undefined method `goodbye' for # - # - # Multiple delegates to the same target are allowed: - # - # class Foo < ActiveRecord::Base - # belongs_to :greeter - # delegate :hello, :goodbye, to: :greeter - # end - # - # Foo.new.goodbye # => "goodbye" - # - # Methods can be delegated to instance variables, class variables, or constants - # by providing them as a symbols: - # - # class Foo - # CONSTANT_ARRAY = [0,1,2,3] - # @@class_array = [4,5,6,7] - # - # def initialize - # @instance_array = [8,9,10,11] - # end - # delegate :sum, to: :CONSTANT_ARRAY - # delegate :min, to: :@@class_array - # delegate :max, to: :@instance_array - # end - # - # Foo.new.sum # => 6 - # Foo.new.min # => 4 - # Foo.new.max # => 11 - # - # It's also possible to delegate a method to the class by using +:class+: - # - # class Foo - # def self.hello - # "world" - # end - # - # delegate :hello, to: :class - # end - # - # Foo.new.hello # => "world" - # - # Delegates can optionally be prefixed using the :prefix option. If the value - # is true, the delegate methods are prefixed with the name of the object being - # delegated to. - # - # Person = Struct.new(:name, :address) - # - # class Invoice < Struct.new(:client) - # delegate :name, :address, to: :client, prefix: true - # end - # - # john_doe = Person.new('John Doe', 'Vimmersvej 13') - # invoice = Invoice.new(john_doe) - # invoice.client_name # => "John Doe" - # invoice.client_address # => "Vimmersvej 13" - # - # It is also possible to supply a custom prefix. - # - # class Invoice < Struct.new(:client) - # delegate :name, :address, to: :client, prefix: :customer - # end - # - # invoice = Invoice.new(john_doe) - # invoice.customer_name # => 'John Doe' - # invoice.customer_address # => 'Vimmersvej 13' - # - # The delegated methods are public by default. - # Pass private: true to change that. - # - # class User < ActiveRecord::Base - # has_one :profile - # delegate :first_name, to: :profile - # delegate :date_of_birth, to: :profile, private: true - # - # def age - # Date.today.year - date_of_birth.year - # end - # end - # - # User.new.first_name # => "Tomas" - # User.new.date_of_birth # => NoMethodError: private method `date_of_birth' called for # - # User.new.age # => 2 - # - # If the target is +nil+ and does not respond to the delegated method a - # +Module::DelegationError+ is raised. If you wish to instead return +nil+, - # use the :allow_nil option. - # - # class User < ActiveRecord::Base - # has_one :profile - # delegate :age, to: :profile - # end - # - # User.new.age - # # => Module::DelegationError: User#age delegated to profile.age, but profile is nil - # - # But if not having a profile yet is fine and should not be an error - # condition: - # - # class User < ActiveRecord::Base - # has_one :profile - # delegate :age, to: :profile, allow_nil: true - # end - # - # User.new.age # nil - # - # Note that if the target is not +nil+ then the call is attempted regardless of the - # :allow_nil option, and thus an exception is still raised if said object - # does not respond to the method: - # - # class Foo - # def initialize(bar) - # @bar = bar - # end - # - # delegate :name, to: :@bar, allow_nil: true - # end - # - # Foo.new("Bar").name # raises NoMethodError: undefined method `name' - # - # The target method must be public, otherwise it will raise +NoMethodError+. - def delegate(*methods, to: nil, prefix: nil, allow_nil: nil, private: nil) - unless to - raise ArgumentError, "Delegation needs a target. Supply a keyword argument 'to' (e.g. delegate :hello, to: :greeter)." - end - - if prefix == true && /^[^a-z_]/.match?(to) - raise ArgumentError, "Can only automatically set the delegation prefix when delegating to a method." - end - - method_prefix = \ - if prefix - "#{prefix == true ? to : prefix}_" - else - "" - end - - location = caller_locations(1, 1).first - file, line = location.path, location.lineno - - to = to.to_s - to = "self.#{to}" if DELEGATION_RESERVED_METHOD_NAMES.include?(to) - - method_def = [] - method_names = [] - - methods.map do |method| - method_name = prefix ? "#{method_prefix}#{method}" : method - method_names << method_name.to_sym - - # Attribute writer methods only accept one argument. Makes sure []= - # methods still accept two arguments. - definition = if /[^\]]=$/.match?(method) - "arg" - elsif RUBY_VERSION >= "2.7" - "..." - else - "*args, &block" - end - - # The following generated method calls the target exactly once, storing - # the returned value in a dummy variable. - # - # Reason is twofold: On one hand doing less calls is in general better. - # On the other hand it could be that the target has side-effects, - # whereas conceptually, from the user point of view, the delegator should - # be doing one call. - if allow_nil - method = method.to_s - - method_def << - "def #{method_name}(#{definition})" << - " _ = #{to}" << - " if !_.nil? || nil.respond_to?(:#{method})" << - " _.#{method}(#{definition})" << - " end" << - "end" - else - method = method.to_s - method_name = method_name.to_s - - method_def << - "def #{method_name}(#{definition})" << - " _ = #{to}" << - " _.#{method}(#{definition})" << - "rescue NoMethodError => e" << - " if _.nil? && e.name == :#{method}" << - %( raise DelegationError, "#{self}##{method_name} delegated to #{to}.#{method}, but #{to} is nil: \#{self.inspect}") << - " else" << - " raise" << - " end" << - "end" - end - end - module_eval(method_def.join(";"), file, line) - private(*method_names) if private - method_names - end - - # When building decorators, a common pattern may emerge: - # - # class Partition - # def initialize(event) - # @event = event - # end - # - # def person - # detail.person || creator - # end - # - # private - # def respond_to_missing?(name, include_private = false) - # @event.respond_to?(name, include_private) - # end - # - # def method_missing(method, *args, &block) - # @event.send(method, *args, &block) - # end - # end - # - # With Module#delegate_missing_to, the above is condensed to: - # - # class Partition - # delegate_missing_to :@event - # - # def initialize(event) - # @event = event - # end - # - # def person - # detail.person || creator - # end - # end - # - # The target can be anything callable within the object, e.g. instance - # variables, methods, constants, etc. - # - # The delegated method must be public on the target, otherwise it will - # raise +DelegationError+. If you wish to instead return +nil+, - # use the :allow_nil option. - # - # The marshal_dump and _dump methods are exempt from - # delegation due to possible interference when calling - # Marshal.dump(object), should the delegation target method - # of object add or remove instance variables. - def delegate_missing_to(target, allow_nil: nil) - target = target.to_s - target = "self.#{target}" if DELEGATION_RESERVED_METHOD_NAMES.include?(target) - - module_eval <<-RUBY, __FILE__, __LINE__ + 1 - def respond_to_missing?(name, include_private = false) - # It may look like an oversight, but we deliberately do not pass - # +include_private+, because they do not get delegated. - - return false if name == :marshal_dump || name == :_dump - #{target}.respond_to?(name) || super - end - - def method_missing(method, *args, &block) - if #{target}.respond_to?(method) - #{target}.public_send(method, *args, &block) - else - begin - super - rescue NoMethodError - if #{target}.nil? - if #{allow_nil == true} - nil - else - raise DelegationError, "\#{method} delegated to #{target}, but #{target} is nil" - end - else - raise - end - end - end - end - ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true) - RUBY - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/deprecation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/deprecation.rb deleted file mode 100644 index 71c42eb3575c93..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/deprecation.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class Module - # deprecate :foo - # deprecate bar: 'message' - # deprecate :foo, :bar, baz: 'warning!', qux: 'gone!' - # - # You can also use custom deprecator instance: - # - # deprecate :foo, deprecator: MyLib::Deprecator.new - # deprecate :foo, bar: "warning!", deprecator: MyLib::Deprecator.new - # - # \Custom deprecators must respond to deprecation_warning(deprecated_method_name, message, caller_backtrace) - # method where you can implement your custom warning behavior. - # - # class MyLib::Deprecator - # def deprecation_warning(deprecated_method_name, message, caller_backtrace = nil) - # message = "#{deprecated_method_name} is deprecated and will be removed from MyLibrary | #{message}" - # Kernel.warn message - # end - # end - def deprecate(*method_names) - ActiveSupport::Deprecation.deprecate_methods(self, *method_names) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/introspection.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/introspection.rb deleted file mode 100644 index 7cdcab59b8a769..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/introspection.rb +++ /dev/null @@ -1,63 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/string/filters" -require "active_support/inflector" - -class Module - # Returns the name of the module containing this one. - # - # M::N.module_parent_name # => "M" - def module_parent_name - if defined?(@parent_name) - @parent_name - else - parent_name = name =~ /::[^:]+\z/ ? -$` : nil - @parent_name = parent_name unless frozen? - parent_name - end - end - - # Returns the module which contains this one according to its name. - # - # module M - # module N - # end - # end - # X = M::N - # - # M::N.module_parent # => M - # X.module_parent # => M - # - # The parent of top-level and anonymous modules is Object. - # - # M.module_parent # => Object - # Module.new.module_parent # => Object - def module_parent - module_parent_name ? ActiveSupport::Inflector.constantize(module_parent_name) : Object - end - - # Returns all the parents of this module according to its name, ordered from - # nested outwards. The receiver is not contained within the result. - # - # module M - # module N - # end - # end - # X = M::N - # - # M.module_parents # => [Object] - # M::N.module_parents # => [M, Object] - # X.module_parents # => [M, Object] - def module_parents - parents = [] - if module_parent_name - parts = module_parent_name.split("::") - until parts.empty? - parents << ActiveSupport::Inflector.constantize(parts * "::") - parts.pop - end - end - parents << Object unless parents.include? Object - parents - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/redefine_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/redefine_method.rb deleted file mode 100644 index 5bd8e6e973a3be..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/redefine_method.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -class Module - # Marks the named method as intended to be redefined, if it exists. - # Suppresses the Ruby method redefinition warning. Prefer - # #redefine_method where possible. - def silence_redefinition_of_method(method) - if method_defined?(method) || private_method_defined?(method) - # This suppresses the "method redefined" warning; the self-alias - # looks odd, but means we don't need to generate a unique name - alias_method method, method - end - end - - # Replaces the existing method definition, if there is one, with the passed - # block as its body. - def redefine_method(method, &block) - visibility = method_visibility(method) - silence_redefinition_of_method(method) - define_method(method, &block) - send(visibility, method) - end - - # Replaces the existing singleton method definition, if there is one, with - # the passed block as its body. - def redefine_singleton_method(method, &block) - singleton_class.redefine_method(method, &block) - end - - def method_visibility(method) # :nodoc: - case - when private_method_defined?(method) - :private - when protected_method_defined?(method) - :protected - else - :public - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/remove_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/remove_method.rb deleted file mode 100644 index 97eb5f9eca69d7..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/module/remove_method.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/redefine_method" - -class Module - # Removes the named method, if it exists. - def remove_possible_method(method) - if method_defined?(method) || private_method_defined?(method) - undef_method(method) - end - end - - # Removes the named singleton method, if it exists. - def remove_possible_singleton_method(method) - singleton_class.remove_possible_method(method) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/numeric/bytes.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/numeric/bytes.rb deleted file mode 100644 index b002eba40690e0..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/numeric/bytes.rb +++ /dev/null @@ -1,66 +0,0 @@ -# frozen_string_literal: true - -class Numeric - KILOBYTE = 1024 - MEGABYTE = KILOBYTE * 1024 - GIGABYTE = MEGABYTE * 1024 - TERABYTE = GIGABYTE * 1024 - PETABYTE = TERABYTE * 1024 - EXABYTE = PETABYTE * 1024 - - # Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes - # - # 2.bytes # => 2 - def bytes - self - end - alias :byte :bytes - - # Returns the number of bytes equivalent to the kilobytes provided. - # - # 2.kilobytes # => 2048 - def kilobytes - self * KILOBYTE - end - alias :kilobyte :kilobytes - - # Returns the number of bytes equivalent to the megabytes provided. - # - # 2.megabytes # => 2_097_152 - def megabytes - self * MEGABYTE - end - alias :megabyte :megabytes - - # Returns the number of bytes equivalent to the gigabytes provided. - # - # 2.gigabytes # => 2_147_483_648 - def gigabytes - self * GIGABYTE - end - alias :gigabyte :gigabytes - - # Returns the number of bytes equivalent to the terabytes provided. - # - # 2.terabytes # => 2_199_023_255_552 - def terabytes - self * TERABYTE - end - alias :terabyte :terabytes - - # Returns the number of bytes equivalent to the petabytes provided. - # - # 2.petabytes # => 2_251_799_813_685_248 - def petabytes - self * PETABYTE - end - alias :petabyte :petabytes - - # Returns the number of bytes equivalent to the exabytes provided. - # - # 2.exabytes # => 2_305_843_009_213_693_952 - def exabytes - self * EXABYTE - end - alias :exabyte :exabytes -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/numeric/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/numeric/conversions.rb deleted file mode 100644 index 3e623e0d1770bc..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/numeric/conversions.rb +++ /dev/null @@ -1,140 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/big_decimal/conversions" -require "active_support/number_helper" - -module ActiveSupport - module NumericWithFormat - # Provides options for converting numbers into formatted strings. - # Options are provided for phone numbers, currency, percentage, - # precision, positional notation, file size and pretty printing. - # - # ==== Options - # - # For details on which formats use which options, see ActiveSupport::NumberHelper - # - # ==== Examples - # - # Phone Numbers: - # 5551234.to_s(:phone) # => "555-1234" - # 1235551234.to_s(:phone) # => "123-555-1234" - # 1235551234.to_s(:phone, area_code: true) # => "(123) 555-1234" - # 1235551234.to_s(:phone, delimiter: ' ') # => "123 555 1234" - # 1235551234.to_s(:phone, area_code: true, extension: 555) # => "(123) 555-1234 x 555" - # 1235551234.to_s(:phone, country_code: 1) # => "+1-123-555-1234" - # 1235551234.to_s(:phone, country_code: 1, extension: 1343, delimiter: '.') - # # => "+1.123.555.1234 x 1343" - # - # Currency: - # 1234567890.50.to_s(:currency) # => "$1,234,567,890.50" - # 1234567890.506.to_s(:currency) # => "$1,234,567,890.51" - # 1234567890.506.to_s(:currency, precision: 3) # => "$1,234,567,890.506" - # 1234567890.506.to_s(:currency, round_mode: :down) # => "$1,234,567,890.50" - # 1234567890.506.to_s(:currency, locale: :fr) # => "1 234 567 890,51 €" - # -1234567890.50.to_s(:currency, negative_format: '(%u%n)') - # # => "($1,234,567,890.50)" - # 1234567890.50.to_s(:currency, unit: '£', separator: ',', delimiter: '') - # # => "£1234567890,50" - # 1234567890.50.to_s(:currency, unit: '£', separator: ',', delimiter: '', format: '%n %u') - # # => "1234567890,50 £" - # - # Percentage: - # 100.to_s(:percentage) # => "100.000%" - # 100.to_s(:percentage, precision: 0) # => "100%" - # 1000.to_s(:percentage, delimiter: '.', separator: ',') # => "1.000,000%" - # 302.24398923423.to_s(:percentage, precision: 5) # => "302.24399%" - # 302.24398923423.to_s(:percentage, round_mode: :down) # => "302.243%" - # 1000.to_s(:percentage, locale: :fr) # => "1 000,000%" - # 100.to_s(:percentage, format: '%n %') # => "100.000 %" - # - # Delimited: - # 12345678.to_s(:delimited) # => "12,345,678" - # 12345678.05.to_s(:delimited) # => "12,345,678.05" - # 12345678.to_s(:delimited, delimiter: '.') # => "12.345.678" - # 12345678.to_s(:delimited, delimiter: ',') # => "12,345,678" - # 12345678.05.to_s(:delimited, separator: ' ') # => "12,345,678 05" - # 12345678.05.to_s(:delimited, locale: :fr) # => "12 345 678,05" - # 98765432.98.to_s(:delimited, delimiter: ' ', separator: ',') - # # => "98 765 432,98" - # - # Rounded: - # 111.2345.to_s(:rounded) # => "111.235" - # 111.2345.to_s(:rounded, precision: 2) # => "111.23" - # 111.2345.to_s(:rounded, precision: 2, round_mode: :up) # => "111.24" - # 13.to_s(:rounded, precision: 5) # => "13.00000" - # 389.32314.to_s(:rounded, precision: 0) # => "389" - # 111.2345.to_s(:rounded, significant: true) # => "111" - # 111.2345.to_s(:rounded, precision: 1, significant: true) # => "100" - # 13.to_s(:rounded, precision: 5, significant: true) # => "13.000" - # 111.234.to_s(:rounded, locale: :fr) # => "111,234" - # 13.to_s(:rounded, precision: 5, significant: true, strip_insignificant_zeros: true) - # # => "13" - # 389.32314.to_s(:rounded, precision: 4, significant: true) # => "389.3" - # 1111.2345.to_s(:rounded, precision: 2, separator: ',', delimiter: '.') - # # => "1.111,23" - # - # Human-friendly size in Bytes: - # 123.to_s(:human_size) # => "123 Bytes" - # 1234.to_s(:human_size) # => "1.21 KB" - # 12345.to_s(:human_size) # => "12.1 KB" - # 1234567.to_s(:human_size) # => "1.18 MB" - # 1234567890.to_s(:human_size) # => "1.15 GB" - # 1234567890123.to_s(:human_size) # => "1.12 TB" - # 1234567890123456.to_s(:human_size) # => "1.1 PB" - # 1234567890123456789.to_s(:human_size) # => "1.07 EB" - # 1234567.to_s(:human_size, precision: 2) # => "1.2 MB" - # 1234567.to_s(:human_size, precision: 2, round_mode: :up) # => "1.3 MB" - # 483989.to_s(:human_size, precision: 2) # => "470 KB" - # 1234567.to_s(:human_size, precision: 2, separator: ',') # => "1,2 MB" - # 1234567890123.to_s(:human_size, precision: 5) # => "1.1228 TB" - # 524288000.to_s(:human_size, precision: 5) # => "500 MB" - # - # Human-friendly format: - # 123.to_s(:human) # => "123" - # 1234.to_s(:human) # => "1.23 Thousand" - # 12345.to_s(:human) # => "12.3 Thousand" - # 1234567.to_s(:human) # => "1.23 Million" - # 1234567890.to_s(:human) # => "1.23 Billion" - # 1234567890123.to_s(:human) # => "1.23 Trillion" - # 1234567890123456.to_s(:human) # => "1.23 Quadrillion" - # 1234567890123456789.to_s(:human) # => "1230 Quadrillion" - # 489939.to_s(:human, precision: 2) # => "490 Thousand" - # 489939.to_s(:human, precision: 2, round_mode: :down) # => "480 Thousand" - # 489939.to_s(:human, precision: 4) # => "489.9 Thousand" - # 1234567.to_s(:human, precision: 4, - # significant: false) # => "1.2346 Million" - # 1234567.to_s(:human, precision: 1, - # separator: ',', - # significant: false) # => "1,2 Million" - def to_s(format = nil, options = nil) - case format - when nil - super() - when Integer, String - super(format) - when :phone - ActiveSupport::NumberHelper.number_to_phone(self, options || {}) - when :currency - ActiveSupport::NumberHelper.number_to_currency(self, options || {}) - when :percentage - ActiveSupport::NumberHelper.number_to_percentage(self, options || {}) - when :delimited - ActiveSupport::NumberHelper.number_to_delimited(self, options || {}) - when :rounded - ActiveSupport::NumberHelper.number_to_rounded(self, options || {}) - when :human - ActiveSupport::NumberHelper.number_to_human(self, options || {}) - when :human_size - ActiveSupport::NumberHelper.number_to_human_size(self, options || {}) - when Symbol - super() - else - super(format) - end - end - end -end - -Integer.prepend ActiveSupport::NumericWithFormat -Float.prepend ActiveSupport::NumericWithFormat -BigDecimal.prepend ActiveSupport::NumericWithFormat diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/numeric/time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/numeric/time.rb deleted file mode 100644 index bc4627f7a297b6..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/numeric/time.rb +++ /dev/null @@ -1,66 +0,0 @@ -# frozen_string_literal: true - -require "active_support/duration" -require "active_support/core_ext/time/calculations" -require "active_support/core_ext/time/acts_like" -require "active_support/core_ext/date/calculations" -require "active_support/core_ext/date/acts_like" - -class Numeric - # Returns a Duration instance matching the number of seconds provided. - # - # 2.seconds # => 2 seconds - def seconds - ActiveSupport::Duration.seconds(self) - end - alias :second :seconds - - # Returns a Duration instance matching the number of minutes provided. - # - # 2.minutes # => 2 minutes - def minutes - ActiveSupport::Duration.minutes(self) - end - alias :minute :minutes - - # Returns a Duration instance matching the number of hours provided. - # - # 2.hours # => 2 hours - def hours - ActiveSupport::Duration.hours(self) - end - alias :hour :hours - - # Returns a Duration instance matching the number of days provided. - # - # 2.days # => 2 days - def days - ActiveSupport::Duration.days(self) - end - alias :day :days - - # Returns a Duration instance matching the number of weeks provided. - # - # 2.weeks # => 2 weeks - def weeks - ActiveSupport::Duration.weeks(self) - end - alias :week :weeks - - # Returns a Duration instance matching the number of fortnights provided. - # - # 2.fortnights # => 4 weeks - def fortnights - ActiveSupport::Duration.weeks(self * 2) - end - alias :fortnight :fortnights - - # Returns the number of milliseconds equivalent to the seconds provided. - # Used with the standard time durations. - # - # 2.in_milliseconds # => 2000 - # 1.hour.in_milliseconds # => 3600000 - def in_milliseconds - self * 1000 - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/string/inflections.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/string/inflections.rb deleted file mode 100644 index 9bf465bda3e974..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/string/inflections.rb +++ /dev/null @@ -1,293 +0,0 @@ -# frozen_string_literal: true - -require "active_support/inflector/methods" -require "active_support/inflector/transliterate" - -# String inflections define new methods on the String class to transform names for different purposes. -# For instance, you can figure out the name of a table from the name of a class. -# -# 'ScaleScore'.tableize # => "scale_scores" -# -class String - # Returns the plural form of the word in the string. - # - # If the optional parameter +count+ is specified, - # the singular form will be returned if count == 1. - # For any other value of +count+ the plural will be returned. - # - # If the optional parameter +locale+ is specified, - # the word will be pluralized as a word of that language. - # By default, this parameter is set to :en. - # You must define your own inflection rules for languages other than English. - # - # 'post'.pluralize # => "posts" - # 'octopus'.pluralize # => "octopi" - # 'sheep'.pluralize # => "sheep" - # 'words'.pluralize # => "words" - # 'the blue mailman'.pluralize # => "the blue mailmen" - # 'CamelOctopus'.pluralize # => "CamelOctopi" - # 'apple'.pluralize(1) # => "apple" - # 'apple'.pluralize(2) # => "apples" - # 'ley'.pluralize(:es) # => "leyes" - # 'ley'.pluralize(1, :es) # => "ley" - # - # See ActiveSupport::Inflector.pluralize. - def pluralize(count = nil, locale = :en) - locale = count if count.is_a?(Symbol) - if count == 1 - dup - else - ActiveSupport::Inflector.pluralize(self, locale) - end - end - - # The reverse of +pluralize+, returns the singular form of a word in a string. - # - # If the optional parameter +locale+ is specified, - # the word will be singularized as a word of that language. - # By default, this parameter is set to :en. - # You must define your own inflection rules for languages other than English. - # - # 'posts'.singularize # => "post" - # 'octopi'.singularize # => "octopus" - # 'sheep'.singularize # => "sheep" - # 'word'.singularize # => "word" - # 'the blue mailmen'.singularize # => "the blue mailman" - # 'CamelOctopi'.singularize # => "CamelOctopus" - # 'leyes'.singularize(:es) # => "ley" - # - # See ActiveSupport::Inflector.singularize. - def singularize(locale = :en) - ActiveSupport::Inflector.singularize(self, locale) - end - - # +constantize+ tries to find a declared constant with the name specified - # in the string. It raises a NameError when the name is not in CamelCase - # or is not initialized. - # - # 'Module'.constantize # => Module - # 'Class'.constantize # => Class - # 'blargle'.constantize # => NameError: wrong constant name blargle - # - # See ActiveSupport::Inflector.constantize. - def constantize - ActiveSupport::Inflector.constantize(self) - end - - # +safe_constantize+ tries to find a declared constant with the name specified - # in the string. It returns +nil+ when the name is not in CamelCase - # or is not initialized. - # - # 'Module'.safe_constantize # => Module - # 'Class'.safe_constantize # => Class - # 'blargle'.safe_constantize # => nil - # - # See ActiveSupport::Inflector.safe_constantize. - def safe_constantize - ActiveSupport::Inflector.safe_constantize(self) - end - - # By default, +camelize+ converts strings to UpperCamelCase. If the argument to camelize - # is set to :lower then camelize produces lowerCamelCase. - # - # +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces. - # - # 'active_record'.camelize # => "ActiveRecord" - # 'active_record'.camelize(:lower) # => "activeRecord" - # 'active_record/errors'.camelize # => "ActiveRecord::Errors" - # 'active_record/errors'.camelize(:lower) # => "activeRecord::Errors" - # - # +camelize+ is also aliased as +camelcase+. - # - # See ActiveSupport::Inflector.camelize. - def camelize(first_letter = :upper) - case first_letter - when :upper - ActiveSupport::Inflector.camelize(self, true) - when :lower - ActiveSupport::Inflector.camelize(self, false) - else - raise ArgumentError, "Invalid option, use either :upper or :lower." - end - end - alias_method :camelcase, :camelize - - # Capitalizes all the words and replaces some characters in the string to create - # a nicer looking title. +titleize+ is meant for creating pretty output. It is not - # used in the Rails internals. - # - # The trailing '_id','Id'.. can be kept and capitalized by setting the - # optional parameter +keep_id_suffix+ to true. - # By default, this parameter is false. - # - # 'man from the boondocks'.titleize # => "Man From The Boondocks" - # 'x-men: the last stand'.titleize # => "X Men: The Last Stand" - # 'string_ending_with_id'.titleize(keep_id_suffix: true) # => "String Ending With Id" - # - # +titleize+ is also aliased as +titlecase+. - # - # See ActiveSupport::Inflector.titleize. - def titleize(keep_id_suffix: false) - ActiveSupport::Inflector.titleize(self, keep_id_suffix: keep_id_suffix) - end - alias_method :titlecase, :titleize - - # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string. - # - # +underscore+ will also change '::' to '/' to convert namespaces to paths. - # - # 'ActiveModel'.underscore # => "active_model" - # 'ActiveModel::Errors'.underscore # => "active_model/errors" - # - # See ActiveSupport::Inflector.underscore. - def underscore - ActiveSupport::Inflector.underscore(self) - end - - # Replaces underscores with dashes in the string. - # - # 'puni_puni'.dasherize # => "puni-puni" - # - # See ActiveSupport::Inflector.dasherize. - def dasherize - ActiveSupport::Inflector.dasherize(self) - end - - # Removes the module part from the constant expression in the string. - # - # 'ActiveSupport::Inflector::Inflections'.demodulize # => "Inflections" - # 'Inflections'.demodulize # => "Inflections" - # '::Inflections'.demodulize # => "Inflections" - # ''.demodulize # => '' - # - # See ActiveSupport::Inflector.demodulize. - # - # See also +deconstantize+. - def demodulize - ActiveSupport::Inflector.demodulize(self) - end - - # Removes the rightmost segment from the constant expression in the string. - # - # 'Net::HTTP'.deconstantize # => "Net" - # '::Net::HTTP'.deconstantize # => "::Net" - # 'String'.deconstantize # => "" - # '::String'.deconstantize # => "" - # ''.deconstantize # => "" - # - # See ActiveSupport::Inflector.deconstantize. - # - # See also +demodulize+. - def deconstantize - ActiveSupport::Inflector.deconstantize(self) - end - - # Replaces special characters in a string so that it may be used as part of a 'pretty' URL. - # - # If the optional parameter +locale+ is specified, - # the word will be parameterized as a word of that language. - # By default, this parameter is set to nil and it will use - # the configured I18n.locale. - # - # class Person - # def to_param - # "#{id}-#{name.parameterize}" - # end - # end - # - # @person = Person.find(1) - # # => # - # - # <%= link_to(@person.name, person_path) %> - # # => Donald E. Knuth - # - # To preserve the case of the characters in a string, use the +preserve_case+ argument. - # - # class Person - # def to_param - # "#{id}-#{name.parameterize(preserve_case: true)}" - # end - # end - # - # @person = Person.find(1) - # # => # - # - # <%= link_to(@person.name, person_path) %> - # # => Donald E. Knuth - # - # See ActiveSupport::Inflector.parameterize. - def parameterize(separator: "-", preserve_case: false, locale: nil) - ActiveSupport::Inflector.parameterize(self, separator: separator, preserve_case: preserve_case, locale: locale) - end - - # Creates the name of a table like Rails does for models to table names. This method - # uses the +pluralize+ method on the last word in the string. - # - # 'RawScaledScorer'.tableize # => "raw_scaled_scorers" - # 'ham_and_egg'.tableize # => "ham_and_eggs" - # 'fancyCategory'.tableize # => "fancy_categories" - # - # See ActiveSupport::Inflector.tableize. - def tableize - ActiveSupport::Inflector.tableize(self) - end - - # Creates a class name from a plural table name like Rails does for table names to models. - # Note that this returns a string and not a class. (To convert to an actual class - # follow +classify+ with +constantize+.) - # - # 'ham_and_eggs'.classify # => "HamAndEgg" - # 'posts'.classify # => "Post" - # - # See ActiveSupport::Inflector.classify. - def classify - ActiveSupport::Inflector.classify(self) - end - - # Capitalizes the first word, turns underscores into spaces, and (by default)strips a - # trailing '_id' if present. - # Like +titleize+, this is meant for creating pretty output. - # - # The capitalization of the first word can be turned off by setting the - # optional parameter +capitalize+ to false. - # By default, this parameter is true. - # - # The trailing '_id' can be kept and capitalized by setting the - # optional parameter +keep_id_suffix+ to true. - # By default, this parameter is false. - # - # 'employee_salary'.humanize # => "Employee salary" - # 'author_id'.humanize # => "Author" - # 'author_id'.humanize(capitalize: false) # => "author" - # '_id'.humanize # => "Id" - # 'author_id'.humanize(keep_id_suffix: true) # => "Author Id" - # - # See ActiveSupport::Inflector.humanize. - def humanize(capitalize: true, keep_id_suffix: false) - ActiveSupport::Inflector.humanize(self, capitalize: capitalize, keep_id_suffix: keep_id_suffix) - end - - # Converts just the first character to uppercase. - # - # 'what a Lovely Day'.upcase_first # => "What a Lovely Day" - # 'w'.upcase_first # => "W" - # ''.upcase_first # => "" - # - # See ActiveSupport::Inflector.upcase_first. - def upcase_first - ActiveSupport::Inflector.upcase_first(self) - end - - # Creates a foreign key name from a class name. - # +separate_class_name_and_id_with_underscore+ sets whether - # the method should put '_' between the name and 'id'. - # - # 'Message'.foreign_key # => "message_id" - # 'Message'.foreign_key(false) # => "messageid" - # 'Admin::Post'.foreign_key # => "post_id" - # - # See ActiveSupport::Inflector.foreign_key. - def foreign_key(separate_class_name_and_id_with_underscore = true) - ActiveSupport::Inflector.foreign_key(self, separate_class_name_and_id_with_underscore) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/string/multibyte.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/string/multibyte.rb deleted file mode 100644 index 0542121e39bce8..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/string/multibyte.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -require "active_support/multibyte" - -class String - # == Multibyte proxy - # - # +mb_chars+ is a multibyte safe proxy for string methods. - # - # It creates and returns an instance of the ActiveSupport::Multibyte::Chars class which - # encapsulates the original string. A Unicode safe version of all the String methods are defined on this proxy - # class. If the proxy class doesn't respond to a certain method, it's forwarded to the encapsulated string. - # - # >> "lj".mb_chars.upcase.to_s - # => "LJ" - # - # NOTE: Ruby 2.4 and later support native Unicode case mappings: - # - # >> "lj".upcase - # => "LJ" - # - # == Method chaining - # - # All the methods on the Chars proxy which normally return a string will return a Chars object. This allows - # method chaining on the result of any of these methods. - # - # name.mb_chars.reverse.length # => 12 - # - # == Interoperability and configuration - # - # The Chars object tries to be as interchangeable with String objects as possible: sorting and comparing between - # String and Char work like expected. The bang! methods change the internal string representation in the Chars - # object. Interoperability problems can be resolved easily with a +to_s+ call. - # - # For more information about the methods defined on the Chars proxy see ActiveSupport::Multibyte::Chars. For - # information about how to change the default Multibyte behavior see ActiveSupport::Multibyte. - def mb_chars - ActiveSupport::Multibyte.proxy_class.new(self) - end - - # Returns +true+ if string has utf_8 encoding. - # - # utf_8_str = "some string".encode "UTF-8" - # iso_str = "some string".encode "ISO-8859-1" - # - # utf_8_str.is_utf8? # => true - # iso_str.is_utf8? # => false - def is_utf8? - case encoding - when Encoding::UTF_8, Encoding::US_ASCII - valid_encoding? - when Encoding::ASCII_8BIT - dup.force_encoding(Encoding::UTF_8).valid_encoding? - else - false - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/i18n.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/i18n.rb deleted file mode 100644 index 39dab1cc71aa3b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/i18n.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/hash/deep_merge" -require "active_support/core_ext/hash/except" -require "active_support/core_ext/hash/slice" -begin - require "i18n" -rescue LoadError => e - $stderr.puts "The i18n gem is not available. Please add it to your Gemfile and run bundle install" - raise e -end -require "active_support/lazy_load_hooks" - -ActiveSupport.run_load_hooks(:i18n) -I18n.load_path << File.expand_path("locale/en.yml", __dir__) -I18n.load_path << File.expand_path("locale/en.rb", __dir__) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflections.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflections.rb deleted file mode 100644 index baf1cb30388d7e..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflections.rb +++ /dev/null @@ -1,72 +0,0 @@ -# frozen_string_literal: true - -require "active_support/inflector/inflections" - -#-- -# Defines the standard inflection rules. These are the starting point for -# new projects and are not considered complete. The current set of inflection -# rules is frozen. This means, we do not change them to become more complete. -# This is a safety measure to keep existing applications from breaking. -#++ -module ActiveSupport - Inflector.inflections(:en) do |inflect| - inflect.plural(/$/, "s") - inflect.plural(/s$/i, "s") - inflect.plural(/^(ax|test)is$/i, '\1es') - inflect.plural(/(octop|vir)us$/i, '\1i') - inflect.plural(/(octop|vir)i$/i, '\1i') - inflect.plural(/(alias|status)$/i, '\1es') - inflect.plural(/(bu)s$/i, '\1ses') - inflect.plural(/(buffal|tomat)o$/i, '\1oes') - inflect.plural(/([ti])um$/i, '\1a') - inflect.plural(/([ti])a$/i, '\1a') - inflect.plural(/sis$/i, "ses") - inflect.plural(/(?:([^f])fe|([lr])f)$/i, '\1\2ves') - inflect.plural(/(hive)$/i, '\1s') - inflect.plural(/([^aeiouy]|qu)y$/i, '\1ies') - inflect.plural(/(x|ch|ss|sh)$/i, '\1es') - inflect.plural(/(matr|vert|ind)(?:ix|ex)$/i, '\1ices') - inflect.plural(/^(m|l)ouse$/i, '\1ice') - inflect.plural(/^(m|l)ice$/i, '\1ice') - inflect.plural(/^(ox)$/i, '\1en') - inflect.plural(/^(oxen)$/i, '\1') - inflect.plural(/(quiz)$/i, '\1zes') - - inflect.singular(/s$/i, "") - inflect.singular(/(ss)$/i, '\1') - inflect.singular(/(n)ews$/i, '\1ews') - inflect.singular(/([ti])a$/i, '\1um') - inflect.singular(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i, '\1sis') - inflect.singular(/(^analy)(sis|ses)$/i, '\1sis') - inflect.singular(/([^f])ves$/i, '\1fe') - inflect.singular(/(hive)s$/i, '\1') - inflect.singular(/(tive)s$/i, '\1') - inflect.singular(/([lr])ves$/i, '\1f') - inflect.singular(/([^aeiouy]|qu)ies$/i, '\1y') - inflect.singular(/(s)eries$/i, '\1eries') - inflect.singular(/(m)ovies$/i, '\1ovie') - inflect.singular(/(x|ch|ss|sh)es$/i, '\1') - inflect.singular(/^(m|l)ice$/i, '\1ouse') - inflect.singular(/(bus)(es)?$/i, '\1') - inflect.singular(/(o)es$/i, '\1') - inflect.singular(/(shoe)s$/i, '\1') - inflect.singular(/(cris|test)(is|es)$/i, '\1is') - inflect.singular(/^(a)x[ie]s$/i, '\1xis') - inflect.singular(/(octop|vir)(us|i)$/i, '\1us') - inflect.singular(/(alias|status)(es)?$/i, '\1') - inflect.singular(/^(ox)en/i, '\1') - inflect.singular(/(vert|ind)ices$/i, '\1ex') - inflect.singular(/(matr)ices$/i, '\1ix') - inflect.singular(/(quiz)zes$/i, '\1') - inflect.singular(/(database)s$/i, '\1') - - inflect.irregular("person", "people") - inflect.irregular("man", "men") - inflect.irregular("child", "children") - inflect.irregular("sex", "sexes") - inflect.irregular("move", "moves") - inflect.irregular("zombie", "zombies") - - inflect.uncountable(%w(equipment information rice money species series fish sheep jeans police)) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflector.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflector.rb deleted file mode 100644 index d77f04c9c5fa15..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflector.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# in case active_support/inflector is required without the rest of active_support -require "active_support/inflector/inflections" -require "active_support/inflector/transliterate" -require "active_support/inflector/methods" - -require "active_support/inflections" -require "active_support/core_ext/string/inflections" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflector/inflections.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflector/inflections.rb deleted file mode 100644 index 99228a506f9c63..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflector/inflections.rb +++ /dev/null @@ -1,255 +0,0 @@ -# frozen_string_literal: true - -require "concurrent/map" -require "active_support/i18n" - -module ActiveSupport - module Inflector - extend self - - # A singleton instance of this class is yielded by Inflector.inflections, - # which can then be used to specify additional inflection rules. If passed - # an optional locale, rules for other languages can be specified. The - # default locale is :en. Only rules for English are provided. - # - # ActiveSupport::Inflector.inflections(:en) do |inflect| - # inflect.plural /^(ox)$/i, '\1\2en' - # inflect.singular /^(ox)en/i, '\1' - # - # inflect.irregular 'octopus', 'octopi' - # - # inflect.uncountable 'equipment' - # end - # - # New rules are added at the top. So in the example above, the irregular - # rule for octopus will now be the first of the pluralization and - # singularization rules that is runs. This guarantees that your rules run - # before any of the rules that may already have been loaded. - class Inflections - @__instance__ = Concurrent::Map.new - - class Uncountables < Array - def initialize - @regex_array = [] - super - end - - def delete(entry) - super entry - @regex_array.delete(to_regex(entry)) - end - - def <<(*word) - add(word) - end - - def add(words) - words = words.flatten.map(&:downcase) - concat(words) - @regex_array += words.map { |word| to_regex(word) } - self - end - - def uncountable?(str) - @regex_array.any? { |regex| regex.match? str } - end - - private - def to_regex(string) - /\b#{::Regexp.escape(string)}\Z/i - end - end - - def self.instance(locale = :en) - @__instance__[locale] ||= new - end - - attr_reader :plurals, :singulars, :uncountables, :humans, :acronyms - - attr_reader :acronyms_camelize_regex, :acronyms_underscore_regex # :nodoc: - - def initialize - @plurals, @singulars, @uncountables, @humans, @acronyms = [], [], Uncountables.new, [], {} - define_acronym_regex_patterns - end - - # Private, for the test suite. - def initialize_dup(orig) # :nodoc: - %w(plurals singulars uncountables humans acronyms).each do |scope| - instance_variable_set("@#{scope}", orig.public_send(scope).dup) - end - define_acronym_regex_patterns - end - - # Specifies a new acronym. An acronym must be specified as it will appear - # in a camelized string. An underscore string that contains the acronym - # will retain the acronym when passed to +camelize+, +humanize+, or - # +titleize+. A camelized string that contains the acronym will maintain - # the acronym when titleized or humanized, and will convert the acronym - # into a non-delimited single lowercase word when passed to +underscore+. - # - # acronym 'HTML' - # titleize 'html' # => 'HTML' - # camelize 'html' # => 'HTML' - # underscore 'MyHTML' # => 'my_html' - # - # The acronym, however, must occur as a delimited unit and not be part of - # another word for conversions to recognize it: - # - # acronym 'HTTP' - # camelize 'my_http_delimited' # => 'MyHTTPDelimited' - # camelize 'https' # => 'Https', not 'HTTPs' - # underscore 'HTTPS' # => 'http_s', not 'https' - # - # acronym 'HTTPS' - # camelize 'https' # => 'HTTPS' - # underscore 'HTTPS' # => 'https' - # - # Note: Acronyms that are passed to +pluralize+ will no longer be - # recognized, since the acronym will not occur as a delimited unit in the - # pluralized result. To work around this, you must specify the pluralized - # form as an acronym as well: - # - # acronym 'API' - # camelize(pluralize('api')) # => 'Apis' - # - # acronym 'APIs' - # camelize(pluralize('api')) # => 'APIs' - # - # +acronym+ may be used to specify any word that contains an acronym or - # otherwise needs to maintain a non-standard capitalization. The only - # restriction is that the word must begin with a capital letter. - # - # acronym 'RESTful' - # underscore 'RESTful' # => 'restful' - # underscore 'RESTfulController' # => 'restful_controller' - # titleize 'RESTfulController' # => 'RESTful Controller' - # camelize 'restful' # => 'RESTful' - # camelize 'restful_controller' # => 'RESTfulController' - # - # acronym 'McDonald' - # underscore 'McDonald' # => 'mcdonald' - # camelize 'mcdonald' # => 'McDonald' - def acronym(word) - @acronyms[word.downcase] = word - define_acronym_regex_patterns - end - - # Specifies a new pluralization rule and its replacement. The rule can - # either be a string or a regular expression. The replacement should - # always be a string that may include references to the matched data from - # the rule. - def plural(rule, replacement) - @uncountables.delete(rule) if rule.is_a?(String) - @uncountables.delete(replacement) - @plurals.prepend([rule, replacement]) - end - - # Specifies a new singularization rule and its replacement. The rule can - # either be a string or a regular expression. The replacement should - # always be a string that may include references to the matched data from - # the rule. - def singular(rule, replacement) - @uncountables.delete(rule) if rule.is_a?(String) - @uncountables.delete(replacement) - @singulars.prepend([rule, replacement]) - end - - # Specifies a new irregular that applies to both pluralization and - # singularization at the same time. This can only be used for strings, not - # regular expressions. You simply pass the irregular in singular and - # plural form. - # - # irregular 'octopus', 'octopi' - # irregular 'person', 'people' - def irregular(singular, plural) - @uncountables.delete(singular) - @uncountables.delete(plural) - - s0 = singular[0] - srest = singular[1..-1] - - p0 = plural[0] - prest = plural[1..-1] - - if s0.upcase == p0.upcase - plural(/(#{s0})#{srest}$/i, '\1' + prest) - plural(/(#{p0})#{prest}$/i, '\1' + prest) - - singular(/(#{s0})#{srest}$/i, '\1' + srest) - singular(/(#{p0})#{prest}$/i, '\1' + srest) - else - plural(/#{s0.upcase}(?i)#{srest}$/, p0.upcase + prest) - plural(/#{s0.downcase}(?i)#{srest}$/, p0.downcase + prest) - plural(/#{p0.upcase}(?i)#{prest}$/, p0.upcase + prest) - plural(/#{p0.downcase}(?i)#{prest}$/, p0.downcase + prest) - - singular(/#{s0.upcase}(?i)#{srest}$/, s0.upcase + srest) - singular(/#{s0.downcase}(?i)#{srest}$/, s0.downcase + srest) - singular(/#{p0.upcase}(?i)#{prest}$/, s0.upcase + srest) - singular(/#{p0.downcase}(?i)#{prest}$/, s0.downcase + srest) - end - end - - # Specifies words that are uncountable and should not be inflected. - # - # uncountable 'money' - # uncountable 'money', 'information' - # uncountable %w( money information rice ) - def uncountable(*words) - @uncountables.add(words) - end - - # Specifies a humanized form of a string by a regular expression rule or - # by a string mapping. When using a regular expression based replacement, - # the normal humanize formatting is called after the replacement. When a - # string is used, the human form should be specified as desired (example: - # 'The name', not 'the_name'). - # - # human /_cnt$/i, '\1_count' - # human 'legacy_col_person_name', 'Name' - def human(rule, replacement) - @humans.prepend([rule, replacement]) - end - - # Clears the loaded inflections within a given scope (default is - # :all). Give the scope as a symbol of the inflection type, the - # options are: :plurals, :singulars, :uncountables, - # :humans. - # - # clear :all - # clear :plurals - def clear(scope = :all) - case scope - when :all - @plurals, @singulars, @uncountables, @humans = [], [], Uncountables.new, [] - else - instance_variable_set "@#{scope}", [] - end - end - - private - def define_acronym_regex_patterns - @acronym_regex = @acronyms.empty? ? /(?=a)b/ : /#{@acronyms.values.join("|")}/ - @acronyms_camelize_regex = /^(?:#{@acronym_regex}(?=\b|[A-Z_])|\w)/ - @acronyms_underscore_regex = /(?:(?<=([A-Za-z\d]))|\b)(#{@acronym_regex})(?=\b|[^a-z])/ - end - end - - # Yields a singleton instance of Inflector::Inflections so you can specify - # additional inflector rules. If passed an optional locale, rules for other - # languages can be specified. If not specified, defaults to :en. - # Only rules for English are provided. - # - # ActiveSupport::Inflector.inflections(:en) do |inflect| - # inflect.uncountable 'rails' - # end - def inflections(locale = :en) - if block_given? - yield Inflections.instance(locale) - else - Inflections.instance(locale) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflector/methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflector/methods.rb deleted file mode 100644 index acb86fe1a4ab61..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflector/methods.rb +++ /dev/null @@ -1,400 +0,0 @@ -# frozen_string_literal: true - -require "active_support/inflections" -require "active_support/core_ext/object/blank" - -module ActiveSupport - # The Inflector transforms words from singular to plural, class names to table - # names, modularized class names to ones without, and class names to foreign - # keys. The default inflections for pluralization, singularization, and - # uncountable words are kept in inflections.rb. - # - # The Rails core team has stated patches for the inflections library will not - # be accepted in order to avoid breaking legacy applications which may be - # relying on errant inflections. If you discover an incorrect inflection and - # require it for your application or wish to define rules for languages other - # than English, please correct or add them yourself (explained below). - module Inflector - extend self - - # Returns the plural form of the word in the string. - # - # If passed an optional +locale+ parameter, the word will be - # pluralized using rules defined for that language. By default, - # this parameter is set to :en. - # - # pluralize('post') # => "posts" - # pluralize('octopus') # => "octopi" - # pluralize('sheep') # => "sheep" - # pluralize('words') # => "words" - # pluralize('CamelOctopus') # => "CamelOctopi" - # pluralize('ley', :es) # => "leyes" - def pluralize(word, locale = :en) - apply_inflections(word, inflections(locale).plurals, locale) - end - - # The reverse of #pluralize, returns the singular form of a word in a - # string. - # - # If passed an optional +locale+ parameter, the word will be - # singularized using rules defined for that language. By default, - # this parameter is set to :en. - # - # singularize('posts') # => "post" - # singularize('octopi') # => "octopus" - # singularize('sheep') # => "sheep" - # singularize('word') # => "word" - # singularize('CamelOctopi') # => "CamelOctopus" - # singularize('leyes', :es) # => "ley" - def singularize(word, locale = :en) - apply_inflections(word, inflections(locale).singulars, locale) - end - - # Converts strings to UpperCamelCase. - # If the +uppercase_first_letter+ parameter is set to false, then produces - # lowerCamelCase. - # - # Also converts '/' to '::' which is useful for converting - # paths to namespaces. - # - # camelize('active_model') # => "ActiveModel" - # camelize('active_model', false) # => "activeModel" - # camelize('active_model/errors') # => "ActiveModel::Errors" - # camelize('active_model/errors', false) # => "activeModel::Errors" - # - # As a rule of thumb you can think of +camelize+ as the inverse of - # #underscore, though there are cases where that does not hold: - # - # camelize(underscore('SSLError')) # => "SslError" - def camelize(term, uppercase_first_letter = true) - string = term.to_s - if uppercase_first_letter - string = string.sub(/^[a-z\d]*/) { |match| inflections.acronyms[match] || match.capitalize } - else - string = string.sub(inflections.acronyms_camelize_regex) { |match| match.downcase } - end - string.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{inflections.acronyms[$2] || $2.capitalize}" } - string.gsub!("/", "::") - string - end - - # Makes an underscored, lowercase form from the expression in the string. - # - # Changes '::' to '/' to convert namespaces to paths. - # - # underscore('ActiveModel') # => "active_model" - # underscore('ActiveModel::Errors') # => "active_model/errors" - # - # As a rule of thumb you can think of +underscore+ as the inverse of - # #camelize, though there are cases where that does not hold: - # - # camelize(underscore('SSLError')) # => "SslError" - def underscore(camel_cased_word) - return camel_cased_word unless /[A-Z-]|::/.match?(camel_cased_word) - word = camel_cased_word.to_s.gsub("::", "/") - word.gsub!(inflections.acronyms_underscore_regex) { "#{$1 && '_' }#{$2.downcase}" } - word.gsub!(/([A-Z])(?=[A-Z][a-z])|([a-z\d])(?=[A-Z])/) { ($1 || $2) << "_" } - word.tr!("-", "_") - word.downcase! - word - end - - # Tweaks an attribute name for display to end users. - # - # Specifically, performs these transformations: - # - # * Applies human inflection rules to the argument. - # * Deletes leading underscores, if any. - # * Removes a "_id" suffix if present. - # * Replaces underscores with spaces, if any. - # * Downcases all words except acronyms. - # * Capitalizes the first word. - # The capitalization of the first word can be turned off by setting the - # +:capitalize+ option to false (default is true). - # - # The trailing '_id' can be kept and capitalized by setting the - # optional parameter +keep_id_suffix+ to true (default is false). - # - # humanize('employee_salary') # => "Employee salary" - # humanize('author_id') # => "Author" - # humanize('author_id', capitalize: false) # => "author" - # humanize('_id') # => "Id" - # humanize('author_id', keep_id_suffix: true) # => "Author Id" - # - # If "SSL" was defined to be an acronym: - # - # humanize('ssl_error') # => "SSL error" - # - def humanize(lower_case_and_underscored_word, capitalize: true, keep_id_suffix: false) - result = lower_case_and_underscored_word.to_s.dup - - inflections.humans.each { |(rule, replacement)| break if result.sub!(rule, replacement) } - - result.sub!(/\A_+/, "") - unless keep_id_suffix - result.delete_suffix!("_id") - end - result.tr!("_", " ") - - result.gsub!(/([a-z\d]*)/i) do |match| - "#{inflections.acronyms[match.downcase] || match.downcase}" - end - - if capitalize - result.sub!(/\A\w/) { |match| match.upcase } - end - - result - end - - # Converts just the first character to uppercase. - # - # upcase_first('what a Lovely Day') # => "What a Lovely Day" - # upcase_first('w') # => "W" - # upcase_first('') # => "" - def upcase_first(string) - string.length > 0 ? string[0].upcase.concat(string[1..-1]) : "" - end - - # Capitalizes all the words and replaces some characters in the string to - # create a nicer looking title. +titleize+ is meant for creating pretty - # output. It is not used in the Rails internals. - # - # The trailing '_id','Id'.. can be kept and capitalized by setting the - # optional parameter +keep_id_suffix+ to true. - # By default, this parameter is false. - # - # +titleize+ is also aliased as +titlecase+. - # - # titleize('man from the boondocks') # => "Man From The Boondocks" - # titleize('x-men: the last stand') # => "X Men: The Last Stand" - # titleize('TheManWithoutAPast') # => "The Man Without A Past" - # titleize('raiders_of_the_lost_ark') # => "Raiders Of The Lost Ark" - # titleize('string_ending_with_id', keep_id_suffix: true) # => "String Ending With Id" - def titleize(word, keep_id_suffix: false) - humanize(underscore(word), keep_id_suffix: keep_id_suffix).gsub(/\b(? "raw_scaled_scorers" - # tableize('ham_and_egg') # => "ham_and_eggs" - # tableize('fancyCategory') # => "fancy_categories" - def tableize(class_name) - pluralize(underscore(class_name)) - end - - # Creates a class name from a plural table name like Rails does for table - # names to models. Note that this returns a string and not a Class (To - # convert to an actual class follow +classify+ with #constantize). - # - # classify('ham_and_eggs') # => "HamAndEgg" - # classify('posts') # => "Post" - # - # Singular names are not handled correctly: - # - # classify('calculus') # => "Calculu" - def classify(table_name) - # strip out any leading schema name - camelize(singularize(table_name.to_s.sub(/.*\./, ""))) - end - - # Replaces underscores with dashes in the string. - # - # dasherize('puni_puni') # => "puni-puni" - def dasherize(underscored_word) - underscored_word.tr("_", "-") - end - - # Removes the module part from the expression in the string. - # - # demodulize('ActiveSupport::Inflector::Inflections') # => "Inflections" - # demodulize('Inflections') # => "Inflections" - # demodulize('::Inflections') # => "Inflections" - # demodulize('') # => "" - # - # See also #deconstantize. - def demodulize(path) - path = path.to_s - if i = path.rindex("::") - path[(i + 2)..-1] - else - path - end - end - - # Removes the rightmost segment from the constant expression in the string. - # - # deconstantize('Net::HTTP') # => "Net" - # deconstantize('::Net::HTTP') # => "::Net" - # deconstantize('String') # => "" - # deconstantize('::String') # => "" - # deconstantize('') # => "" - # - # See also #demodulize. - def deconstantize(path) - path.to_s[0, path.rindex("::") || 0] # implementation based on the one in facets' Module#spacename - end - - # Creates a foreign key name from a class name. - # +separate_class_name_and_id_with_underscore+ sets whether - # the method should put '_' between the name and 'id'. - # - # foreign_key('Message') # => "message_id" - # foreign_key('Message', false) # => "messageid" - # foreign_key('Admin::Post') # => "post_id" - def foreign_key(class_name, separate_class_name_and_id_with_underscore = true) - underscore(demodulize(class_name)) + (separate_class_name_and_id_with_underscore ? "_id" : "id") - end - - # Tries to find a constant with the name specified in the argument string. - # - # constantize('Module') # => Module - # constantize('Foo::Bar') # => Foo::Bar - # - # The name is assumed to be the one of a top-level constant, no matter - # whether it starts with "::" or not. No lexical context is taken into - # account: - # - # C = 'outside' - # module M - # C = 'inside' - # C # => 'inside' - # constantize('C') # => 'outside', same as ::C - # end - # - # NameError is raised when the name is not in CamelCase or the constant is - # unknown. - def constantize(camel_cased_word) - if camel_cased_word.blank? || !camel_cased_word.include?("::") - Object.const_get(camel_cased_word) - else - names = camel_cased_word.split("::") - - # Trigger a built-in NameError exception including the ill-formed constant in the message. - Object.const_get(camel_cased_word) if names.empty? - - # Remove the first blank element in case of '::ClassName' notation. - names.shift if names.size > 1 && names.first.empty? - - names.inject(Object) do |constant, name| - if constant == Object - constant.const_get(name) - else - candidate = constant.const_get(name) - next candidate if constant.const_defined?(name, false) - next candidate unless Object.const_defined?(name) - - # Go down the ancestors to check if it is owned directly. The check - # stops when we reach Object or the end of ancestors tree. - constant = constant.ancestors.inject(constant) do |const, ancestor| - break const if ancestor == Object - break ancestor if ancestor.const_defined?(name, false) - const - end - - # owner is in Object, so raise - constant.const_get(name, false) - end - end - end - end - - # Tries to find a constant with the name specified in the argument string. - # - # safe_constantize('Module') # => Module - # safe_constantize('Foo::Bar') # => Foo::Bar - # - # The name is assumed to be the one of a top-level constant, no matter - # whether it starts with "::" or not. No lexical context is taken into - # account: - # - # C = 'outside' - # module M - # C = 'inside' - # C # => 'inside' - # safe_constantize('C') # => 'outside', same as ::C - # end - # - # +nil+ is returned when the name is not in CamelCase or the constant (or - # part of it) is unknown. - # - # safe_constantize('blargle') # => nil - # safe_constantize('UnknownModule') # => nil - # safe_constantize('UnknownModule::Foo::Bar') # => nil - def safe_constantize(camel_cased_word) - constantize(camel_cased_word) - rescue NameError => e - raise if e.name && !(camel_cased_word.to_s.split("::").include?(e.name.to_s) || - e.name.to_s == camel_cased_word.to_s) - rescue LoadError => e - message = e.respond_to?(:original_message) ? e.original_message : e.message - raise unless /Unable to autoload constant #{const_regexp(camel_cased_word)}/.match?(message) - end - - # Returns the suffix that should be added to a number to denote the position - # in an ordered sequence such as 1st, 2nd, 3rd, 4th. - # - # ordinal(1) # => "st" - # ordinal(2) # => "nd" - # ordinal(1002) # => "nd" - # ordinal(1003) # => "rd" - # ordinal(-11) # => "th" - # ordinal(-1021) # => "st" - def ordinal(number) - I18n.translate("number.nth.ordinals", number: number) - end - - # Turns a number into an ordinal string used to denote the position in an - # ordered sequence such as 1st, 2nd, 3rd, 4th. - # - # ordinalize(1) # => "1st" - # ordinalize(2) # => "2nd" - # ordinalize(1002) # => "1002nd" - # ordinalize(1003) # => "1003rd" - # ordinalize(-11) # => "-11th" - # ordinalize(-1021) # => "-1021st" - def ordinalize(number) - I18n.translate("number.nth.ordinalized", number: number) - end - - private - # Mounts a regular expression, returned as a string to ease interpolation, - # that will match part by part the given constant. - # - # const_regexp("Foo::Bar::Baz") # => "Foo(::Bar(::Baz)?)?" - # const_regexp("::") # => "::" - def const_regexp(camel_cased_word) - parts = camel_cased_word.split("::") - - return Regexp.escape(camel_cased_word) if parts.blank? - - last = parts.pop - - parts.reverse!.inject(last) do |acc, part| - part.empty? ? acc : "#{part}(::#{acc})?" - end - end - - # Applies inflection rules for +singularize+ and +pluralize+. - # - # If passed an optional +locale+ parameter, the uncountables will be - # found for that locale. - # - # apply_inflections('post', inflections.plurals, :en) # => "posts" - # apply_inflections('posts', inflections.singulars, :en) # => "post" - def apply_inflections(word, rules, locale = :en) - result = word.to_s.dup - - if word.empty? || inflections(locale).uncountables.uncountable?(result) - result - else - rules.each { |(rule, replacement)| break if result.sub!(rule, replacement) } - result - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflector/transliterate.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflector/transliterate.rb deleted file mode 100644 index c398b25d0f4b70..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/inflector/transliterate.rb +++ /dev/null @@ -1,147 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/string/multibyte" -require "active_support/i18n" - -module ActiveSupport - module Inflector - ALLOWED_ENCODINGS_FOR_TRANSLITERATE = [Encoding::UTF_8, Encoding::US_ASCII, Encoding::GB18030].freeze - - # Replaces non-ASCII characters with an ASCII approximation, or if none - # exists, a replacement character which defaults to "?". - # - # transliterate('Ærøskøbing') - # # => "AEroskobing" - # - # Default approximations are provided for Western/Latin characters, - # e.g, "ø", "ñ", "é", "ß", etc. - # - # This method is I18n aware, so you can set up custom approximations for a - # locale. This can be useful, for example, to transliterate German's "ü" - # and "ö" to "ue" and "oe", or to add support for transliterating Russian - # to ASCII. - # - # In order to make your custom transliterations available, you must set - # them as the i18n.transliterate.rule i18n key: - # - # # Store the transliterations in locales/de.yml - # i18n: - # transliterate: - # rule: - # ü: "ue" - # ö: "oe" - # - # # Or set them using Ruby - # I18n.backend.store_translations(:de, i18n: { - # transliterate: { - # rule: { - # 'ü' => 'ue', - # 'ö' => 'oe' - # } - # } - # }) - # - # The value for i18n.transliterate.rule can be a simple Hash that - # maps characters to ASCII approximations as shown above, or, for more - # complex requirements, a Proc: - # - # I18n.backend.store_translations(:de, i18n: { - # transliterate: { - # rule: ->(string) { MyTransliterator.transliterate(string) } - # } - # }) - # - # Now you can have different transliterations for each locale: - # - # transliterate('Jürgen', locale: :en) - # # => "Jurgen" - # - # transliterate('Jürgen', locale: :de) - # # => "Juergen" - # - # Transliteration is restricted to UTF-8, US-ASCII and GB18030 strings - # Other encodings will raise an ArgumentError. - def transliterate(string, replacement = "?", locale: nil) - string = string.dup if string.frozen? - raise ArgumentError, "Can only transliterate strings. Received #{string.class.name}" unless string.is_a?(String) - raise ArgumentError, "Cannot transliterate strings with #{string.encoding} encoding" unless ALLOWED_ENCODINGS_FOR_TRANSLITERATE.include?(string.encoding) - - input_encoding = string.encoding - - # US-ASCII is a subset of UTF-8 so we'll force encoding as UTF-8 if - # US-ASCII is given. This way we can let tidy_bytes handle the string - # in the same way as we do for UTF-8 - string.force_encoding(Encoding::UTF_8) if string.encoding == Encoding::US_ASCII - - # GB18030 is Unicode compatible but is not a direct mapping so needs to be - # transcoded. Using invalid/undef :replace will result in loss of data in - # the event of invalid characters, but since tidy_bytes will replace - # invalid/undef with a "?" we're safe to do the same beforehand - string.encode!(Encoding::UTF_8, invalid: :replace, undef: :replace) if string.encoding == Encoding::GB18030 - - transliterated = I18n.transliterate( - ActiveSupport::Multibyte::Unicode.tidy_bytes(string).unicode_normalize(:nfc), - replacement: replacement, - locale: locale - ) - - # Restore the string encoding of the input if it was not UTF-8. - # Apply invalid/undef :replace as tidy_bytes does - transliterated.encode!(input_encoding, invalid: :replace, undef: :replace) if input_encoding != transliterated.encoding - - transliterated - end - - # Replaces special characters in a string so that it may be used as part of - # a 'pretty' URL. - # - # parameterize("Donald E. Knuth") # => "donald-e-knuth" - # parameterize("^très|Jolie-- ") # => "tres-jolie" - # - # To use a custom separator, override the +separator+ argument. - # - # parameterize("Donald E. Knuth", separator: '_') # => "donald_e_knuth" - # parameterize("^très|Jolie__ ", separator: '_') # => "tres_jolie" - # - # To preserve the case of the characters in a string, use the +preserve_case+ argument. - # - # parameterize("Donald E. Knuth", preserve_case: true) # => "Donald-E-Knuth" - # parameterize("^très|Jolie-- ", preserve_case: true) # => "tres-Jolie" - # - # It preserves dashes and underscores unless they are used as separators: - # - # parameterize("^très|Jolie__ ") # => "tres-jolie__" - # parameterize("^très|Jolie-- ", separator: "_") # => "tres_jolie--" - # parameterize("^très_Jolie-- ", separator: ".") # => "tres_jolie--" - # - # If the optional parameter +locale+ is specified, - # the word will be parameterized as a word of that language. - # By default, this parameter is set to nil and it will use - # the configured I18n.locale. - def parameterize(string, separator: "-", preserve_case: false, locale: nil) - # Replace accented chars with their ASCII equivalents. - parameterized_string = transliterate(string, locale: locale) - - # Turn unwanted chars into the separator. - parameterized_string.gsub!(/[^a-z0-9\-_]+/i, separator) - - unless separator.nil? || separator.empty? - if separator == "-" - re_duplicate_separator = /-{2,}/ - re_leading_trailing_separator = /^-|-$/i - else - re_sep = Regexp.escape(separator) - re_duplicate_separator = /#{re_sep}{2,}/ - re_leading_trailing_separator = /^#{re_sep}|#{re_sep}$/i - end - # No more than one of the separator in a row. - parameterized_string.gsub!(re_duplicate_separator, separator) - # Remove leading/trailing separator. - parameterized_string.gsub!(re_leading_trailing_separator, "") - end - - parameterized_string.downcase! unless preserve_case - parameterized_string - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb deleted file mode 100644 index c6f7ccf0a2802f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb +++ /dev/null @@ -1,81 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # lazy_load_hooks allows Rails to lazily load a lot of components and thus - # making the app boot faster. Because of this feature now there is no need to - # require ActiveRecord::Base at boot time purely to apply - # configuration. Instead a hook is registered that applies configuration once - # ActiveRecord::Base is loaded. Here ActiveRecord::Base is - # used as example but this feature can be applied elsewhere too. - # - # Here is an example where +on_load+ method is called to register a hook. - # - # initializer 'active_record.initialize_timezone' do - # ActiveSupport.on_load(:active_record) do - # self.time_zone_aware_attributes = true - # self.default_timezone = :utc - # end - # end - # - # When the entirety of +ActiveRecord::Base+ has been - # evaluated then +run_load_hooks+ is invoked. The very last line of - # +ActiveRecord::Base+ is: - # - # ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base) - module LazyLoadHooks - def self.extended(base) # :nodoc: - base.class_eval do - @load_hooks = Hash.new { |h, k| h[k] = [] } - @loaded = Hash.new { |h, k| h[k] = [] } - @run_once = Hash.new { |h, k| h[k] = [] } - end - end - - # Declares a block that will be executed when a Rails component is fully - # loaded. - # - # Options: - # - # * :yield - Yields the object that run_load_hooks to +block+. - # * :run_once - Given +block+ will run only once. - def on_load(name, options = {}, &block) - @loaded[name].each do |base| - execute_hook(name, base, options, block) - end - - @load_hooks[name] << [block, options] - end - - def run_load_hooks(name, base = Object) - @loaded[name] << base - @load_hooks[name].each do |hook, options| - execute_hook(name, base, options, hook) - end - end - - private - def with_execution_control(name, block, once) - unless @run_once[name].include?(block) - @run_once[name] << block if once - - yield - end - end - - def execute_hook(name, base, options, block) - with_execution_control(name, block, options[:run_once]) do - if options[:yield] - block.call(base) - else - if base.is_a?(Module) - base.class_eval(&block) - else - base.instance_eval(&block) - end - end - end - end - end - - extend LazyLoadHooks -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/multibyte.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/multibyte.rb deleted file mode 100644 index 3fe3a05e93e5e9..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.6/lib/active_support/multibyte.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport #:nodoc: - module Multibyte - autoload :Chars, "active_support/multibyte/chars" - autoload :Unicode, "active_support/multibyte/unicode" - - # The proxy class returned when calling mb_chars. You can use this accessor - # to configure your own proxy class so you can support other encodings. See - # the ActiveSupport::Multibyte::Chars implementation for an example how to - # do this. - # - # ActiveSupport::Multibyte.proxy_class = CharsForUTF32 - def self.proxy_class=(klass) - @proxy_class = klass - end - - # Returns the current proxy class. - def self.proxy_class - @proxy_class ||= ActiveSupport::Multibyte::Chars - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.5/LICENSE.txt b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.5/LICENSE.txt new file mode 100644 index 00000000000000..ef51da2b0e8df1 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.5/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/bindata-2.4.15/LICENSE b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/bindata-2.4.15/LICENSE new file mode 100644 index 00000000000000..991663e7b43837 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/bindata-2.4.15/LICENSE @@ -0,0 +1,25 @@ +BSD 2-Clause License + +Copyright (c) 2007-2022, Dion Mendel +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.2.2/LICENSE.txt b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.2.2/LICENSE.txt new file mode 100644 index 00000000000000..1026f28d0be92f --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.2.2/LICENSE.txt @@ -0,0 +1,21 @@ +Copyright (c) Jerry D'Antonio -- released under the MIT license. + +http://www.opensource.org/licenses/mit-license.php + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/did_you_mean-1.6.3/LICENSE.txt b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/did_you_mean-1.6.3/LICENSE.txt new file mode 100644 index 00000000000000..eb5808cc171abe --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/did_you_mean-1.6.3/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2014-2016 Yuki Nishijima + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.14.1/MIT-LICENSE b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.14.1/MIT-LICENSE new file mode 100644 index 00000000000000..ed8e9ee66db87f --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.14.1/MIT-LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2008 The Ruby I18n team + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/plist-3.7.0/LICENSE.txt b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/plist-3.7.0/LICENSE.txt new file mode 100644 index 00000000000000..0ccffe7bf3d5cd --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/plist-3.7.0/LICENSE.txt @@ -0,0 +1,20 @@ +Copyright (c) 2006-2010, Ben Bleything and Patrick May + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/public_suffix-5.0.3/LICENSE.txt b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/public_suffix-5.0.3/LICENSE.txt new file mode 100644 index 00000000000000..0909dd41337455 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/public_suffix-5.0.3/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2009-2023 Simone Carletti + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack.rb deleted file mode 100644 index b37c00cdee6749..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -# Copyright (C) 2007-2019 Leah Neukirchen -# -# Rack is freely distributable under the terms of an MIT-style license. -# See MIT-LICENSE or https://opensource.org/licenses/MIT. - -# The Rack main module, serving as a namespace for all core Rack -# modules and classes. -# -# All modules meant for use in your application are autoloaded here, -# so it should be enough just to require 'rack' in your code. - -require_relative 'rack/version' -require_relative 'rack/constants' - -module Rack - autoload :Builder, "rack/builder" - autoload :BodyProxy, "rack/body_proxy" - autoload :Cascade, "rack/cascade" - autoload :Chunked, "rack/chunked" - autoload :CommonLogger, "rack/common_logger" - autoload :ConditionalGet, "rack/conditional_get" - autoload :Config, "rack/config" - autoload :ContentLength, "rack/content_length" - autoload :ContentType, "rack/content_type" - autoload :ETag, "rack/etag" - autoload :Events, "rack/events" - autoload :File, "rack/file" - autoload :Files, "rack/files" - autoload :Deflater, "rack/deflater" - autoload :Directory, "rack/directory" - autoload :ForwardRequest, "rack/recursive" - autoload :Handler, "rack/handler" - autoload :Head, "rack/head" - autoload :Headers, "rack/headers" - autoload :Lint, "rack/lint" - autoload :Lock, "rack/lock" - autoload :Logger, "rack/logger" - autoload :MediaType, "rack/media_type" - autoload :MethodOverride, "rack/method_override" - autoload :Mime, "rack/mime" - autoload :NullLogger, "rack/null_logger" - autoload :QueryParser, "rack/query_parser" - autoload :Recursive, "rack/recursive" - autoload :Reloader, "rack/reloader" - autoload :RewindableInput, "rack/rewindable_input" - autoload :Runtime, "rack/runtime" - autoload :Sendfile, "rack/sendfile" - autoload :Server, "rack/server" - autoload :ShowExceptions, "rack/show_exceptions" - autoload :ShowStatus, "rack/show_status" - autoload :Static, "rack/static" - autoload :TempfileReaper, "rack/tempfile_reaper" - autoload :URLMap, "rack/urlmap" - autoload :Utils, "rack/utils" - autoload :Multipart, "rack/multipart" - - autoload :MockRequest, "rack/mock_request" - autoload :MockResponse, "rack/mock_response" - - autoload :Request, "rack/request" - autoload :Response, "rack/response" - - module Auth - autoload :Basic, "rack/auth/basic" - autoload :AbstractRequest, "rack/auth/abstract/request" - autoload :AbstractHandler, "rack/auth/abstract/handler" - autoload :Digest, "rack/auth/digest" - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/abstract/handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/abstract/handler.rb deleted file mode 100644 index 4731ee8c85d7b9..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/abstract/handler.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../constants' - -module Rack - module Auth - # Rack::Auth::AbstractHandler implements common authentication functionality. - # - # +realm+ should be set for all handlers. - - class AbstractHandler - - attr_accessor :realm - - def initialize(app, realm = nil, &authenticator) - @app, @realm, @authenticator = app, realm, authenticator - end - - - private - - def unauthorized(www_authenticate = challenge) - return [ 401, - { CONTENT_TYPE => 'text/plain', - CONTENT_LENGTH => '0', - 'www-authenticate' => www_authenticate.to_s }, - [] - ] - end - - def bad_request - return [ 400, - { CONTENT_TYPE => 'text/plain', - CONTENT_LENGTH => '0' }, - [] - ] - end - - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/abstract/request.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/abstract/request.rb deleted file mode 100644 index f872331563ebbd..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/abstract/request.rb +++ /dev/null @@ -1,49 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../request' - -module Rack - module Auth - class AbstractRequest - - def initialize(env) - @env = env - end - - def request - @request ||= Request.new(@env) - end - - def provided? - !authorization_key.nil? && valid? - end - - def valid? - !@env[authorization_key].nil? - end - - def parts - @parts ||= @env[authorization_key].split(' ', 2) - end - - def scheme - @scheme ||= parts.first&.downcase - end - - def params - @params ||= parts.last - end - - - private - - AUTHORIZATION_KEYS = ['HTTP_AUTHORIZATION', 'X-HTTP_AUTHORIZATION', 'X_HTTP_AUTHORIZATION'] - - def authorization_key - @authorization_key ||= AUTHORIZATION_KEYS.detect { |key| @env.has_key?(key) } - end - - end - - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/basic.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/basic.rb deleted file mode 100644 index 019efde75e9db5..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/basic.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -require_relative 'abstract/handler' -require_relative 'abstract/request' -require 'base64' - -module Rack - module Auth - # Rack::Auth::Basic implements HTTP Basic Authentication, as per RFC 2617. - # - # Initialize with the Rack application that you want protecting, - # and a block that checks if a username and password pair are valid. - - class Basic < AbstractHandler - - def call(env) - auth = Basic::Request.new(env) - - return unauthorized unless auth.provided? - - return bad_request unless auth.basic? - - if valid?(auth) - env['REMOTE_USER'] = auth.username - - return @app.call(env) - end - - unauthorized - end - - - private - - def challenge - 'Basic realm="%s"' % realm - end - - def valid?(auth) - @authenticator.call(*auth.credentials) - end - - class Request < Auth::AbstractRequest - def basic? - "basic" == scheme && credentials.length == 2 - end - - def credentials - @credentials ||= Base64.decode64(params).split(':', 2) - end - - def username - credentials.first - end - end - - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest.rb deleted file mode 100644 index d9f818b9e58db9..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest.rb +++ /dev/null @@ -1,256 +0,0 @@ -# frozen_string_literal: true - -require_relative 'abstract/handler' -require_relative 'abstract/request' -require 'digest/md5' -require 'base64' - -module Rack - warn "Rack::Auth::Digest is deprecated and will be removed in Rack 3.1", uplevel: 1 - - module Auth - module Digest - # Rack::Auth::Digest::Nonce is the default nonce generator for the - # Rack::Auth::Digest::MD5 authentication handler. - # - # +private_key+ needs to set to a constant string. - # - # +time_limit+ can be optionally set to an integer (number of seconds), - # to limit the validity of the generated nonces. - - class Nonce - - class << self - attr_accessor :private_key, :time_limit - end - - def self.parse(string) - new(*Base64.decode64(string).split(' ', 2)) - end - - def initialize(timestamp = Time.now, given_digest = nil) - @timestamp, @given_digest = timestamp.to_i, given_digest - end - - def to_s - Base64.encode64("#{@timestamp} #{digest}").strip - end - - def digest - ::Digest::MD5.hexdigest("#{@timestamp}:#{self.class.private_key}") - end - - def valid? - digest == @given_digest - end - - def stale? - !self.class.time_limit.nil? && (Time.now.to_i - @timestamp) > self.class.time_limit - end - - def fresh? - !stale? - end - - end - - class Params < Hash - - def self.parse(str) - Params[*split_header_value(str).map do |param| - k, v = param.split('=', 2) - [k, dequote(v)] - end.flatten] - end - - def self.dequote(str) # From WEBrick::HTTPUtils - ret = (/\A"(.*)"\Z/ =~ str) ? $1 : str.dup - ret.gsub!(/\\(.)/, "\\1") - ret - end - - def self.split_header_value(str) - str.scan(/\w+\=(?:"[^\"]+"|[^,]+)/n) - end - - def initialize - super() - - yield self if block_given? - end - - def [](k) - super k.to_s - end - - def []=(k, v) - super k.to_s, v.to_s - end - - UNQUOTED = ['nc', 'stale'] - - def to_s - map do |k, v| - "#{k}=#{(UNQUOTED.include?(k) ? v.to_s : quote(v))}" - end.join(', ') - end - - def quote(str) # From WEBrick::HTTPUtils - '"' + str.gsub(/[\\\"]/o, "\\\1") + '"' - end - - end - - class Request < Auth::AbstractRequest - def method - @env[RACK_METHODOVERRIDE_ORIGINAL_METHOD] || @env[REQUEST_METHOD] - end - - def digest? - "digest" == scheme - end - - def correct_uri? - request.fullpath == uri - end - - def nonce - @nonce ||= Nonce.parse(params['nonce']) - end - - def params - @params ||= Params.parse(parts.last) - end - - def respond_to?(sym, *) - super or params.has_key? sym.to_s - end - - def method_missing(sym, *args) - return super unless params.has_key?(key = sym.to_s) - return params[key] if args.size == 0 - raise ArgumentError, "wrong number of arguments (#{args.size} for 0)" - end - end - - # Rack::Auth::Digest::MD5 implements the MD5 algorithm version of - # HTTP Digest Authentication, as per RFC 2617. - # - # Initialize with the [Rack] application that you want protecting, - # and a block that looks up a plaintext password for a given username. - # - # +opaque+ needs to be set to a constant base64/hexadecimal string. - # - class MD5 < AbstractHandler - - attr_accessor :opaque - - attr_writer :passwords_hashed - - def initialize(app, realm = nil, opaque = nil, &authenticator) - @passwords_hashed = nil - if opaque.nil? and realm.respond_to? :values_at - realm, opaque, @passwords_hashed = realm.values_at :realm, :opaque, :passwords_hashed - end - super(app, realm, &authenticator) - @opaque = opaque - end - - def passwords_hashed? - !!@passwords_hashed - end - - def call(env) - auth = Request.new(env) - - unless auth.provided? - return unauthorized - end - - if !auth.digest? || !auth.correct_uri? || !valid_qop?(auth) - return bad_request - end - - if valid?(auth) - if auth.nonce.stale? - return unauthorized(challenge(stale: true)) - else - env['REMOTE_USER'] = auth.username - - return @app.call(env) - end - end - - unauthorized - end - - - private - - QOP = 'auth' - - def params(hash = {}) - Params.new do |params| - params['realm'] = realm - params['nonce'] = Nonce.new.to_s - params['opaque'] = H(opaque) - params['qop'] = QOP - - hash.each { |k, v| params[k] = v } - end - end - - def challenge(hash = {}) - "Digest #{params(hash)}" - end - - def valid?(auth) - valid_opaque?(auth) && valid_nonce?(auth) && valid_digest?(auth) - end - - def valid_qop?(auth) - QOP == auth.qop - end - - def valid_opaque?(auth) - H(opaque) == auth.opaque - end - - def valid_nonce?(auth) - auth.nonce.valid? - end - - def valid_digest?(auth) - pw = @authenticator.call(auth.username) - pw && Rack::Utils.secure_compare(digest(auth, pw), auth.response) - end - - def md5(data) - ::Digest::MD5.hexdigest(data) - end - - alias :H :md5 - - def KD(secret, data) - H "#{secret}:#{data}" - end - - def A1(auth, password) - "#{auth.username}:#{auth.realm}:#{password}" - end - - def A2(auth) - "#{auth.method}:#{auth.uri}" - end - - def digest(auth, password) - password_hash = passwords_hashed? ? password : H(A1(auth, password)) - - KD password_hash, "#{auth.nonce}:#{auth.nc}:#{auth.cnonce}:#{QOP}:#{H A2(auth)}" - end - - end - end - end -end - diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest/md5.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest/md5.rb deleted file mode 100644 index 828eccac87e905..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest/md5.rb +++ /dev/null @@ -1 +0,0 @@ -require_relative '../digest' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest/nonce.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest/nonce.rb deleted file mode 100644 index 828eccac87e905..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest/nonce.rb +++ /dev/null @@ -1 +0,0 @@ -require_relative '../digest' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest/params.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest/params.rb deleted file mode 100644 index 828eccac87e905..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest/params.rb +++ /dev/null @@ -1 +0,0 @@ -require_relative '../digest' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest/request.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest/request.rb deleted file mode 100644 index 828eccac87e905..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/auth/digest/request.rb +++ /dev/null @@ -1 +0,0 @@ -require_relative '../digest' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/body_proxy.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/body_proxy.rb deleted file mode 100644 index fbb344b81029f9..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/body_proxy.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -module Rack - # Proxy for response bodies allowing calling a block when - # the response body is closed (after the response has been fully - # sent to the client). - class BodyProxy - # Set the response body to wrap, and the block to call when the - # response has been fully sent. - def initialize(body, &block) - @body = body - @block = block - @closed = false - end - - # Return whether the wrapped body responds to the method. - def respond_to_missing?(method_name, include_all = false) - super or @body.respond_to?(method_name, include_all) - end - - # If not already closed, close the wrapped body and - # then call the block the proxy was initialized with. - def close - return if @closed - @closed = true - begin - @body.close if @body.respond_to?(:close) - ensure - @block.call - end - end - - # Whether the proxy is closed. The proxy starts as not closed, - # and becomes closed on the first call to close. - def closed? - @closed - end - - # Delegate missing methods to the wrapped body. - def method_missing(method_name, *args, &block) - @body.__send__(method_name, *args, &block) - end - # :nocov: - ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true) - # :nocov: - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/builder.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/builder.rb deleted file mode 100644 index 0b9c3d24a2d493..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/builder.rb +++ /dev/null @@ -1,277 +0,0 @@ -# frozen_string_literal: true - -require_relative 'urlmap' - -module Rack - # Rack::Builder provides a domain-specific language (DSL) to construct Rack - # applications. It is primarily used to parse +config.ru+ files which - # instantiate several middleware and a final application which are hosted - # by a Rack-compatible web server. - # - # Example: - # - # app = Rack::Builder.new do - # use Rack::CommonLogger - # map "/ok" do - # run lambda { |env| [200, {'content-type' => 'text/plain'}, ['OK']] } - # end - # end - # - # run app - # - # Or - # - # app = Rack::Builder.app do - # use Rack::CommonLogger - # run lambda { |env| [200, {'content-type' => 'text/plain'}, ['OK']] } - # end - # - # run app - # - # +use+ adds middleware to the stack, +run+ dispatches to an application. - # You can use +map+ to construct a Rack::URLMap in a convenient way. - class Builder - - # https://stackoverflow.com/questions/2223882/whats-the-difference-between-utf-8-and-utf-8-without-bom - UTF_8_BOM = '\xef\xbb\xbf' - - # Parse the given config file to get a Rack application. - # - # If the config file ends in +.ru+, it is treated as a - # rackup file and the contents will be treated as if - # specified inside a Rack::Builder block. - # - # If the config file does not end in +.ru+, it is - # required and Rack will use the basename of the file - # to guess which constant will be the Rack application to run. - # - # Examples: - # - # Rack::Builder.parse_file('config.ru') - # # Rack application built using Rack::Builder.new - # - # Rack::Builder.parse_file('app.rb') - # # requires app.rb, which can be anywhere in Ruby's - # # load path. After requiring, assumes App constant - # # contains Rack application - # - # Rack::Builder.parse_file('./my_app.rb') - # # requires ./my_app.rb, which should be in the - # # process's current directory. After requiring, - # # assumes MyApp constant contains Rack application - def self.parse_file(path) - if path.end_with?('.ru') - return self.load_file(path) - else - require path - return Object.const_get(::File.basename(path, '.rb').split('_').map(&:capitalize).join('')) - end - end - - # Load the given file as a rackup file, treating the - # contents as if specified inside a Rack::Builder block. - # - # Ignores content in the file after +__END__+, so that - # use of +__END__+ will not result in a syntax error. - # - # Example config.ru file: - # - # $ cat config.ru - # - # use Rack::ContentLength - # require './app.rb' - # run App - def self.load_file(path) - config = ::File.read(path) - config.slice!(/\A#{UTF_8_BOM}/) if config.encoding == Encoding::UTF_8 - - if config[/^#\\(.*)/] - fail "Parsing options from the first comment line is no longer supported: #{path}" - end - - config.sub!(/^__END__\n.*\Z/m, '') - - return new_from_string(config, path) - end - - # Evaluate the given +builder_script+ string in the context of - # a Rack::Builder block, returning a Rack application. - def self.new_from_string(builder_script, file = "(rackup)") - # We want to build a variant of TOPLEVEL_BINDING with self as a Rack::Builder instance. - # We cannot use instance_eval(String) as that would resolve constants differently. - binding, builder = TOPLEVEL_BINDING.eval('Rack::Builder.new.instance_eval { [binding, self] }') - eval builder_script, binding, file - - return builder.to_app - end - - # Initialize a new Rack::Builder instance. +default_app+ specifies the - # default application if +run+ is not called later. If a block - # is given, it is evaluated in the context of the instance. - def initialize(default_app = nil, &block) - @use = [] - @map = nil - @run = default_app - @warmup = nil - @freeze_app = false - - instance_eval(&block) if block_given? - end - - # Create a new Rack::Builder instance and return the Rack application - # generated from it. - def self.app(default_app = nil, &block) - self.new(default_app, &block).to_app - end - - # Specifies middleware to use in a stack. - # - # class Middleware - # def initialize(app) - # @app = app - # end - # - # def call(env) - # env["rack.some_header"] = "setting an example" - # @app.call(env) - # end - # end - # - # use Middleware - # run lambda { |env| [200, { "content-type" => "text/plain" }, ["OK"]] } - # - # All requests through to this application will first be processed by the middleware class. - # The +call+ method in this example sets an additional environment key which then can be - # referenced in the application if required. - def use(middleware, *args, &block) - if @map - mapping, @map = @map, nil - @use << proc { |app| generate_map(app, mapping) } - end - @use << proc { |app| middleware.new(app, *args, &block) } - end - # :nocov: - ruby2_keywords(:use) if respond_to?(:ruby2_keywords, true) - # :nocov: - - # Takes a block or argument that is an object that responds to #call and - # returns a Rack response. - # - # You can use a block: - # - # run do |env| - # [200, { "content-type" => "text/plain" }, ["Hello World!"]] - # end - # - # You can also provide a lambda: - # - # run lambda { |env| [200, { "content-type" => "text/plain" }, ["OK"]] } - # - # You can also provide a class instance: - # - # class Heartbeat - # def call(env) - # [200, { "content-type" => "text/plain" }, ["OK"]] - # end - # end - # - # run Heartbeat.new - # - def run(app = nil, &block) - raise ArgumentError, "Both app and block given!" if app && block_given? - - @run = app || block - end - - # Takes a lambda or block that is used to warm-up the application. This block is called - # before the Rack application is returned by to_app. - # - # warmup do |app| - # client = Rack::MockRequest.new(app) - # client.get('/') - # end - # - # use SomeMiddleware - # run MyApp - def warmup(prc = nil, &block) - @warmup = prc || block - end - - # Creates a route within the application. Routes under the mapped path will be sent to - # the Rack application specified by run inside the block. Other requests will be sent to the - # default application specified by run outside the block. - # - # class App - # def call(env) - # [200, {'content-type' => 'text/plain'}, ["Hello World"]] - # end - # end - # - # class Heartbeat - # def call(env) - # [200, { "content-type" => "text/plain" }, ["OK"]] - # end - # end - # - # app = Rack::Builder.app do - # map '/heartbeat' do - # run Heartbeat.new - # end - # run App.new - # end - # - # run app - # - # The +use+ method can also be used inside the block to specify middleware to run under a specific path: - # - # app = Rack::Builder.app do - # map '/heartbeat' do - # use Middleware - # run Heartbeat.new - # end - # run App.new - # end - # - # This example includes a piece of middleware which will run before +/heartbeat+ requests hit +Heartbeat+. - # - # Note that providing a +path+ of +/+ will ignore any default application given in a +run+ statement - # outside the block. - def map(path, &block) - @map ||= {} - @map[path] = block - end - - # Freeze the app (set using run) and all middleware instances when building the application - # in to_app. - def freeze_app - @freeze_app = true - end - - # Return the Rack application generated by this instance. - def to_app - app = @map ? generate_map(@run, @map) : @run - fail "missing run or map statement" unless app - app.freeze if @freeze_app - app = @use.reverse.inject(app) { |a, e| e[a].tap { |x| x.freeze if @freeze_app } } - @warmup.call(app) if @warmup - app - end - - # Call the Rack application generated by this builder instance. Note that - # this rebuilds the Rack application and runs the warmup code (if any) - # every time it is called, so it should not be used if performance is important. - def call(env) - to_app.call(env) - end - - private - - # Generate a URLMap instance by generating new Rack applications for each - # map block in this instance. - def generate_map(default_app, mapping) - mapped = default_app ? { '/' => default_app } : {} - mapping.each { |r, b| mapped[r] = self.class.new(default_app, &b).to_app } - URLMap.new(mapped) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/cascade.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/cascade.rb deleted file mode 100644 index 027d7e4045fb87..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/cascade.rb +++ /dev/null @@ -1,70 +0,0 @@ -# frozen_string_literal: true - -require_relative 'constants' - -module Rack - # Rack::Cascade tries a request on several apps, and returns the - # first response that is not 404 or 405 (or in a list of configured - # status codes). If all applications tried return one of the configured - # status codes, return the last response. - - class Cascade - # deprecated, no longer used - NotFound = [404, { CONTENT_TYPE => "text/plain" }, []] - - # An array of applications to try in order. - attr_reader :apps - - # Set the apps to send requests to, and what statuses result in - # cascading. Arguments: - # - # apps: An enumerable of rack applications. - # cascade_for: The statuses to use cascading for. If a response is received - # from an app, the next app is tried. - def initialize(apps, cascade_for = [404, 405]) - @apps = [] - apps.each { |app| add app } - - @cascade_for = {} - [*cascade_for].each { |status| @cascade_for[status] = true } - end - - # Call each app in order. If the responses uses a status that requires - # cascading, try the next app. If all responses require cascading, - # return the response from the last app. - def call(env) - return [404, { CONTENT_TYPE => "text/plain" }, []] if @apps.empty? - result = nil - last_body = nil - - @apps.each do |app| - # The SPEC says that the body must be closed after it has been iterated - # by the server, or if it is replaced by a middleware action. Cascade - # replaces the body each time a cascade happens. It is assumed that nil - # does not respond to close, otherwise the previous application body - # will be closed. The final application body will not be closed, as it - # will be passed to the server as a result. - last_body.close if last_body.respond_to? :close - - result = app.call(env) - return result unless @cascade_for.include?(result[0].to_i) - last_body = result[2] - end - - result - end - - # Append an app to the list of apps to cascade. This app will - # be tried last. - def add(app) - @apps << app - end - - # Whether the given app is one of the apps to cascade to. - def include?(app) - @apps.include?(app) - end - - alias_method :<<, :add - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/chunked.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/chunked.rb deleted file mode 100644 index 47fb36ac1fe0e9..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/chunked.rb +++ /dev/null @@ -1,120 +0,0 @@ -# frozen_string_literal: true - -require_relative 'constants' -require_relative 'utils' - -module Rack - warn "Rack::Chunked is deprecated and will be removed in Rack 3.1", uplevel: 1 - - # Middleware that applies chunked transfer encoding to response bodies - # when the response does not include a content-length header. - # - # This supports the trailer response header to allow the use of trailing - # headers in the chunked encoding. However, using this requires you manually - # specify a response body that supports a +trailers+ method. Example: - # - # [200, { 'trailer' => 'expires'}, ["Hello", "World"]] - # # error raised - # - # body = ["Hello", "World"] - # def body.trailers - # { 'expires' => Time.now.to_s } - # end - # [200, { 'trailer' => 'expires'}, body] - # # No exception raised - class Chunked - include Rack::Utils - - # A body wrapper that emits chunked responses. - class Body - TERM = "\r\n" - TAIL = "0#{TERM}" - - # Store the response body to be chunked. - def initialize(body) - @body = body - end - - # For each element yielded by the response body, yield - # the element in chunked encoding. - def each(&block) - term = TERM - @body.each do |chunk| - size = chunk.bytesize - next if size == 0 - - yield [size.to_s(16), term, chunk.b, term].join - end - yield TAIL - yield_trailers(&block) - yield term - end - - # Close the response body if the response body supports it. - def close - @body.close if @body.respond_to?(:close) - end - - private - - # Do nothing as this class does not support trailer headers. - def yield_trailers - end - end - - # A body wrapper that emits chunked responses and also supports - # sending Trailer headers. Note that the response body provided to - # initialize must have a +trailers+ method that returns a hash - # of trailer headers, and the rack response itself should have a - # Trailer header listing the headers that the +trailers+ method - # will return. - class TrailerBody < Body - private - - # Yield strings for each trailer header. - def yield_trailers - @body.trailers.each_pair do |k, v| - yield "#{k}: #{v}\r\n" - end - end - end - - def initialize(app) - @app = app - end - - # Whether the HTTP version supports chunked encoding (HTTP 1.1 does). - def chunkable_version?(ver) - case ver - # pre-HTTP/1.0 (informally "HTTP/0.9") HTTP requests did not have - # a version (nor response headers) - when 'HTTP/1.0', nil, 'HTTP/0.9' - false - else - true - end - end - - # If the rack app returns a response that should have a body, - # but does not have content-length or transfer-encoding headers, - # modify the response to use chunked transfer-encoding. - def call(env) - status, headers, body = response = @app.call(env) - - if chunkable_version?(env[SERVER_PROTOCOL]) && - !STATUS_WITH_NO_ENTITY_BODY.key?(status.to_i) && - !headers[CONTENT_LENGTH] && - !headers[TRANSFER_ENCODING] - - headers[TRANSFER_ENCODING] = 'chunked' - if headers['trailer'] - response[2] = TrailerBody.new(body) - else - response[2] = Body.new(body) - end - end - - response - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/common_logger.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/common_logger.rb deleted file mode 100644 index 2feb0674649e71..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/common_logger.rb +++ /dev/null @@ -1,88 +0,0 @@ -# frozen_string_literal: true - -require_relative 'constants' -require_relative 'utils' -require_relative 'body_proxy' -require_relative 'request' - -module Rack - # Rack::CommonLogger forwards every request to the given +app+, and - # logs a line in the - # {Apache common log format}[http://httpd.apache.org/docs/1.3/logs.html#common] - # to the configured logger. - class CommonLogger - # Common Log Format: http://httpd.apache.org/docs/1.3/logs.html#common - # - # lilith.local - - [07/Aug/2006 23:58:02 -0400] "GET / HTTP/1.1" 500 - - # - # %{%s - %s [%s] "%s %s%s %s" %d %s\n} % - # - # The actual format is slightly different than the above due to the - # separation of SCRIPT_NAME and PATH_INFO, and because the elapsed - # time in seconds is included at the end. - FORMAT = %{%s - %s [%s] "%s %s%s%s %s" %d %s %0.4f\n} - - # +logger+ can be any object that supports the +write+ or +<<+ methods, - # which includes the standard library Logger. These methods are called - # with a single string argument, the log message. - # If +logger+ is nil, CommonLogger will fall back env['rack.errors']. - def initialize(app, logger = nil) - @app = app - @logger = logger - end - - # Log all requests in common_log format after a response has been - # returned. Note that if the app raises an exception, the request - # will not be logged, so if exception handling middleware are used, - # they should be loaded after this middleware. Additionally, because - # the logging happens after the request body has been fully sent, any - # exceptions raised during the sending of the response body will - # cause the request not to be logged. - def call(env) - began_at = Utils.clock_time - status, headers, body = response = @app.call(env) - - response[2] = BodyProxy.new(body) { log(env, status, headers, began_at) } - response - end - - private - - # Log the request to the configured logger. - def log(env, status, response_headers, began_at) - request = Rack::Request.new(env) - length = extract_content_length(response_headers) - - msg = sprintf(FORMAT, - request.ip || "-", - request.get_header("REMOTE_USER") || "-", - Time.now.strftime("%d/%b/%Y:%H:%M:%S %z"), - request.request_method, - request.script_name, - request.path_info, - request.query_string.empty? ? "" : "?#{request.query_string}", - request.get_header(SERVER_PROTOCOL), - status.to_s[0..3], - length, - Utils.clock_time - began_at) - - msg.gsub!(/[^[:print:]\n]/) { |c| sprintf("\\x%x", c.ord) } - - logger = @logger || request.get_header(RACK_ERRORS) - # Standard library logger doesn't support write but it supports << which actually - # calls to write on the log device without formatting - if logger.respond_to?(:write) - logger.write(msg) - else - logger << msg - end - end - - # Attempt to determine the content length for the response to - # include it in the logged data. - def extract_content_length(headers) - value = headers[CONTENT_LENGTH] - !value || value.to_s == '0' ? '-' : value - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/conditional_get.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/conditional_get.rb deleted file mode 100644 index c3b334a2e2b4d2..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/conditional_get.rb +++ /dev/null @@ -1,86 +0,0 @@ -# frozen_string_literal: true - -require_relative 'constants' -require_relative 'utils' -require_relative 'body_proxy' - -module Rack - - # Middleware that enables conditional GET using if-none-match and - # if-modified-since. The application should set either or both of the - # last-modified or etag response headers according to RFC 2616. When - # either of the conditions is met, the response body is set to be zero - # length and the response status is set to 304 Not Modified. - # - # Applications that defer response body generation until the body's each - # message is received will avoid response body generation completely when - # a conditional GET matches. - # - # Adapted from Michael Klishin's Merb implementation: - # https://github.com/wycats/merb/blob/master/merb-core/lib/merb-core/rack/middleware/conditional_get.rb - class ConditionalGet - def initialize(app) - @app = app - end - - # Return empty 304 response if the response has not been - # modified since the last request. - def call(env) - case env[REQUEST_METHOD] - when "GET", "HEAD" - status, headers, body = response = @app.call(env) - - if status == 200 && fresh?(env, headers) - response[0] = 304 - headers.delete(CONTENT_TYPE) - headers.delete(CONTENT_LENGTH) - response[2] = Rack::BodyProxy.new([]) do - body.close if body.respond_to?(:close) - end - end - response - else - @app.call(env) - end - end - - private - - # Return whether the response has not been modified since the - # last request. - def fresh?(env, headers) - # if-none-match has priority over if-modified-since per RFC 7232 - if none_match = env['HTTP_IF_NONE_MATCH'] - etag_matches?(none_match, headers) - elsif (modified_since = env['HTTP_IF_MODIFIED_SINCE']) && (modified_since = to_rfc2822(modified_since)) - modified_since?(modified_since, headers) - end - end - - # Whether the etag response header matches the if-none-match request header. - # If so, the request has not been modified. - def etag_matches?(none_match, headers) - headers[ETAG] == none_match - end - - # Whether the last-modified response header matches the if-modified-since - # request header. If so, the request has not been modified. - def modified_since?(modified_since, headers) - last_modified = to_rfc2822(headers['last-modified']) and - modified_since >= last_modified - end - - # Return a Time object for the given string (which should be in RFC2822 - # format), or nil if the string cannot be parsed. - def to_rfc2822(since) - # shortest possible valid date is the obsolete: 1 Nov 97 09:55 A - # anything shorter is invalid, this avoids exceptions for common cases - # most common being the empty string - if since && since.length >= 16 - # NOTE: there is no trivial way to write this in a non exception way - # _rfc2822 returns a hash but is not that usable - Time.rfc2822(since) rescue nil - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/config.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/config.rb deleted file mode 100644 index 41f6f7dd57314b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/config.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -module Rack - # Rack::Config modifies the environment using the block given during - # initialization. - # - # Example: - # use Rack::Config do |env| - # env['my-key'] = 'some-value' - # end - class Config - def initialize(app, &block) - @app = app - @block = block - end - - def call(env) - @block.call(env) - @app.call(env) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/constants.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/constants.rb deleted file mode 100644 index 13365935b1b5b8..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/constants.rb +++ /dev/null @@ -1,64 +0,0 @@ -# frozen_string_literal: true - -module Rack - # Request env keys - HTTP_HOST = 'HTTP_HOST' - HTTP_PORT = 'HTTP_PORT' - HTTPS = 'HTTPS' - PATH_INFO = 'PATH_INFO' - REQUEST_METHOD = 'REQUEST_METHOD' - REQUEST_PATH = 'REQUEST_PATH' - SCRIPT_NAME = 'SCRIPT_NAME' - QUERY_STRING = 'QUERY_STRING' - SERVER_PROTOCOL = 'SERVER_PROTOCOL' - SERVER_NAME = 'SERVER_NAME' - SERVER_PORT = 'SERVER_PORT' - HTTP_COOKIE = 'HTTP_COOKIE' - - # Response Header Keys - CACHE_CONTROL = 'cache-control' - CONTENT_LENGTH = 'content-length' - CONTENT_TYPE = 'content-type' - ETAG = 'etag' - EXPIRES = 'expires' - SET_COOKIE = 'set-cookie' - TRANSFER_ENCODING = 'transfer-encoding' - - # HTTP method verbs - GET = 'GET' - POST = 'POST' - PUT = 'PUT' - PATCH = 'PATCH' - DELETE = 'DELETE' - HEAD = 'HEAD' - OPTIONS = 'OPTIONS' - LINK = 'LINK' - UNLINK = 'UNLINK' - TRACE = 'TRACE' - - # Rack environment variables - RACK_VERSION = 'rack.version' - RACK_TEMPFILES = 'rack.tempfiles' - RACK_ERRORS = 'rack.errors' - RACK_LOGGER = 'rack.logger' - RACK_INPUT = 'rack.input' - RACK_SESSION = 'rack.session' - RACK_SESSION_OPTIONS = 'rack.session.options' - RACK_SHOWSTATUS_DETAIL = 'rack.showstatus.detail' - RACK_URL_SCHEME = 'rack.url_scheme' - RACK_HIJACK = 'rack.hijack' - RACK_IS_HIJACK = 'rack.hijack?' - RACK_RECURSIVE_INCLUDE = 'rack.recursive.include' - RACK_MULTIPART_BUFFER_SIZE = 'rack.multipart.buffer_size' - RACK_MULTIPART_TEMPFILE_FACTORY = 'rack.multipart.tempfile_factory' - RACK_RESPONSE_FINISHED = 'rack.response_finished' - RACK_REQUEST_FORM_INPUT = 'rack.request.form_input' - RACK_REQUEST_FORM_HASH = 'rack.request.form_hash' - RACK_REQUEST_FORM_VARS = 'rack.request.form_vars' - RACK_REQUEST_FORM_ERROR = 'rack.request.form_error' - RACK_REQUEST_COOKIE_HASH = 'rack.request.cookie_hash' - RACK_REQUEST_COOKIE_STRING = 'rack.request.cookie_string' - RACK_REQUEST_QUERY_HASH = 'rack.request.query_hash' - RACK_REQUEST_QUERY_STRING = 'rack.request.query_string' - RACK_METHODOVERRIDE_ORIGINAL_METHOD = 'rack.methodoverride.original_method' -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/content_length.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/content_length.rb deleted file mode 100644 index cbac93abcf37ec..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/content_length.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -require_relative 'constants' -require_relative 'utils' - -module Rack - - # Sets the content-length header on responses that do not specify - # a content-length or transfer-encoding header. Note that this - # does not fix responses that have an invalid content-length - # header specified. - class ContentLength - include Rack::Utils - - def initialize(app) - @app = app - end - - def call(env) - status, headers, body = response = @app.call(env) - - if !STATUS_WITH_NO_ENTITY_BODY.key?(status.to_i) && - !headers[CONTENT_LENGTH] && - !headers[TRANSFER_ENCODING] && - body.respond_to?(:to_ary) - - response[2] = body = body.to_ary - headers[CONTENT_LENGTH] = body.sum(&:bytesize).to_s - end - - response - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/content_type.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/content_type.rb deleted file mode 100644 index 19f07824f563bc..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/content_type.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -require_relative 'constants' -require_relative 'utils' - -module Rack - - # Sets the content-type header on responses which don't have one. - # - # Builder Usage: - # use Rack::ContentType, "text/plain" - # - # When no content type argument is provided, "text/html" is the - # default. - class ContentType - include Rack::Utils - - def initialize(app, content_type = "text/html") - @app = app - @content_type = content_type - end - - def call(env) - status, headers, _ = response = @app.call(env) - - unless STATUS_WITH_NO_ENTITY_BODY.key?(status.to_i) - headers[CONTENT_TYPE] ||= @content_type - end - - response - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/deflater.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/deflater.rb deleted file mode 100644 index cc01c32a0ad572..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/deflater.rb +++ /dev/null @@ -1,158 +0,0 @@ -# frozen_string_literal: true - -require "zlib" -require "time" # for Time.httpdate - -require_relative 'constants' -require_relative 'utils' -require_relative 'request' -require_relative 'body_proxy' - -module Rack - # This middleware enables content encoding of http responses, - # usually for purposes of compression. - # - # Currently supported encodings: - # - # * gzip - # * identity (no transformation) - # - # This middleware automatically detects when encoding is supported - # and allowed. For example no encoding is made when a cache - # directive of 'no-transform' is present, when the response status - # code is one that doesn't allow an entity body, or when the body - # is empty. - # - # Note that despite the name, Deflater does not support the +deflate+ - # encoding. - class Deflater - # Creates Rack::Deflater middleware. Options: - # - # :if :: a lambda enabling / disabling deflation based on returned boolean value - # (e.g use Rack::Deflater, :if => lambda { |*, body| sum=0; body.each { |i| sum += i.length }; sum > 512 }). - # However, be aware that calling `body.each` inside the block will break cases where `body.each` is not idempotent, - # such as when it is an +IO+ instance. - # :include :: a list of content types that should be compressed. By default, all content types are compressed. - # :sync :: determines if the stream is going to be flushed after every chunk. Flushing after every chunk reduces - # latency for time-sensitive streaming applications, but hurts compression and throughput. - # Defaults to +true+. - def initialize(app, options = {}) - @app = app - @condition = options[:if] - @compressible_types = options[:include] - @sync = options.fetch(:sync, true) - end - - def call(env) - status, headers, body = response = @app.call(env) - - unless should_deflate?(env, status, headers, body) - return response - end - - request = Request.new(env) - - encoding = Utils.select_best_encoding(%w(gzip identity), - request.accept_encoding) - - # Set the Vary HTTP header. - vary = headers["vary"].to_s.split(",").map(&:strip) - unless vary.include?("*") || vary.any?{|v| v.downcase == 'accept-encoding'} - headers["vary"] = vary.push("Accept-Encoding").join(",") - end - - case encoding - when "gzip" - headers['content-encoding'] = "gzip" - headers.delete(CONTENT_LENGTH) - mtime = headers["last-modified"] - mtime = Time.httpdate(mtime).to_i if mtime - response[2] = GzipStream.new(body, mtime, @sync) - response - when "identity" - response - else # when nil - # Only possible encoding values here are 'gzip', 'identity', and nil - message = "An acceptable encoding for the requested resource #{request.fullpath} could not be found." - bp = Rack::BodyProxy.new([message]) { body.close if body.respond_to?(:close) } - [406, { CONTENT_TYPE => "text/plain", CONTENT_LENGTH => message.length.to_s }, bp] - end - end - - # Body class used for gzip encoded responses. - class GzipStream - - BUFFER_LENGTH = 128 * 1_024 - - # Initialize the gzip stream. Arguments: - # body :: Response body to compress with gzip - # mtime :: The modification time of the body, used to set the - # modification time in the gzip header. - # sync :: Whether to flush each gzip chunk as soon as it is ready. - def initialize(body, mtime, sync) - @body = body - @mtime = mtime - @sync = sync - end - - # Yield gzip compressed strings to the given block. - def each(&block) - @writer = block - gzip = ::Zlib::GzipWriter.new(self) - gzip.mtime = @mtime if @mtime - # @body.each is equivalent to @body.gets (slow) - if @body.is_a? ::File # XXX: Should probably be ::IO - while part = @body.read(BUFFER_LENGTH) - gzip.write(part) - gzip.flush if @sync - end - else - @body.each { |part| - # Skip empty strings, as they would result in no output, - # and flushing empty parts would raise Zlib::BufError. - next if part.empty? - gzip.write(part) - gzip.flush if @sync - } - end - ensure - gzip.finish - end - - # Call the block passed to #each with the gzipped data. - def write(data) - @writer.call(data) - end - - # Close the original body if possible. - def close - @body.close if @body.respond_to?(:close) - end - end - - private - - # Whether the body should be compressed. - def should_deflate?(env, status, headers, body) - # Skip compressing empty entity body responses and responses with - # no-transform set. - if Utils::STATUS_WITH_NO_ENTITY_BODY.key?(status.to_i) || - /\bno-transform\b/.match?(headers[CACHE_CONTROL].to_s) || - headers['content-encoding']&.!~(/\bidentity\b/) - return false - end - - # Skip if @compressible_types are given and does not include request's content type - return false if @compressible_types && !(headers.has_key?(CONTENT_TYPE) && @compressible_types.include?(headers[CONTENT_TYPE][/[^;]*/])) - - # Skip if @condition lambda is given and evaluates to false - return false if @condition && !@condition.call(env, status, headers, body) - - # No point in compressing empty body, also handles usage with - # Rack::Sendfile. - return false if headers[CONTENT_LENGTH] == '0' - - true - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/directory.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/directory.rb deleted file mode 100644 index 089623f91d934e..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/directory.rb +++ /dev/null @@ -1,205 +0,0 @@ -# frozen_string_literal: true - -require 'time' - -require_relative 'constants' -require_relative 'utils' -require_relative 'head' -require_relative 'mime' -require_relative 'files' - -module Rack - # Rack::Directory serves entries below the +root+ given, according to the - # path info of the Rack request. If a directory is found, the file's contents - # will be presented in an html based index. If a file is found, the env will - # be passed to the specified +app+. - # - # If +app+ is not specified, a Rack::Files of the same +root+ will be used. - - class Directory - DIR_FILE = "%s%s%s%s\n" - DIR_PAGE_HEADER = <<-PAGE - - %s - - - -

%s

-
- - - - - - - - PAGE - DIR_PAGE_FOOTER = <<-PAGE -
NameSizeTypeLast Modified
-
- - PAGE - - # Body class for directory entries, showing an index page with links - # to each file. - class DirectoryBody < Struct.new(:root, :path, :files) - # Yield strings for each part of the directory entry - def each - show_path = Utils.escape_html(path.sub(/^#{root}/, '')) - yield(DIR_PAGE_HEADER % [ show_path, show_path ]) - - unless path.chomp('/') == root - yield(DIR_FILE % DIR_FILE_escape(files.call('..'))) - end - - Dir.foreach(path) do |basename| - next if basename.start_with?('.') - next unless f = files.call(basename) - yield(DIR_FILE % DIR_FILE_escape(f)) - end - - yield(DIR_PAGE_FOOTER) - end - - private - - # Escape each element in the array of html strings. - def DIR_FILE_escape(htmls) - htmls.map { |e| Utils.escape_html(e) } - end - end - - # The root of the directory hierarchy. Only requests for files and - # directories inside of the root directory are supported. - attr_reader :root - - # Set the root directory and application for serving files. - def initialize(root, app = nil) - @root = ::File.expand_path(root) - @app = app || Files.new(@root) - @head = Head.new(method(:get)) - end - - def call(env) - # strip body if this is a HEAD call - @head.call env - end - - # Internals of request handling. Similar to call but does - # not remove body for HEAD requests. - def get(env) - script_name = env[SCRIPT_NAME] - path_info = Utils.unescape_path(env[PATH_INFO]) - - if client_error_response = check_bad_request(path_info) || check_forbidden(path_info) - client_error_response - else - path = ::File.join(@root, path_info) - list_path(env, path, path_info, script_name) - end - end - - # Rack response to use for requests with invalid paths, or nil if path is valid. - def check_bad_request(path_info) - return if Utils.valid_path?(path_info) - - body = "Bad Request\n" - [400, { CONTENT_TYPE => "text/plain", - CONTENT_LENGTH => body.bytesize.to_s, - "x-cascade" => "pass" }, [body]] - end - - # Rack response to use for requests with paths outside the root, or nil if path is inside the root. - def check_forbidden(path_info) - return unless path_info.include? ".." - return if ::File.expand_path(::File.join(@root, path_info)).start_with?(@root) - - body = "Forbidden\n" - [403, { CONTENT_TYPE => "text/plain", - CONTENT_LENGTH => body.bytesize.to_s, - "x-cascade" => "pass" }, [body]] - end - - # Rack response to use for directories under the root. - def list_directory(path_info, path, script_name) - url_head = (script_name.split('/') + path_info.split('/')).map do |part| - Utils.escape_path part - end - - # Globbing not safe as path could contain glob metacharacters - body = DirectoryBody.new(@root, path, ->(basename) do - stat = stat(::File.join(path, basename)) - next unless stat - - url = ::File.join(*url_head + [Utils.escape_path(basename)]) - mtime = stat.mtime.httpdate - if stat.directory? - type = 'directory' - size = '-' - url << '/' - if basename == '..' - basename = 'Parent Directory' - else - basename << '/' - end - else - type = Mime.mime_type(::File.extname(basename)) - size = filesize_format(stat.size) - end - - [ url, basename, size, type, mtime ] - end) - - [ 200, { CONTENT_TYPE => 'text/html; charset=utf-8' }, body ] - end - - # File::Stat for the given path, but return nil for missing/bad entries. - def stat(path) - ::File.stat(path) - rescue Errno::ENOENT, Errno::ELOOP - return nil - end - - # Rack response to use for files and directories under the root. - # Unreadable and non-file, non-directory entries will get a 404 response. - def list_path(env, path, path_info, script_name) - if (stat = stat(path)) && stat.readable? - return @app.call(env) if stat.file? - return list_directory(path_info, path, script_name) if stat.directory? - end - - entity_not_found(path_info) - end - - # Rack response to use for unreadable and non-file, non-directory entries. - def entity_not_found(path_info) - body = "Entity not found: #{path_info}\n" - [404, { CONTENT_TYPE => "text/plain", - CONTENT_LENGTH => body.bytesize.to_s, - "x-cascade" => "pass" }, [body]] - end - - # Stolen from Ramaze - FILESIZE_FORMAT = [ - ['%.1fT', 1 << 40], - ['%.1fG', 1 << 30], - ['%.1fM', 1 << 20], - ['%.1fK', 1 << 10], - ] - - # Provide human readable file sizes - def filesize_format(int) - FILESIZE_FORMAT.each do |format, size| - return format % (int.to_f / size) if int >= size - end - - "#{int}B" - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/etag.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/etag.rb deleted file mode 100644 index fa78b472fd9146..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/etag.rb +++ /dev/null @@ -1,68 +0,0 @@ -# frozen_string_literal: true - -require 'digest/sha2' - -require_relative 'constants' -require_relative 'utils' - -module Rack - # Automatically sets the etag header on all String bodies. - # - # The etag header is skipped if etag or last-modified headers are sent or if - # a sendfile body (body.responds_to :to_path) is given (since such cases - # should be handled by apache/nginx). - # - # On initialization, you can pass two parameters: a cache-control directive - # used when etag is absent and a directive when it is present. The first - # defaults to nil, while the second defaults to "max-age=0, private, must-revalidate" - class ETag - ETAG_STRING = Rack::ETAG - DEFAULT_CACHE_CONTROL = "max-age=0, private, must-revalidate" - - def initialize(app, no_cache_control = nil, cache_control = DEFAULT_CACHE_CONTROL) - @app = app - @cache_control = cache_control - @no_cache_control = no_cache_control - end - - def call(env) - status, headers, body = response = @app.call(env) - - if etag_status?(status) && body.respond_to?(:to_ary) && !skip_caching?(headers) - body = body.to_ary - digest = digest_body(body) - headers[ETAG_STRING] = %(W/"#{digest}") if digest - end - - unless headers[CACHE_CONTROL] - if digest - headers[CACHE_CONTROL] = @cache_control if @cache_control - else - headers[CACHE_CONTROL] = @no_cache_control if @no_cache_control - end - end - - response - end - - private - - def etag_status?(status) - status == 200 || status == 201 - end - - def skip_caching?(headers) - headers.key?(ETAG_STRING) || headers.key?('last-modified') - end - - def digest_body(body) - digest = nil - - body.each do |part| - (digest ||= Digest::SHA256.new) << part unless part.empty? - end - - digest && digest.hexdigest.byteslice(0,32) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/events.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/events.rb deleted file mode 100644 index c7bb201f05aee7..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/events.rb +++ /dev/null @@ -1,157 +0,0 @@ -# frozen_string_literal: true - -require_relative 'body_proxy' -require_relative 'request' -require_relative 'response' - -module Rack - ### This middleware provides hooks to certain places in the request / - # response lifecycle. This is so that middleware that don't need to filter - # the response data can safely leave it alone and not have to send messages - # down the traditional "rack stack". - # - # The events are: - # - # * on_start(request, response) - # - # This event is sent at the start of the request, before the next - # middleware in the chain is called. This method is called with a request - # object, and a response object. Right now, the response object is always - # nil, but in the future it may actually be a real response object. - # - # * on_commit(request, response) - # - # The response has been committed. The application has returned, but the - # response has not been sent to the webserver yet. This method is always - # called with a request object and the response object. The response - # object is constructed from the rack triple that the application returned. - # Changes may still be made to the response object at this point. - # - # * on_send(request, response) - # - # The webserver has started iterating over the response body and presumably - # has started sending data over the wire. This method is always called with - # a request object and the response object. The response object is - # constructed from the rack triple that the application returned. Changes - # SHOULD NOT be made to the response object as the webserver has already - # started sending data. Any mutations will likely result in an exception. - # - # * on_finish(request, response) - # - # The webserver has closed the response, and all data has been written to - # the response socket. The request and response object should both be - # read-only at this point. The body MAY NOT be available on the response - # object as it may have been flushed to the socket. - # - # * on_error(request, response, error) - # - # An exception has occurred in the application or an `on_commit` event. - # This method will get the request, the response (if available) and the - # exception that was raised. - # - # ## Order - # - # `on_start` is called on the handlers in the order that they were passed to - # the constructor. `on_commit`, on_send`, `on_finish`, and `on_error` are - # called in the reverse order. `on_finish` handlers are called inside an - # `ensure` block, so they are guaranteed to be called even if something - # raises an exception. If something raises an exception in a `on_finish` - # method, then nothing is guaranteed. - - class Events - module Abstract - def on_start(req, res) - end - - def on_commit(req, res) - end - - def on_send(req, res) - end - - def on_finish(req, res) - end - - def on_error(req, res, e) - end - end - - class EventedBodyProxy < Rack::BodyProxy # :nodoc: - attr_reader :request, :response - - def initialize(body, request, response, handlers, &block) - super(body, &block) - @request = request - @response = response - @handlers = handlers - end - - def each - @handlers.reverse_each { |handler| handler.on_send request, response } - super - end - end - - class BufferedResponse < Rack::Response::Raw # :nodoc: - attr_reader :body - - def initialize(status, headers, body) - super(status, headers) - @body = body - end - - def to_a; [status, headers, body]; end - end - - def initialize(app, handlers) - @app = app - @handlers = handlers - end - - def call(env) - request = make_request env - on_start request, nil - - begin - status, headers, body = @app.call request.env - response = make_response status, headers, body - on_commit request, response - rescue StandardError => e - on_error request, response, e - on_finish request, response - raise - end - - body = EventedBodyProxy.new(body, request, response, @handlers) do - on_finish request, response - end - [response.status, response.headers, body] - end - - private - - def on_error(request, response, e) - @handlers.reverse_each { |handler| handler.on_error request, response, e } - end - - def on_commit(request, response) - @handlers.reverse_each { |handler| handler.on_commit request, response } - end - - def on_start(request, response) - @handlers.each { |handler| handler.on_start request, nil } - end - - def on_finish(request, response) - @handlers.reverse_each { |handler| handler.on_finish request, response } - end - - def make_request(env) - Rack::Request.new env - end - - def make_response(status, headers, body) - BufferedResponse.new status, headers, body - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/file.rb deleted file mode 100644 index 52c7b4166793f2..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/file.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -require_relative 'files' - -module Rack - warn "Rack::File is deprecated and will be removed in Rack 3.1", uplevel: 1 - - File = Files -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/files.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/files.rb deleted file mode 100644 index 5b8353f5b5257a..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/files.rb +++ /dev/null @@ -1,216 +0,0 @@ -# frozen_string_literal: true - -require 'time' - -require_relative 'constants' -require_relative 'head' -require_relative 'utils' -require_relative 'request' -require_relative 'mime' - -module Rack - # Rack::Files serves files below the +root+ directory given, according to the - # path info of the Rack request. - # e.g. when Rack::Files.new("/etc") is used, you can access 'passwd' file - # as http://localhost:9292/passwd - # - # Handlers can detect if bodies are a Rack::Files, and use mechanisms - # like sendfile on the +path+. - - class Files - ALLOWED_VERBS = %w[GET HEAD OPTIONS] - ALLOW_HEADER = ALLOWED_VERBS.join(', ') - MULTIPART_BOUNDARY = 'AaB03x' - - attr_reader :root - - def initialize(root, headers = {}, default_mime = 'text/plain') - @root = (::File.expand_path(root) if root) - @headers = headers - @default_mime = default_mime - @head = Rack::Head.new(lambda { |env| get env }) - end - - def call(env) - # HEAD requests drop the response body, including 4xx error messages. - @head.call env - end - - def get(env) - request = Rack::Request.new env - unless ALLOWED_VERBS.include? request.request_method - return fail(405, "Method Not Allowed", { 'allow' => ALLOW_HEADER }) - end - - path_info = Utils.unescape_path request.path_info - return fail(400, "Bad Request") unless Utils.valid_path?(path_info) - - clean_path_info = Utils.clean_path_info(path_info) - path = ::File.join(@root, clean_path_info) - - available = begin - ::File.file?(path) && ::File.readable?(path) - rescue SystemCallError - # Not sure in what conditions this exception can occur, but this - # is a safe way to handle such an error. - # :nocov: - false - # :nocov: - end - - if available - serving(request, path) - else - fail(404, "File not found: #{path_info}") - end - end - - def serving(request, path) - if request.options? - return [200, { 'allow' => ALLOW_HEADER, CONTENT_LENGTH => '0' }, []] - end - last_modified = ::File.mtime(path).httpdate - return [304, {}, []] if request.get_header('HTTP_IF_MODIFIED_SINCE') == last_modified - - headers = { "last-modified" => last_modified } - mime_type = mime_type path, @default_mime - headers[CONTENT_TYPE] = mime_type if mime_type - - # Set custom headers - headers.merge!(@headers) if @headers - - status = 200 - size = filesize path - - ranges = Rack::Utils.get_byte_ranges(request.get_header('HTTP_RANGE'), size) - if ranges.nil? - # No ranges: - ranges = [0..size - 1] - elsif ranges.empty? - # Unsatisfiable. Return error, and file size: - response = fail(416, "Byte range unsatisfiable") - response[1]["content-range"] = "bytes */#{size}" - return response - else - # Partial content - partial_content = true - - if ranges.size == 1 - range = ranges[0] - headers["content-range"] = "bytes #{range.begin}-#{range.end}/#{size}" - else - headers[CONTENT_TYPE] = "multipart/byteranges; boundary=#{MULTIPART_BOUNDARY}" - end - - status = 206 - body = BaseIterator.new(path, ranges, mime_type: mime_type, size: size) - size = body.bytesize - end - - headers[CONTENT_LENGTH] = size.to_s - - if request.head? - body = [] - elsif !partial_content - body = Iterator.new(path, ranges, mime_type: mime_type, size: size) - end - - [status, headers, body] - end - - class BaseIterator - attr_reader :path, :ranges, :options - - def initialize(path, ranges, options) - @path = path - @ranges = ranges - @options = options - end - - def each - ::File.open(path, "rb") do |file| - ranges.each do |range| - yield multipart_heading(range) if multipart? - - each_range_part(file, range) do |part| - yield part - end - end - - yield "\r\n--#{MULTIPART_BOUNDARY}--\r\n" if multipart? - end - end - - def bytesize - size = ranges.inject(0) do |sum, range| - sum += multipart_heading(range).bytesize if multipart? - sum += range.size - end - size += "\r\n--#{MULTIPART_BOUNDARY}--\r\n".bytesize if multipart? - size - end - - def close; end - - private - - def multipart? - ranges.size > 1 - end - - def multipart_heading(range) -<<-EOF -\r ---#{MULTIPART_BOUNDARY}\r -content-type: #{options[:mime_type]}\r -content-range: bytes #{range.begin}-#{range.end}/#{options[:size]}\r -\r -EOF - end - - def each_range_part(file, range) - file.seek(range.begin) - remaining_len = range.end - range.begin + 1 - while remaining_len > 0 - part = file.read([8192, remaining_len].min) - break unless part - remaining_len -= part.length - - yield part - end - end - end - - class Iterator < BaseIterator - alias :to_path :path - end - - private - - def fail(status, body, headers = {}) - body += "\n" - - [ - status, - { - CONTENT_TYPE => "text/plain", - CONTENT_LENGTH => body.size.to_s, - "x-cascade" => "pass" - }.merge!(headers), - [body] - ] - end - - # The MIME type for the contents of the file located at @path - def mime_type(path, default_mime) - Mime.mime_type(::File.extname(path), default_mime) - end - - def filesize(path) - # We check via File::size? whether this file provides size info - # via stat (e.g. /proc files often don't), otherwise we have to - # figure it out by reading the whole file into memory. - ::File.size?(path) || ::File.read(path).bytesize - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/head.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/head.rb deleted file mode 100644 index c1c430f653e603..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/head.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -require_relative 'constants' -require_relative 'body_proxy' - -module Rack - # Rack::Head returns an empty body for all HEAD requests. It leaves - # all other requests unchanged. - class Head - def initialize(app) - @app = app - end - - def call(env) - _, _, body = response = @app.call(env) - - if env[REQUEST_METHOD] == HEAD - response[2] = Rack::BodyProxy.new([]) do - body.close if body.respond_to? :close - end - end - - response - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/headers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/headers.rb deleted file mode 100644 index ae1a89d12fceea..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/headers.rb +++ /dev/null @@ -1,154 +0,0 @@ -module Rack - # Rack::Headers is a Hash subclass that downcases all keys. It's designed - # to be used by rack applications that don't implement the Rack 3 SPEC - # (by using non-lowercase response header keys), automatically handling - # the downcasing of keys. - class Headers < Hash - def self.[](*items) - if items.length % 2 != 0 - if items.length == 1 && items.first.is_a?(Hash) - new.merge!(items.first) - else - raise ArgumentError, "odd number of arguments for Rack::Headers" - end - else - hash = new - loop do - break if items.length == 0 - key = items.shift - value = items.shift - hash[key] = value - end - hash - end - end - - def [](key) - super(downcase_key(key)) - end - - def []=(key, value) - super(key.downcase.freeze, value) - end - alias store []= - - def assoc(key) - super(downcase_key(key)) - end - - def compare_by_identity - raise TypeError, "Rack::Headers cannot compare by identity, use regular Hash" - end - - def delete(key) - super(downcase_key(key)) - end - - def dig(key, *a) - super(downcase_key(key), *a) - end - - def fetch(key, *default, &block) - key = downcase_key(key) - super - end - - def fetch_values(*a) - super(*a.map!{|key| downcase_key(key)}) - end - - def has_key?(key) - super(downcase_key(key)) - end - alias include? has_key? - alias key? has_key? - alias member? has_key? - - def invert - hash = self.class.new - each{|key, value| hash[value] = key} - hash - end - - def merge(hash, &block) - dup.merge!(hash, &block) - end - - def reject(&block) - hash = dup - hash.reject!(&block) - hash - end - - def replace(hash) - clear - update(hash) - end - - def select(&block) - hash = dup - hash.select!(&block) - hash - end - - def to_proc - lambda{|x| self[x]} - end - - def transform_values(&block) - dup.transform_values!(&block) - end - - def update(hash, &block) - hash.each do |key, value| - self[key] = if block_given? && include?(key) - block.call(key, self[key], value) - else - value - end - end - self - end - alias merge! update - - def values_at(*keys) - keys.map{|key| self[key]} - end - - # :nocov: - if RUBY_VERSION >= '2.5' - # :nocov: - def slice(*a) - h = self.class.new - a.each{|k| h[k] = self[k] if has_key?(k)} - h - end - - def transform_keys(&block) - dup.transform_keys!(&block) - end - - def transform_keys! - hash = self.class.new - each do |k, v| - hash[yield k] = v - end - replace(hash) - end - end - - # :nocov: - if RUBY_VERSION >= '3.0' - # :nocov: - def except(*a) - super(*a.map!{|key| downcase_key(key)}) - end - end - - private - - def downcase_key(key) - key.is_a?(String) ? key.downcase : key - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/lint.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/lint.rb deleted file mode 100755 index ee3ec7161a83bf..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/lint.rb +++ /dev/null @@ -1,907 +0,0 @@ -# frozen_string_literal: true - -require 'forwardable' - -require_relative 'constants' -require_relative 'utils' - -module Rack - # Rack::Lint validates your application and the requests and - # responses according to the Rack spec. - - class Lint - def initialize(app) - @app = app - end - - # :stopdoc: - - class LintError < RuntimeError; end - # AUTHORS: n.b. The trailing whitespace between paragraphs is important and - # should not be removed. The whitespace creates paragraphs in the RDoc - # output. - # - ## This specification aims to formalize the Rack protocol. You - ## can (and should) use Rack::Lint to enforce it. - ## - ## When you develop middleware, be sure to add a Lint before and - ## after to catch all mistakes. - ## - ## = Rack applications - ## - ## A Rack application is a Ruby object (not a class) that - ## responds to +call+. - def call(env = nil) - Wrapper.new(@app, env).response - end - - class Wrapper - def initialize(app, env) - @app = app - @env = env - @response = nil - @head_request = false - - @status = nil - @headers = nil - @body = nil - @invoked = nil - @content_length = nil - @closed = false - @size = 0 - end - - def response - ## It takes exactly one argument, the *environment* - raise LintError, "No env given" unless @env - check_environment(@env) - - @env[RACK_INPUT] = InputWrapper.new(@env[RACK_INPUT]) - @env[RACK_ERRORS] = ErrorWrapper.new(@env[RACK_ERRORS]) - - ## and returns a non-frozen Array of exactly three values: - @response = @app.call(@env) - raise LintError, "response is not an Array, but #{@response.class}" unless @response.kind_of? Array - raise LintError, "response is frozen" if @response.frozen? - raise LintError, "response array has #{@response.size} elements instead of 3" unless @response.size == 3 - - @status, @headers, @body = @response - ## The *status*, - check_status(@status) - - ## the *headers*, - check_headers(@headers) - - hijack_proc = check_hijack_response(@headers, @env) - if hijack_proc - @headers[RACK_HIJACK] = hijack_proc - end - - ## and the *body*. - check_content_type(@status, @headers) - check_content_length(@status, @headers) - @head_request = @env[REQUEST_METHOD] == HEAD - - @lint = (@env['rack.lint'] ||= []) << self - - if (@env['rack.lint.body_iteration'] ||= 0) > 0 - raise LintError, "Middleware must not call #each directly" - end - - return [@status, @headers, self] - end - - ## - ## == The Environment - ## - def check_environment(env) - ## The environment must be an unfrozen instance of Hash that includes - ## CGI-like headers. The Rack application is free to modify the - ## environment. - raise LintError, "env #{env.inspect} is not a Hash, but #{env.class}" unless env.kind_of? Hash - raise LintError, "env should not be frozen, but is" if env.frozen? - - ## - ## The environment is required to include these variables - ## (adopted from {PEP 333}[https://peps.python.org/pep-0333/]), except when they'd be empty, but see - ## below. - - ## REQUEST_METHOD:: The HTTP request method, such as - ## "GET" or "POST". This cannot ever - ## be an empty string, and so is - ## always required. - - ## SCRIPT_NAME:: The initial portion of the request - ## URL's "path" that corresponds to the - ## application object, so that the - ## application knows its virtual - ## "location". This may be an empty - ## string, if the application corresponds - ## to the "root" of the server. - - ## PATH_INFO:: The remainder of the request URL's - ## "path", designating the virtual - ## "location" of the request's target - ## within the application. This may be an - ## empty string, if the request URL targets - ## the application root and does not have a - ## trailing slash. This value may be - ## percent-encoded when originating from - ## a URL. - - ## QUERY_STRING:: The portion of the request URL that - ## follows the ?, if any. May be - ## empty, but is always required! - - ## SERVER_NAME:: When combined with SCRIPT_NAME and - ## PATH_INFO, these variables can be - ## used to complete the URL. Note, however, - ## that HTTP_HOST, if present, - ## should be used in preference to - ## SERVER_NAME for reconstructing - ## the request URL. - ## SERVER_NAME can never be an empty - ## string, and so is always required. - - ## SERVER_PORT:: An optional +Integer+ which is the port the - ## server is running on. Should be specified if - ## the server is running on a non-standard port. - - ## SERVER_PROTOCOL:: A string representing the HTTP version used - ## for the request. - - ## HTTP_ Variables:: Variables corresponding to the - ## client-supplied HTTP request - ## headers (i.e., variables whose - ## names begin with HTTP_). The - ## presence or absence of these - ## variables should correspond with - ## the presence or absence of the - ## appropriate HTTP header in the - ## request. See - ## {RFC3875 section 4.1.18}[https://tools.ietf.org/html/rfc3875#section-4.1.18] - ## for specific behavior. - - ## In addition to this, the Rack environment must include these - ## Rack-specific variables: - - ## rack.url_scheme:: +http+ or +https+, depending on the - ## request URL. - - ## rack.input:: See below, the input stream. - - ## rack.errors:: See below, the error stream. - - ## rack.hijack?:: See below, if present and true, indicates - ## that the server supports partial hijacking. - - ## rack.hijack:: See below, if present, an object responding - ## to +call+ that is used to perform a full - ## hijack. - - ## Additional environment specifications have approved to - ## standardized middleware APIs. None of these are required to - ## be implemented by the server. - - ## rack.session:: A hash-like interface for storing - ## request session data. - ## The store must implement: - if session = env[RACK_SESSION] - ## store(key, value) (aliased as []=); - unless session.respond_to?(:store) && session.respond_to?(:[]=) - raise LintError, "session #{session.inspect} must respond to store and []=" - end - - ## fetch(key, default = nil) (aliased as []); - unless session.respond_to?(:fetch) && session.respond_to?(:[]) - raise LintError, "session #{session.inspect} must respond to fetch and []" - end - - ## delete(key); - unless session.respond_to?(:delete) - raise LintError, "session #{session.inspect} must respond to delete" - end - - ## clear; - unless session.respond_to?(:clear) - raise LintError, "session #{session.inspect} must respond to clear" - end - - ## to_hash (returning unfrozen Hash instance); - unless session.respond_to?(:to_hash) && session.to_hash.kind_of?(Hash) && !session.to_hash.frozen? - raise LintError, "session #{session.inspect} must respond to to_hash and return unfrozen Hash instance" - end - end - - ## rack.logger:: A common object interface for logging messages. - ## The object must implement: - if logger = env[RACK_LOGGER] - ## info(message, &block) - unless logger.respond_to?(:info) - raise LintError, "logger #{logger.inspect} must respond to info" - end - - ## debug(message, &block) - unless logger.respond_to?(:debug) - raise LintError, "logger #{logger.inspect} must respond to debug" - end - - ## warn(message, &block) - unless logger.respond_to?(:warn) - raise LintError, "logger #{logger.inspect} must respond to warn" - end - - ## error(message, &block) - unless logger.respond_to?(:error) - raise LintError, "logger #{logger.inspect} must respond to error" - end - - ## fatal(message, &block) - unless logger.respond_to?(:fatal) - raise LintError, "logger #{logger.inspect} must respond to fatal" - end - end - - ## rack.multipart.buffer_size:: An Integer hint to the multipart parser as to what chunk size to use for reads and writes. - if bufsize = env[RACK_MULTIPART_BUFFER_SIZE] - unless bufsize.is_a?(Integer) && bufsize > 0 - raise LintError, "rack.multipart.buffer_size must be an Integer > 0 if specified" - end - end - - ## rack.multipart.tempfile_factory:: An object responding to #call with two arguments, the filename and content_type given for the multipart form field, and returning an IO-like object that responds to #<< and optionally #rewind. This factory will be used to instantiate the tempfile for each multipart form file upload field, rather than the default class of Tempfile. - if tempfile_factory = env[RACK_MULTIPART_TEMPFILE_FACTORY] - raise LintError, "rack.multipart.tempfile_factory must respond to #call" unless tempfile_factory.respond_to?(:call) - env[RACK_MULTIPART_TEMPFILE_FACTORY] = lambda do |filename, content_type| - io = tempfile_factory.call(filename, content_type) - raise LintError, "rack.multipart.tempfile_factory return value must respond to #<<" unless io.respond_to?(:<<) - io - end - end - - ## The server or the application can store their own data in the - ## environment, too. The keys must contain at least one dot, - ## and should be prefixed uniquely. The prefix rack. - ## is reserved for use with the Rack core distribution and other - ## accepted specifications and must not be used otherwise. - ## - - %w[REQUEST_METHOD SERVER_NAME QUERY_STRING SERVER_PROTOCOL - rack.input rack.errors].each { |header| - raise LintError, "env missing required key #{header}" unless env.include? header - } - - ## The SERVER_PORT must be an Integer if set. - server_port = env["SERVER_PORT"] - unless server_port.nil? || (Integer(server_port) rescue false) - raise LintError, "env[SERVER_PORT] is not an Integer" - end - - ## The SERVER_NAME must be a valid authority as defined by RFC7540. - unless (URI.parse("http://#{env[SERVER_NAME]}/") rescue false) - raise LintError, "#{env[SERVER_NAME]} must be a valid authority" - end - - ## The HTTP_HOST must be a valid authority as defined by RFC7540. - unless (URI.parse("http://#{env[HTTP_HOST]}/") rescue false) - raise LintError, "#{env[HTTP_HOST]} must be a valid authority" - end - - ## The SERVER_PROTOCOL must match the regexp HTTP/\d(\.\d)?. - server_protocol = env['SERVER_PROTOCOL'] - unless %r{HTTP/\d(\.\d)?}.match?(server_protocol) - raise LintError, "env[SERVER_PROTOCOL] does not match HTTP/\\d(\\.\\d)?" - end - - ## If the HTTP_VERSION is present, it must equal the SERVER_PROTOCOL. - if env['HTTP_VERSION'] && env['HTTP_VERSION'] != server_protocol - raise LintError, "env[HTTP_VERSION] does not equal env[SERVER_PROTOCOL]" - end - - ## The environment must not contain the keys - ## HTTP_CONTENT_TYPE or HTTP_CONTENT_LENGTH - ## (use the versions without HTTP_). - %w[HTTP_CONTENT_TYPE HTTP_CONTENT_LENGTH].each { |header| - if env.include? header - raise LintError, "env contains #{header}, must use #{header[5..-1]}" - end - } - - ## The CGI keys (named without a period) must have String values. - ## If the string values for CGI keys contain non-ASCII characters, - ## they should use ASCII-8BIT encoding. - env.each { |key, value| - next if key.include? "." # Skip extensions - unless value.kind_of? String - raise LintError, "env variable #{key} has non-string value #{value.inspect}" - end - next if value.encoding == Encoding::ASCII_8BIT - unless value.b !~ /[\x80-\xff]/n - raise LintError, "env variable #{key} has value containing non-ASCII characters and has non-ASCII-8BIT encoding #{value.inspect} encoding: #{value.encoding}" - end - } - - ## There are the following restrictions: - - ## * rack.url_scheme must either be +http+ or +https+. - unless %w[http https].include?(env[RACK_URL_SCHEME]) - raise LintError, "rack.url_scheme unknown: #{env[RACK_URL_SCHEME].inspect}" - end - - ## * There must be a valid input stream in rack.input. - check_input env[RACK_INPUT] - ## * There must be a valid error stream in rack.errors. - check_error env[RACK_ERRORS] - ## * There may be a valid hijack callback in rack.hijack - check_hijack env - - ## * The REQUEST_METHOD must be a valid token. - unless env[REQUEST_METHOD] =~ /\A[0-9A-Za-z!\#$%&'*+.^_`|~-]+\z/ - raise LintError, "REQUEST_METHOD unknown: #{env[REQUEST_METHOD].dump}" - end - - ## * The SCRIPT_NAME, if non-empty, must start with / - if env.include?(SCRIPT_NAME) && env[SCRIPT_NAME] != "" && env[SCRIPT_NAME] !~ /\A\// - raise LintError, "SCRIPT_NAME must start with /" - end - ## * The PATH_INFO, if non-empty, must start with / - if env.include?(PATH_INFO) && env[PATH_INFO] != "" && env[PATH_INFO] !~ /\A\// - raise LintError, "PATH_INFO must start with /" - end - ## * The CONTENT_LENGTH, if given, must consist of digits only. - if env.include?("CONTENT_LENGTH") && env["CONTENT_LENGTH"] !~ /\A\d+\z/ - raise LintError, "Invalid CONTENT_LENGTH: #{env["CONTENT_LENGTH"]}" - end - - ## * One of SCRIPT_NAME or PATH_INFO must be - ## set. PATH_INFO should be / if - ## SCRIPT_NAME is empty. - unless env[SCRIPT_NAME] || env[PATH_INFO] - raise LintError, "One of SCRIPT_NAME or PATH_INFO must be set (make PATH_INFO '/' if SCRIPT_NAME is empty)" - end - ## SCRIPT_NAME never should be /, but instead be empty. - unless env[SCRIPT_NAME] != "/" - raise LintError, "SCRIPT_NAME cannot be '/', make it '' and PATH_INFO '/'" - end - - ## rack.response_finished:: An array of callables run by the server after the response has been - ## processed. This would typically be invoked after sending the response to the client, but it could also be - ## invoked if an error occurs while generating the response or sending the response; in that case, the error - ## argument will be a subclass of +Exception+. - ## The callables are invoked with +env, status, headers, error+ arguments and should not raise any - ## exceptions. They should be invoked in reverse order of registration. - if callables = env[RACK_RESPONSE_FINISHED] - raise LintError, "rack.response_finished must be an array of callable objects" unless callables.is_a?(Array) - - callables.each do |callable| - raise LintError, "rack.response_finished values must respond to call(env, status, headers, error)" unless callable.respond_to?(:call) - end - end - end - - ## - ## === The Input Stream - ## - ## The input stream is an IO-like object which contains the raw HTTP - ## POST data. - def check_input(input) - ## When applicable, its external encoding must be "ASCII-8BIT" and it - ## must be opened in binary mode, for Ruby 1.9 compatibility. - if input.respond_to?(:external_encoding) && input.external_encoding != Encoding::ASCII_8BIT - raise LintError, "rack.input #{input} does not have ASCII-8BIT as its external encoding" - end - if input.respond_to?(:binmode?) && !input.binmode? - raise LintError, "rack.input #{input} is not opened in binary mode" - end - - ## The input stream must respond to +gets+, +each+, and +read+. - [:gets, :each, :read].each { |method| - unless input.respond_to? method - raise LintError, "rack.input #{input} does not respond to ##{method}" - end - } - end - - class InputWrapper - def initialize(input) - @input = input - end - - ## * +gets+ must be called without arguments and return a string, - ## or +nil+ on EOF. - def gets(*args) - raise LintError, "rack.input#gets called with arguments" unless args.size == 0 - v = @input.gets - unless v.nil? or v.kind_of? String - raise LintError, "rack.input#gets didn't return a String" - end - v - end - - ## * +read+ behaves like IO#read. - ## Its signature is read([length, [buffer]]). - ## - ## If given, +length+ must be a non-negative Integer (>= 0) or +nil+, - ## and +buffer+ must be a String and may not be nil. - ## - ## If +length+ is given and not nil, then this method reads at most - ## +length+ bytes from the input stream. - ## - ## If +length+ is not given or nil, then this method reads - ## all data until EOF. - ## - ## When EOF is reached, this method returns nil if +length+ is given - ## and not nil, or "" if +length+ is not given or is nil. - ## - ## If +buffer+ is given, then the read data will be placed - ## into +buffer+ instead of a newly created String object. - def read(*args) - unless args.size <= 2 - raise LintError, "rack.input#read called with too many arguments" - end - if args.size >= 1 - unless args.first.kind_of?(Integer) || args.first.nil? - raise LintError, "rack.input#read called with non-integer and non-nil length" - end - unless args.first.nil? || args.first >= 0 - raise LintError, "rack.input#read called with a negative length" - end - end - if args.size >= 2 - unless args[1].kind_of?(String) - raise LintError, "rack.input#read called with non-String buffer" - end - end - - v = @input.read(*args) - - unless v.nil? or v.kind_of? String - raise LintError, "rack.input#read didn't return nil or a String" - end - if args[0].nil? - unless !v.nil? - raise LintError, "rack.input#read(nil) returned nil on EOF" - end - end - - v - end - - ## * +each+ must be called without arguments and only yield Strings. - def each(*args) - raise LintError, "rack.input#each called with arguments" unless args.size == 0 - @input.each { |line| - unless line.kind_of? String - raise LintError, "rack.input#each didn't yield a String" - end - yield line - } - end - - ## * +close+ can be called on the input stream to indicate that the - ## any remaining input is not needed. - def close(*args) - @input.close(*args) - end - end - - ## - ## === The Error Stream - ## - def check_error(error) - ## The error stream must respond to +puts+, +write+ and +flush+. - [:puts, :write, :flush].each { |method| - unless error.respond_to? method - raise LintError, "rack.error #{error} does not respond to ##{method}" - end - } - end - - class ErrorWrapper - def initialize(error) - @error = error - end - - ## * +puts+ must be called with a single argument that responds to +to_s+. - def puts(str) - @error.puts str - end - - ## * +write+ must be called with a single argument that is a String. - def write(str) - raise LintError, "rack.errors#write not called with a String" unless str.kind_of? String - @error.write str - end - - ## * +flush+ must be called without arguments and must be called - ## in order to make the error appear for sure. - def flush - @error.flush - end - - ## * +close+ must never be called on the error stream. - def close(*args) - raise LintError, "rack.errors#close must not be called" - end - end - - ## - ## === Hijacking - ## - ## The hijacking interfaces provides a means for an application to take - ## control of the HTTP connection. There are two distinct hijack - ## interfaces: full hijacking where the application takes over the raw - ## connection, and partial hijacking where the application takes over - ## just the response body stream. In both cases, the application is - ## responsible for closing the hijacked stream. - ## - ## Full hijacking only works with HTTP/1. Partial hijacking is functionally - ## equivalent to streaming bodies, and is still optionally supported for - ## backwards compatibility with older Rack versions. - ## - ## ==== Full Hijack - ## - ## Full hijack is used to completely take over an HTTP/1 connection. It - ## occurs before any headers are written and causes the request to - ## ignores any response generated by the application. - ## - ## It is intended to be used when applications need access to raw HTTP/1 - ## connection. - ## - def check_hijack(env) - ## If +rack.hijack+ is present in +env+, it must respond to +call+ - if original_hijack = env[RACK_HIJACK] - raise LintError, "rack.hijack must respond to call" unless original_hijack.respond_to?(:call) - - env[RACK_HIJACK] = proc do - io = original_hijack.call - - ## and return an +IO+ instance which can be used to read and write - ## to the underlying connection using HTTP/1 semantics and - ## formatting. - raise LintError, "rack.hijack must return an IO instance" unless io.is_a?(IO) - - io - end - end - end - - ## - ## ==== Partial Hijack - ## - ## Partial hijack is used for bi-directional streaming of the request and - ## response body. It occurs after the status and headers are written by - ## the server and causes the server to ignore the Body of the response. - ## - ## It is intended to be used when applications need bi-directional - ## streaming. - ## - def check_hijack_response(headers, env) - ## If +rack.hijack?+ is present in +env+ and truthy, - if env[RACK_IS_HIJACK] - ## an application may set the special response header +rack.hijack+ - if original_hijack = headers[RACK_HIJACK] - ## to an object that responds to +call+, - unless original_hijack.respond_to?(:call) - raise LintError, 'rack.hijack header must respond to #call' - end - ## accepting a +stream+ argument. - return proc do |io| - original_hijack.call StreamWrapper.new(io) - end - end - ## - ## After the response status and headers have been sent, this hijack - ## callback will be invoked with a +stream+ argument which follows the - ## same interface as outlined in "Streaming Body". Servers must - ## ignore the +body+ part of the response tuple when the - ## +rack.hijack+ response header is present. Using an empty +Array+ - ## instance is recommended. - else - ## - ## The special response header +rack.hijack+ must only be set - ## if the request +env+ has a truthy +rack.hijack?+. - if headers.key?(RACK_HIJACK) - raise LintError, 'rack.hijack header must not be present if server does not support hijacking' - end - end - - nil - end - - ## == The Response - ## - ## === The Status - ## - def check_status(status) - ## This is an HTTP status. It must be an Integer greater than or equal to - ## 100. - unless status.is_a?(Integer) && status >= 100 - raise LintError, "Status must be an Integer >=100" - end - end - - ## - ## === The Headers - ## - def check_headers(headers) - ## The headers must be a unfrozen Hash. - unless headers.kind_of?(Hash) - raise LintError, "headers object should be a hash, but isn't (got #{headers.class} as headers)" - end - - if headers.frozen? - raise LintError, "headers object should not be frozen, but is" - end - - headers.each do |key, value| - ## The header keys must be Strings. - unless key.kind_of? String - raise LintError, "header key must be a string, was #{key.class}" - end - - ## Special headers starting "rack." are for communicating with the - ## server, and must not be sent back to the client. - next if key.start_with?("rack.") - - ## The header must not contain a +Status+ key. - raise LintError, "header must not contain status" if key == "status" - ## Header keys must conform to RFC7230 token specification, i.e. cannot - ## contain non-printable ASCII, DQUOTE or "(),/:;<=>?@[\]{}". - raise LintError, "invalid header name: #{key}" if key =~ /[\(\),\/:;<=>\?@\[\\\]{}[:cntrl:]]/ - ## Header keys must not contain uppercase ASCII characters (A-Z). - raise LintError, "uppercase character in header name: #{key}" if key =~ /[A-Z]/ - - ## Header values must be either a String instance, - if value.kind_of?(String) - check_header_value(key, value) - elsif value.kind_of?(Array) - ## or an Array of String instances, - value.each{|value| check_header_value(key, value)} - else - raise LintError, "a header value must be a String or Array of Strings, but the value of '#{key}' is a #{value.class}" - end - end - end - - def check_header_value(key, value) - ## such that each String instance must not contain characters below 037. - if value =~ /[\000-\037]/ - raise LintError, "invalid header value #{key}: #{value.inspect}" - end - end - - ## - ## === The content-type - ## - def check_content_type(status, headers) - headers.each { |key, value| - ## There must not be a content-type header key when the +Status+ is 1xx, - ## 204, or 304. - if key == "content-type" - if Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.key? status.to_i - raise LintError, "content-type header found in #{status} response, not allowed" - end - return - end - } - end - - ## - ## === The content-length - ## - def check_content_length(status, headers) - headers.each { |key, value| - if key == 'content-length' - ## There must not be a content-length header key when the - ## +Status+ is 1xx, 204, or 304. - if Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.key? status.to_i - raise LintError, "content-length header found in #{status} response, not allowed" - end - @content_length = value - end - } - end - - def verify_content_length(size) - if @head_request - unless size == 0 - raise LintError, "Response body was given for HEAD request, but should be empty" - end - elsif @content_length - unless @content_length == size.to_s - raise LintError, "content-length header was #{@content_length}, but should be #{size}" - end - end - end - - ## - ## === The Body - ## - ## The Body is typically an +Array+ of +String+ instances, an enumerable - ## that yields +String+ instances, a +Proc+ instance, or a File-like - ## object. - ## - ## The Body must respond to +each+ or +call+. It may optionally respond - ## to +to_path+ or +to_ary+. A Body that responds to +each+ is considered - ## to be an Enumerable Body. A Body that responds to +call+ is considered - ## to be a Streaming Body. - ## - ## A Body that responds to both +each+ and +call+ must be treated as an - ## Enumerable Body, not a Streaming Body. If it responds to +each+, you - ## must call +each+ and not +call+. If the Body doesn't respond to - ## +each+, then you can assume it responds to +call+. - ## - ## The Body must either be consumed or returned. The Body is consumed by - ## optionally calling either +each+ or +call+. - ## Then, if the Body responds to +close+, it must be called to release - ## any resources associated with the generation of the body. - ## In other words, +close+ must always be called at least once; typically - ## after the web server has sent the response to the client, but also in - ## cases where the Rack application makes internal/virtual requests and - ## discards the response. - ## - def close - ## - ## After calling +close+, the Body is considered closed and should not - ## be consumed again. - @closed = true - - ## If the original Body is replaced by a new Body, the new Body must - ## also consume the original Body by calling +close+ if possible. - @body.close if @body.respond_to?(:close) - - index = @lint.index(self) - unless @env['rack.lint'][0..index].all? {|lint| lint.instance_variable_get(:@closed)} - raise LintError, "Body has not been closed" - end - end - - def verify_to_path - ## - ## If the Body responds to +to_path+, it must return a +String+ - ## path for the local file system whose contents are identical - ## to that produced by calling +each+; this may be used by the - ## server as an alternative, possibly more efficient way to - ## transport the response. The +to_path+ method does not consume - ## the body. - if @body.respond_to?(:to_path) - unless ::File.exist? @body.to_path - raise LintError, "The file identified by body.to_path does not exist" - end - end - end - - ## - ## ==== Enumerable Body - ## - def each - ## The Enumerable Body must respond to +each+. - raise LintError, "Enumerable Body must respond to each" unless @body.respond_to?(:each) - - ## It must only be called once. - raise LintError, "Response body must only be invoked once (#{@invoked})" unless @invoked.nil? - - ## It must not be called after being closed. - raise LintError, "Response body is already closed" if @closed - - @invoked = :each - - @body.each do |chunk| - ## and must only yield String values. - unless chunk.kind_of? String - raise LintError, "Body yielded non-string value #{chunk.inspect}" - end - - ## - ## The Body itself should not be an instance of String, as this will - ## break in Ruby 1.9. - ## - ## Middleware must not call +each+ directly on the Body. - ## Instead, middleware can return a new Body that calls +each+ on the - ## original Body, yielding at least once per iteration. - if @lint[0] == self - @env['rack.lint.body_iteration'] += 1 - else - if (@env['rack.lint.body_iteration'] -= 1) > 0 - raise LintError, "New body must yield at least once per iteration of old body" - end - end - - @size += chunk.bytesize - yield chunk - end - - verify_content_length(@size) - - verify_to_path - end - - BODY_METHODS = {to_ary: true, each: true, call: true, to_path: true} - - def to_path - @body.to_path - end - - def respond_to?(name, *) - if BODY_METHODS.key?(name) - @body.respond_to?(name) - else - super - end - end - - ## - ## If the Body responds to +to_ary+, it must return an +Array+ whose - ## contents are identical to that produced by calling +each+. - ## Middleware may call +to_ary+ directly on the Body and return a new - ## Body in its place. In other words, middleware can only process the - ## Body directly if it responds to +to_ary+. If the Body responds to both - ## +to_ary+ and +close+, its implementation of +to_ary+ must call - ## +close+. - def to_ary - @body.to_ary.tap do |content| - unless content == @body.enum_for.to_a - raise LintError, "#to_ary not identical to contents produced by calling #each" - end - end - ensure - close - end - - ## - ## ==== Streaming Body - ## - def call(stream) - ## The Streaming Body must respond to +call+. - raise LintError, "Streaming Body must respond to call" unless @body.respond_to?(:call) - - ## It must only be called once. - raise LintError, "Response body must only be invoked once (#{@invoked})" unless @invoked.nil? - - ## It must not be called after being closed. - raise LintError, "Response body is already closed" if @closed - - @invoked = :call - - ## It takes a +stream+ argument. - ## - ## The +stream+ argument must implement: - ## read, write, <<, flush, close, close_read, close_write, closed? - ## - @body.call(StreamWrapper.new(stream)) - end - - class StreamWrapper - extend Forwardable - - ## The semantics of these IO methods must be a best effort match to - ## those of a normal Ruby IO or Socket object, using standard arguments - ## and raising standard exceptions. Servers are encouraged to simply - ## pass on real IO objects, although it is recognized that this approach - ## is not directly compatible with HTTP/2. - REQUIRED_METHODS = [ - :read, :write, :<<, :flush, :close, - :close_read, :close_write, :closed? - ] - - def_delegators :@stream, *REQUIRED_METHODS - - def initialize(stream) - @stream = stream - - REQUIRED_METHODS.each do |method_name| - raise LintError, "Stream must respond to #{method_name}" unless stream.respond_to?(method_name) - end - end - end - - # :startdoc: - end - end -end - -## -## == Thanks -## Some parts of this specification are adopted from {PEP 333 – Python Web Server Gateway Interface v1.0}[https://peps.python.org/pep-0333/] -## I'd like to thank everyone involved in that effort. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/lock.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/lock.rb deleted file mode 100644 index 342123a0f0880e..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/lock.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require_relative 'body_proxy' - -module Rack - # Rack::Lock locks every request inside a mutex, so that every request - # will effectively be executed synchronously. - class Lock - def initialize(app, mutex = Mutex.new) - @app, @mutex = app, mutex - end - - def call(env) - @mutex.lock - begin - response = @app.call(env) - returned = response << BodyProxy.new(response.pop) { unlock } - ensure - unlock unless returned - end - end - - private - - def unlock - @mutex.unlock - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/logger.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/logger.rb deleted file mode 100644 index bdcc069005ab51..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/logger.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -require 'logger' - -require_relative 'constants' - -module Rack - # Sets up rack.logger to write to rack.errors stream - class Logger - def initialize(app, level = ::Logger::INFO) - @app, @level = app, level - end - - def call(env) - logger = ::Logger.new(env[RACK_ERRORS]) - logger.level = @level - - env[RACK_LOGGER] = logger - @app.call(env) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/media_type.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/media_type.rb deleted file mode 100644 index ff3145debfcc14..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/media_type.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -module Rack - # Rack::MediaType parse media type and parameters out of content_type string - - class MediaType - SPLIT_PATTERN = %r{\s*[;,]\s*} - - class << self - # The media type (type/subtype) portion of the CONTENT_TYPE header - # without any media type parameters. e.g., when CONTENT_TYPE is - # "text/plain;charset=utf-8", the media-type is "text/plain". - # - # For more information on the use of media types in HTTP, see: - # http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7 - def type(content_type) - return nil unless content_type - content_type.split(SPLIT_PATTERN, 2).first.tap(&:downcase!) - end - - # The media type parameters provided in CONTENT_TYPE as a Hash, or - # an empty Hash if no CONTENT_TYPE or media-type parameters were - # provided. e.g., when the CONTENT_TYPE is "text/plain;charset=utf-8", - # this method responds with the following Hash: - # { 'charset' => 'utf-8' } - def params(content_type) - return {} if content_type.nil? - - content_type.split(SPLIT_PATTERN)[1..-1].each_with_object({}) do |s, hsh| - k, v = s.split('=', 2) - - hsh[k.tap(&:downcase!)] = strip_doublequotes(v) - end - end - - private - - def strip_doublequotes(str) - (str.start_with?('"') && str.end_with?('"')) ? str[1..-2] : str - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/method_override.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/method_override.rb deleted file mode 100644 index 6125b1916f8f90..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/method_override.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -require_relative 'constants' -require_relative 'request' -require_relative 'utils' - -module Rack - class MethodOverride - HTTP_METHODS = %w[GET HEAD PUT POST DELETE OPTIONS PATCH LINK UNLINK] - - METHOD_OVERRIDE_PARAM_KEY = "_method" - HTTP_METHOD_OVERRIDE_HEADER = "HTTP_X_HTTP_METHOD_OVERRIDE" - ALLOWED_METHODS = %w[POST] - - def initialize(app) - @app = app - end - - def call(env) - if allowed_methods.include?(env[REQUEST_METHOD]) - method = method_override(env) - if HTTP_METHODS.include?(method) - env[RACK_METHODOVERRIDE_ORIGINAL_METHOD] = env[REQUEST_METHOD] - env[REQUEST_METHOD] = method - end - end - - @app.call(env) - end - - def method_override(env) - req = Request.new(env) - method = method_override_param(req) || - env[HTTP_METHOD_OVERRIDE_HEADER] - begin - method.to_s.upcase - rescue ArgumentError - env[RACK_ERRORS].puts "Invalid string for method" - end - end - - private - - def allowed_methods - ALLOWED_METHODS - end - - def method_override_param(req) - req.POST[METHOD_OVERRIDE_PARAM_KEY] if req.form_data? || req.parseable_data? - rescue Utils::InvalidParameterError, Utils::ParameterTypeError, QueryParser::ParamsTooDeepError - req.get_header(RACK_ERRORS).puts "Invalid or incomplete POST params" - rescue EOFError - req.get_header(RACK_ERRORS).puts "Bad request content body" - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/mime.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/mime.rb deleted file mode 100644 index b62e3e8d6fb4dd..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/mime.rb +++ /dev/null @@ -1,693 +0,0 @@ -# frozen_string_literal: true - -module Rack - module Mime - # Returns String with mime type if found, otherwise use +fallback+. - # +ext+ should be filename extension in the '.ext' format that - # File.extname(file) returns. - # +fallback+ may be any object - # - # Also see the documentation for MIME_TYPES - # - # Usage: - # Rack::Mime.mime_type('.foo') - # - # This is a shortcut for: - # Rack::Mime::MIME_TYPES.fetch('.foo', 'application/octet-stream') - - def mime_type(ext, fallback = 'application/octet-stream') - MIME_TYPES.fetch(ext.to_s.downcase, fallback) - end - module_function :mime_type - - # Returns true if the given value is a mime match for the given mime match - # specification, false otherwise. - # - # Rack::Mime.match?('text/html', 'text/*') => true - # Rack::Mime.match?('text/plain', '*') => true - # Rack::Mime.match?('text/html', 'application/json') => false - - def match?(value, matcher) - v1, v2 = value.split('/', 2) - m1, m2 = matcher.split('/', 2) - - (m1 == '*' || v1 == m1) && (m2.nil? || m2 == '*' || m2 == v2) - end - module_function :match? - - # List of most common mime-types, selected various sources - # according to their usefulness in a webserving scope for Ruby - # users. - # - # To amend this list with your local mime.types list you can use: - # - # require 'webrick/httputils' - # list = WEBrick::HTTPUtils.load_mime_types('/etc/mime.types') - # Rack::Mime::MIME_TYPES.merge!(list) - # - # N.B. On Ubuntu the mime.types file does not include the leading period, so - # users may need to modify the data before merging into the hash. - - MIME_TYPES = { - ".123" => "application/vnd.lotus-1-2-3", - ".3dml" => "text/vnd.in3d.3dml", - ".3g2" => "video/3gpp2", - ".3gp" => "video/3gpp", - ".a" => "application/octet-stream", - ".acc" => "application/vnd.americandynamics.acc", - ".ace" => "application/x-ace-compressed", - ".acu" => "application/vnd.acucobol", - ".aep" => "application/vnd.audiograph", - ".afp" => "application/vnd.ibm.modcap", - ".ai" => "application/postscript", - ".aif" => "audio/x-aiff", - ".aiff" => "audio/x-aiff", - ".ami" => "application/vnd.amiga.ami", - ".apng" => "image/apng", - ".appcache" => "text/cache-manifest", - ".apr" => "application/vnd.lotus-approach", - ".asc" => "application/pgp-signature", - ".asf" => "video/x-ms-asf", - ".asm" => "text/x-asm", - ".aso" => "application/vnd.accpac.simply.aso", - ".asx" => "video/x-ms-asf", - ".atc" => "application/vnd.acucorp", - ".atom" => "application/atom+xml", - ".atomcat" => "application/atomcat+xml", - ".atomsvc" => "application/atomsvc+xml", - ".atx" => "application/vnd.antix.game-component", - ".au" => "audio/basic", - ".avi" => "video/x-msvideo", - ".avif" => "image/avif", - ".bat" => "application/x-msdownload", - ".bcpio" => "application/x-bcpio", - ".bdm" => "application/vnd.syncml.dm+wbxml", - ".bh2" => "application/vnd.fujitsu.oasysprs", - ".bin" => "application/octet-stream", - ".bmi" => "application/vnd.bmi", - ".bmp" => "image/bmp", - ".box" => "application/vnd.previewsystems.box", - ".btif" => "image/prs.btif", - ".bz" => "application/x-bzip", - ".bz2" => "application/x-bzip2", - ".c" => "text/x-c", - ".c4g" => "application/vnd.clonk.c4group", - ".cab" => "application/vnd.ms-cab-compressed", - ".cc" => "text/x-c", - ".ccxml" => "application/ccxml+xml", - ".cdbcmsg" => "application/vnd.contact.cmsg", - ".cdkey" => "application/vnd.mediastation.cdkey", - ".cdx" => "chemical/x-cdx", - ".cdxml" => "application/vnd.chemdraw+xml", - ".cdy" => "application/vnd.cinderella", - ".cer" => "application/pkix-cert", - ".cgm" => "image/cgm", - ".chat" => "application/x-chat", - ".chm" => "application/vnd.ms-htmlhelp", - ".chrt" => "application/vnd.kde.kchart", - ".cif" => "chemical/x-cif", - ".cii" => "application/vnd.anser-web-certificate-issue-initiation", - ".cil" => "application/vnd.ms-artgalry", - ".cla" => "application/vnd.claymore", - ".class" => "application/octet-stream", - ".clkk" => "application/vnd.crick.clicker.keyboard", - ".clkp" => "application/vnd.crick.clicker.palette", - ".clkt" => "application/vnd.crick.clicker.template", - ".clkw" => "application/vnd.crick.clicker.wordbank", - ".clkx" => "application/vnd.crick.clicker", - ".clp" => "application/x-msclip", - ".cmc" => "application/vnd.cosmocaller", - ".cmdf" => "chemical/x-cmdf", - ".cml" => "chemical/x-cml", - ".cmp" => "application/vnd.yellowriver-custom-menu", - ".cmx" => "image/x-cmx", - ".com" => "application/x-msdownload", - ".conf" => "text/plain", - ".cpio" => "application/x-cpio", - ".cpp" => "text/x-c", - ".cpt" => "application/mac-compactpro", - ".crd" => "application/x-mscardfile", - ".crl" => "application/pkix-crl", - ".crt" => "application/x-x509-ca-cert", - ".csh" => "application/x-csh", - ".csml" => "chemical/x-csml", - ".csp" => "application/vnd.commonspace", - ".css" => "text/css", - ".csv" => "text/csv", - ".curl" => "application/vnd.curl", - ".cww" => "application/prs.cww", - ".cxx" => "text/x-c", - ".daf" => "application/vnd.mobius.daf", - ".davmount" => "application/davmount+xml", - ".dcr" => "application/x-director", - ".dd2" => "application/vnd.oma.dd2+xml", - ".ddd" => "application/vnd.fujixerox.ddd", - ".deb" => "application/x-debian-package", - ".der" => "application/x-x509-ca-cert", - ".dfac" => "application/vnd.dreamfactory", - ".diff" => "text/x-diff", - ".dis" => "application/vnd.mobius.dis", - ".djv" => "image/vnd.djvu", - ".djvu" => "image/vnd.djvu", - ".dll" => "application/x-msdownload", - ".dmg" => "application/octet-stream", - ".dna" => "application/vnd.dna", - ".doc" => "application/msword", - ".docm" => "application/vnd.ms-word.document.macroEnabled.12", - ".docx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document", - ".dot" => "application/msword", - ".dotm" => "application/vnd.ms-word.template.macroEnabled.12", - ".dotx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.template", - ".dp" => "application/vnd.osgi.dp", - ".dpg" => "application/vnd.dpgraph", - ".dsc" => "text/prs.lines.tag", - ".dtd" => "application/xml-dtd", - ".dts" => "audio/vnd.dts", - ".dtshd" => "audio/vnd.dts.hd", - ".dv" => "video/x-dv", - ".dvi" => "application/x-dvi", - ".dwf" => "model/vnd.dwf", - ".dwg" => "image/vnd.dwg", - ".dxf" => "image/vnd.dxf", - ".dxp" => "application/vnd.spotfire.dxp", - ".ear" => "application/java-archive", - ".ecelp4800" => "audio/vnd.nuera.ecelp4800", - ".ecelp7470" => "audio/vnd.nuera.ecelp7470", - ".ecelp9600" => "audio/vnd.nuera.ecelp9600", - ".ecma" => "application/ecmascript", - ".edm" => "application/vnd.novadigm.edm", - ".edx" => "application/vnd.novadigm.edx", - ".efif" => "application/vnd.picsel", - ".ei6" => "application/vnd.pg.osasli", - ".eml" => "message/rfc822", - ".eol" => "audio/vnd.digital-winds", - ".eot" => "application/vnd.ms-fontobject", - ".eps" => "application/postscript", - ".es3" => "application/vnd.eszigno3+xml", - ".esf" => "application/vnd.epson.esf", - ".etx" => "text/x-setext", - ".exe" => "application/x-msdownload", - ".ext" => "application/vnd.novadigm.ext", - ".ez" => "application/andrew-inset", - ".ez2" => "application/vnd.ezpix-album", - ".ez3" => "application/vnd.ezpix-package", - ".f" => "text/x-fortran", - ".f77" => "text/x-fortran", - ".f90" => "text/x-fortran", - ".fbs" => "image/vnd.fastbidsheet", - ".fdf" => "application/vnd.fdf", - ".fe_launch" => "application/vnd.denovo.fcselayout-link", - ".fg5" => "application/vnd.fujitsu.oasysgp", - ".fli" => "video/x-fli", - ".flif" => "image/flif", - ".flo" => "application/vnd.micrografx.flo", - ".flv" => "video/x-flv", - ".flw" => "application/vnd.kde.kivio", - ".flx" => "text/vnd.fmi.flexstor", - ".fly" => "text/vnd.fly", - ".fm" => "application/vnd.framemaker", - ".fnc" => "application/vnd.frogans.fnc", - ".for" => "text/x-fortran", - ".fpx" => "image/vnd.fpx", - ".fsc" => "application/vnd.fsc.weblaunch", - ".fst" => "image/vnd.fst", - ".ftc" => "application/vnd.fluxtime.clip", - ".fti" => "application/vnd.anser-web-funds-transfer-initiation", - ".fvt" => "video/vnd.fvt", - ".fzs" => "application/vnd.fuzzysheet", - ".g3" => "image/g3fax", - ".gac" => "application/vnd.groove-account", - ".gdl" => "model/vnd.gdl", - ".gem" => "application/octet-stream", - ".gemspec" => "text/x-script.ruby", - ".ghf" => "application/vnd.groove-help", - ".gif" => "image/gif", - ".gim" => "application/vnd.groove-identity-message", - ".gmx" => "application/vnd.gmx", - ".gph" => "application/vnd.flographit", - ".gqf" => "application/vnd.grafeq", - ".gram" => "application/srgs", - ".grv" => "application/vnd.groove-injector", - ".grxml" => "application/srgs+xml", - ".gtar" => "application/x-gtar", - ".gtm" => "application/vnd.groove-tool-message", - ".gtw" => "model/vnd.gtw", - ".gv" => "text/vnd.graphviz", - ".gz" => "application/x-gzip", - ".h" => "text/x-c", - ".h261" => "video/h261", - ".h263" => "video/h263", - ".h264" => "video/h264", - ".hbci" => "application/vnd.hbci", - ".hdf" => "application/x-hdf", - ".heic" => "image/heic", - ".heics" => "image/heic-sequence", - ".heif" => "image/heif", - ".heifs" => "image/heif-sequence", - ".hh" => "text/x-c", - ".hlp" => "application/winhlp", - ".hpgl" => "application/vnd.hp-hpgl", - ".hpid" => "application/vnd.hp-hpid", - ".hps" => "application/vnd.hp-hps", - ".hqx" => "application/mac-binhex40", - ".htc" => "text/x-component", - ".htke" => "application/vnd.kenameaapp", - ".htm" => "text/html", - ".html" => "text/html", - ".hvd" => "application/vnd.yamaha.hv-dic", - ".hvp" => "application/vnd.yamaha.hv-voice", - ".hvs" => "application/vnd.yamaha.hv-script", - ".icc" => "application/vnd.iccprofile", - ".ice" => "x-conference/x-cooltalk", - ".ico" => "image/vnd.microsoft.icon", - ".ics" => "text/calendar", - ".ief" => "image/ief", - ".ifb" => "text/calendar", - ".ifm" => "application/vnd.shana.informed.formdata", - ".igl" => "application/vnd.igloader", - ".igs" => "model/iges", - ".igx" => "application/vnd.micrografx.igx", - ".iif" => "application/vnd.shana.informed.interchange", - ".imp" => "application/vnd.accpac.simply.imp", - ".ims" => "application/vnd.ms-ims", - ".ipk" => "application/vnd.shana.informed.package", - ".irm" => "application/vnd.ibm.rights-management", - ".irp" => "application/vnd.irepository.package+xml", - ".iso" => "application/octet-stream", - ".itp" => "application/vnd.shana.informed.formtemplate", - ".ivp" => "application/vnd.immervision-ivp", - ".ivu" => "application/vnd.immervision-ivu", - ".jad" => "text/vnd.sun.j2me.app-descriptor", - ".jam" => "application/vnd.jam", - ".jar" => "application/java-archive", - ".java" => "text/x-java-source", - ".jisp" => "application/vnd.jisp", - ".jlt" => "application/vnd.hp-jlyt", - ".jnlp" => "application/x-java-jnlp-file", - ".joda" => "application/vnd.joost.joda-archive", - ".jp2" => "image/jp2", - ".jpeg" => "image/jpeg", - ".jpg" => "image/jpeg", - ".jpgv" => "video/jpeg", - ".jpm" => "video/jpm", - ".js" => "application/javascript", - ".json" => "application/json", - ".karbon" => "application/vnd.kde.karbon", - ".kfo" => "application/vnd.kde.kformula", - ".kia" => "application/vnd.kidspiration", - ".kml" => "application/vnd.google-earth.kml+xml", - ".kmz" => "application/vnd.google-earth.kmz", - ".kne" => "application/vnd.kinar", - ".kon" => "application/vnd.kde.kontour", - ".kpr" => "application/vnd.kde.kpresenter", - ".ksp" => "application/vnd.kde.kspread", - ".ktz" => "application/vnd.kahootz", - ".kwd" => "application/vnd.kde.kword", - ".latex" => "application/x-latex", - ".lbd" => "application/vnd.llamagraphics.life-balance.desktop", - ".lbe" => "application/vnd.llamagraphics.life-balance.exchange+xml", - ".les" => "application/vnd.hhe.lesson-player", - ".link66" => "application/vnd.route66.link66+xml", - ".log" => "text/plain", - ".lostxml" => "application/lost+xml", - ".lrm" => "application/vnd.ms-lrm", - ".ltf" => "application/vnd.frogans.ltf", - ".lvp" => "audio/vnd.lucent.voice", - ".lwp" => "application/vnd.lotus-wordpro", - ".m3u" => "audio/x-mpegurl", - ".m3u8" => "application/x-mpegurl", - ".m4a" => "audio/mp4a-latm", - ".m4v" => "video/mp4", - ".ma" => "application/mathematica", - ".mag" => "application/vnd.ecowin.chart", - ".man" => "text/troff", - ".manifest" => "text/cache-manifest", - ".mathml" => "application/mathml+xml", - ".mbk" => "application/vnd.mobius.mbk", - ".mbox" => "application/mbox", - ".mc1" => "application/vnd.medcalcdata", - ".mcd" => "application/vnd.mcd", - ".mdb" => "application/x-msaccess", - ".mdi" => "image/vnd.ms-modi", - ".mdoc" => "text/troff", - ".me" => "text/troff", - ".mfm" => "application/vnd.mfmp", - ".mgz" => "application/vnd.proteus.magazine", - ".mid" => "audio/midi", - ".midi" => "audio/midi", - ".mif" => "application/vnd.mif", - ".mime" => "message/rfc822", - ".mj2" => "video/mj2", - ".mlp" => "application/vnd.dolby.mlp", - ".mmd" => "application/vnd.chipnuts.karaoke-mmd", - ".mmf" => "application/vnd.smaf", - ".mml" => "application/mathml+xml", - ".mmr" => "image/vnd.fujixerox.edmics-mmr", - ".mng" => "video/x-mng", - ".mny" => "application/x-msmoney", - ".mov" => "video/quicktime", - ".movie" => "video/x-sgi-movie", - ".mp3" => "audio/mpeg", - ".mp4" => "video/mp4", - ".mp4a" => "audio/mp4", - ".mp4s" => "application/mp4", - ".mp4v" => "video/mp4", - ".mpc" => "application/vnd.mophun.certificate", - ".mpd" => "application/dash+xml", - ".mpeg" => "video/mpeg", - ".mpg" => "video/mpeg", - ".mpga" => "audio/mpeg", - ".mpkg" => "application/vnd.apple.installer+xml", - ".mpm" => "application/vnd.blueice.multipass", - ".mpn" => "application/vnd.mophun.application", - ".mpp" => "application/vnd.ms-project", - ".mpy" => "application/vnd.ibm.minipay", - ".mqy" => "application/vnd.mobius.mqy", - ".mrc" => "application/marc", - ".ms" => "text/troff", - ".mscml" => "application/mediaservercontrol+xml", - ".mseq" => "application/vnd.mseq", - ".msf" => "application/vnd.epson.msf", - ".msh" => "model/mesh", - ".msi" => "application/x-msdownload", - ".msl" => "application/vnd.mobius.msl", - ".msty" => "application/vnd.muvee.style", - ".mts" => "model/vnd.mts", - ".mus" => "application/vnd.musician", - ".mvb" => "application/x-msmediaview", - ".mwf" => "application/vnd.mfer", - ".mxf" => "application/mxf", - ".mxl" => "application/vnd.recordare.musicxml", - ".mxml" => "application/xv+xml", - ".mxs" => "application/vnd.triscape.mxs", - ".mxu" => "video/vnd.mpegurl", - ".n" => "application/vnd.nokia.n-gage.symbian.install", - ".nc" => "application/x-netcdf", - ".ngdat" => "application/vnd.nokia.n-gage.data", - ".nlu" => "application/vnd.neurolanguage.nlu", - ".nml" => "application/vnd.enliven", - ".nnd" => "application/vnd.noblenet-directory", - ".nns" => "application/vnd.noblenet-sealer", - ".nnw" => "application/vnd.noblenet-web", - ".npx" => "image/vnd.net-fpx", - ".nsf" => "application/vnd.lotus-notes", - ".oa2" => "application/vnd.fujitsu.oasys2", - ".oa3" => "application/vnd.fujitsu.oasys3", - ".oas" => "application/vnd.fujitsu.oasys", - ".obd" => "application/x-msbinder", - ".oda" => "application/oda", - ".odc" => "application/vnd.oasis.opendocument.chart", - ".odf" => "application/vnd.oasis.opendocument.formula", - ".odg" => "application/vnd.oasis.opendocument.graphics", - ".odi" => "application/vnd.oasis.opendocument.image", - ".odp" => "application/vnd.oasis.opendocument.presentation", - ".ods" => "application/vnd.oasis.opendocument.spreadsheet", - ".odt" => "application/vnd.oasis.opendocument.text", - ".oga" => "audio/ogg", - ".ogg" => "application/ogg", - ".ogv" => "video/ogg", - ".ogx" => "application/ogg", - ".org" => "application/vnd.lotus-organizer", - ".otc" => "application/vnd.oasis.opendocument.chart-template", - ".otf" => "application/vnd.oasis.opendocument.formula-template", - ".otg" => "application/vnd.oasis.opendocument.graphics-template", - ".oth" => "application/vnd.oasis.opendocument.text-web", - ".oti" => "application/vnd.oasis.opendocument.image-template", - ".otm" => "application/vnd.oasis.opendocument.text-master", - ".ots" => "application/vnd.oasis.opendocument.spreadsheet-template", - ".ott" => "application/vnd.oasis.opendocument.text-template", - ".oxt" => "application/vnd.openofficeorg.extension", - ".p" => "text/x-pascal", - ".p10" => "application/pkcs10", - ".p12" => "application/x-pkcs12", - ".p7b" => "application/x-pkcs7-certificates", - ".p7m" => "application/pkcs7-mime", - ".p7r" => "application/x-pkcs7-certreqresp", - ".p7s" => "application/pkcs7-signature", - ".pas" => "text/x-pascal", - ".pbd" => "application/vnd.powerbuilder6", - ".pbm" => "image/x-portable-bitmap", - ".pcl" => "application/vnd.hp-pcl", - ".pclxl" => "application/vnd.hp-pclxl", - ".pcx" => "image/x-pcx", - ".pdb" => "chemical/x-pdb", - ".pdf" => "application/pdf", - ".pem" => "application/x-x509-ca-cert", - ".pfr" => "application/font-tdpfr", - ".pgm" => "image/x-portable-graymap", - ".pgn" => "application/x-chess-pgn", - ".pgp" => "application/pgp-encrypted", - ".pic" => "image/x-pict", - ".pict" => "image/pict", - ".pkg" => "application/octet-stream", - ".pki" => "application/pkixcmp", - ".pkipath" => "application/pkix-pkipath", - ".pl" => "text/x-script.perl", - ".plb" => "application/vnd.3gpp.pic-bw-large", - ".plc" => "application/vnd.mobius.plc", - ".plf" => "application/vnd.pocketlearn", - ".pls" => "application/pls+xml", - ".pm" => "text/x-script.perl-module", - ".pml" => "application/vnd.ctc-posml", - ".png" => "image/png", - ".pnm" => "image/x-portable-anymap", - ".pntg" => "image/x-macpaint", - ".portpkg" => "application/vnd.macports.portpkg", - ".pot" => "application/vnd.ms-powerpoint", - ".potm" => "application/vnd.ms-powerpoint.template.macroEnabled.12", - ".potx" => "application/vnd.openxmlformats-officedocument.presentationml.template", - ".ppa" => "application/vnd.ms-powerpoint", - ".ppam" => "application/vnd.ms-powerpoint.addin.macroEnabled.12", - ".ppd" => "application/vnd.cups-ppd", - ".ppm" => "image/x-portable-pixmap", - ".pps" => "application/vnd.ms-powerpoint", - ".ppsm" => "application/vnd.ms-powerpoint.slideshow.macroEnabled.12", - ".ppsx" => "application/vnd.openxmlformats-officedocument.presentationml.slideshow", - ".ppt" => "application/vnd.ms-powerpoint", - ".pptm" => "application/vnd.ms-powerpoint.presentation.macroEnabled.12", - ".pptx" => "application/vnd.openxmlformats-officedocument.presentationml.presentation", - ".prc" => "application/vnd.palm", - ".pre" => "application/vnd.lotus-freelance", - ".prf" => "application/pics-rules", - ".ps" => "application/postscript", - ".psb" => "application/vnd.3gpp.pic-bw-small", - ".psd" => "image/vnd.adobe.photoshop", - ".ptid" => "application/vnd.pvi.ptid1", - ".pub" => "application/x-mspublisher", - ".pvb" => "application/vnd.3gpp.pic-bw-var", - ".pwn" => "application/vnd.3m.post-it-notes", - ".py" => "text/x-script.python", - ".pya" => "audio/vnd.ms-playready.media.pya", - ".pyv" => "video/vnd.ms-playready.media.pyv", - ".qam" => "application/vnd.epson.quickanime", - ".qbo" => "application/vnd.intu.qbo", - ".qfx" => "application/vnd.intu.qfx", - ".qps" => "application/vnd.publishare-delta-tree", - ".qt" => "video/quicktime", - ".qtif" => "image/x-quicktime", - ".qxd" => "application/vnd.quark.quarkxpress", - ".ra" => "audio/x-pn-realaudio", - ".rake" => "text/x-script.ruby", - ".ram" => "audio/x-pn-realaudio", - ".rar" => "application/x-rar-compressed", - ".ras" => "image/x-cmu-raster", - ".rb" => "text/x-script.ruby", - ".rcprofile" => "application/vnd.ipunplugged.rcprofile", - ".rdf" => "application/rdf+xml", - ".rdz" => "application/vnd.data-vision.rdz", - ".rep" => "application/vnd.businessobjects", - ".rgb" => "image/x-rgb", - ".rif" => "application/reginfo+xml", - ".rl" => "application/resource-lists+xml", - ".rlc" => "image/vnd.fujixerox.edmics-rlc", - ".rld" => "application/resource-lists-diff+xml", - ".rm" => "application/vnd.rn-realmedia", - ".rmp" => "audio/x-pn-realaudio-plugin", - ".rms" => "application/vnd.jcp.javame.midlet-rms", - ".rnc" => "application/relax-ng-compact-syntax", - ".roff" => "text/troff", - ".rpm" => "application/x-redhat-package-manager", - ".rpss" => "application/vnd.nokia.radio-presets", - ".rpst" => "application/vnd.nokia.radio-preset", - ".rq" => "application/sparql-query", - ".rs" => "application/rls-services+xml", - ".rsd" => "application/rsd+xml", - ".rss" => "application/rss+xml", - ".rtf" => "application/rtf", - ".rtx" => "text/richtext", - ".ru" => "text/x-script.ruby", - ".s" => "text/x-asm", - ".saf" => "application/vnd.yamaha.smaf-audio", - ".sbml" => "application/sbml+xml", - ".sc" => "application/vnd.ibm.secure-container", - ".scd" => "application/x-msschedule", - ".scm" => "application/vnd.lotus-screencam", - ".scq" => "application/scvp-cv-request", - ".scs" => "application/scvp-cv-response", - ".sdkm" => "application/vnd.solent.sdkm+xml", - ".sdp" => "application/sdp", - ".see" => "application/vnd.seemail", - ".sema" => "application/vnd.sema", - ".semd" => "application/vnd.semd", - ".semf" => "application/vnd.semf", - ".setpay" => "application/set-payment-initiation", - ".setreg" => "application/set-registration-initiation", - ".sfd" => "application/vnd.hydrostatix.sof-data", - ".sfs" => "application/vnd.spotfire.sfs", - ".sgm" => "text/sgml", - ".sgml" => "text/sgml", - ".sh" => "application/x-sh", - ".shar" => "application/x-shar", - ".shf" => "application/shf+xml", - ".sig" => "application/pgp-signature", - ".sit" => "application/x-stuffit", - ".sitx" => "application/x-stuffitx", - ".skp" => "application/vnd.koan", - ".slt" => "application/vnd.epson.salt", - ".smi" => "application/smil+xml", - ".snd" => "audio/basic", - ".so" => "application/octet-stream", - ".spf" => "application/vnd.yamaha.smaf-phrase", - ".spl" => "application/x-futuresplash", - ".spot" => "text/vnd.in3d.spot", - ".spp" => "application/scvp-vp-response", - ".spq" => "application/scvp-vp-request", - ".src" => "application/x-wais-source", - ".srt" => "text/srt", - ".srx" => "application/sparql-results+xml", - ".sse" => "application/vnd.kodak-descriptor", - ".ssf" => "application/vnd.epson.ssf", - ".ssml" => "application/ssml+xml", - ".stf" => "application/vnd.wt.stf", - ".stk" => "application/hyperstudio", - ".str" => "application/vnd.pg.format", - ".sus" => "application/vnd.sus-calendar", - ".sv4cpio" => "application/x-sv4cpio", - ".sv4crc" => "application/x-sv4crc", - ".svd" => "application/vnd.svd", - ".svg" => "image/svg+xml", - ".svgz" => "image/svg+xml", - ".swf" => "application/x-shockwave-flash", - ".swi" => "application/vnd.arastra.swi", - ".t" => "text/troff", - ".tao" => "application/vnd.tao.intent-module-archive", - ".tar" => "application/x-tar", - ".tbz" => "application/x-bzip-compressed-tar", - ".tcap" => "application/vnd.3gpp2.tcap", - ".tcl" => "application/x-tcl", - ".tex" => "application/x-tex", - ".texi" => "application/x-texinfo", - ".texinfo" => "application/x-texinfo", - ".text" => "text/plain", - ".tif" => "image/tiff", - ".tiff" => "image/tiff", - ".tmo" => "application/vnd.tmobile-livetv", - ".torrent" => "application/x-bittorrent", - ".tpl" => "application/vnd.groove-tool-template", - ".tpt" => "application/vnd.trid.tpt", - ".tr" => "text/troff", - ".tra" => "application/vnd.trueapp", - ".trm" => "application/x-msterminal", - ".ts" => "video/mp2t", - ".tsv" => "text/tab-separated-values", - ".ttf" => "application/octet-stream", - ".twd" => "application/vnd.simtech-mindmapper", - ".txd" => "application/vnd.genomatix.tuxedo", - ".txf" => "application/vnd.mobius.txf", - ".txt" => "text/plain", - ".ufd" => "application/vnd.ufdl", - ".umj" => "application/vnd.umajin", - ".unityweb" => "application/vnd.unity", - ".uoml" => "application/vnd.uoml+xml", - ".uri" => "text/uri-list", - ".ustar" => "application/x-ustar", - ".utz" => "application/vnd.uiq.theme", - ".uu" => "text/x-uuencode", - ".vcd" => "application/x-cdlink", - ".vcf" => "text/x-vcard", - ".vcg" => "application/vnd.groove-vcard", - ".vcs" => "text/x-vcalendar", - ".vcx" => "application/vnd.vcx", - ".vis" => "application/vnd.visionary", - ".viv" => "video/vnd.vivo", - ".vrml" => "model/vrml", - ".vsd" => "application/vnd.visio", - ".vsf" => "application/vnd.vsf", - ".vtt" => "text/vtt", - ".vtu" => "model/vnd.vtu", - ".vxml" => "application/voicexml+xml", - ".war" => "application/java-archive", - ".wasm" => "application/wasm", - ".wav" => "audio/x-wav", - ".wax" => "audio/x-ms-wax", - ".wbmp" => "image/vnd.wap.wbmp", - ".wbs" => "application/vnd.criticaltools.wbs+xml", - ".wbxml" => "application/vnd.wap.wbxml", - ".webm" => "video/webm", - ".webp" => "image/webp", - ".wm" => "video/x-ms-wm", - ".wma" => "audio/x-ms-wma", - ".wmd" => "application/x-ms-wmd", - ".wmf" => "application/x-msmetafile", - ".wml" => "text/vnd.wap.wml", - ".wmlc" => "application/vnd.wap.wmlc", - ".wmls" => "text/vnd.wap.wmlscript", - ".wmlsc" => "application/vnd.wap.wmlscriptc", - ".wmv" => "video/x-ms-wmv", - ".wmx" => "video/x-ms-wmx", - ".wmz" => "application/x-ms-wmz", - ".woff" => "application/font-woff", - ".woff2" => "application/font-woff2", - ".wpd" => "application/vnd.wordperfect", - ".wpl" => "application/vnd.ms-wpl", - ".wps" => "application/vnd.ms-works", - ".wqd" => "application/vnd.wqd", - ".wri" => "application/x-mswrite", - ".wrl" => "model/vrml", - ".wsdl" => "application/wsdl+xml", - ".wspolicy" => "application/wspolicy+xml", - ".wtb" => "application/vnd.webturbo", - ".wvx" => "video/x-ms-wvx", - ".x3d" => "application/vnd.hzn-3d-crossword", - ".xar" => "application/vnd.xara", - ".xbd" => "application/vnd.fujixerox.docuworks.binder", - ".xbm" => "image/x-xbitmap", - ".xdm" => "application/vnd.syncml.dm+xml", - ".xdp" => "application/vnd.adobe.xdp+xml", - ".xdw" => "application/vnd.fujixerox.docuworks", - ".xenc" => "application/xenc+xml", - ".xer" => "application/patch-ops-error+xml", - ".xfdf" => "application/vnd.adobe.xfdf", - ".xfdl" => "application/vnd.xfdl", - ".xhtml" => "application/xhtml+xml", - ".xif" => "image/vnd.xiff", - ".xla" => "application/vnd.ms-excel", - ".xlam" => "application/vnd.ms-excel.addin.macroEnabled.12", - ".xls" => "application/vnd.ms-excel", - ".xlsb" => "application/vnd.ms-excel.sheet.binary.macroEnabled.12", - ".xlsx" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", - ".xlsm" => "application/vnd.ms-excel.sheet.macroEnabled.12", - ".xlt" => "application/vnd.ms-excel", - ".xltx" => "application/vnd.openxmlformats-officedocument.spreadsheetml.template", - ".xml" => "application/xml", - ".xo" => "application/vnd.olpc-sugar", - ".xop" => "application/xop+xml", - ".xpm" => "image/x-xpixmap", - ".xpr" => "application/vnd.is-xpr", - ".xps" => "application/vnd.ms-xpsdocument", - ".xpw" => "application/vnd.intercon.formnet", - ".xsl" => "application/xml", - ".xslt" => "application/xslt+xml", - ".xsm" => "application/vnd.syncml+xml", - ".xspf" => "application/xspf+xml", - ".xul" => "application/vnd.mozilla.xul+xml", - ".xwd" => "image/x-xwindowdump", - ".xyz" => "chemical/x-xyz", - ".yaml" => "text/yaml", - ".yml" => "text/yaml", - ".zaz" => "application/vnd.zzazz.deck+xml", - ".zip" => "application/zip", - ".zmm" => "application/vnd.handheld-entertainment+xml", - } - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/mock.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/mock.rb deleted file mode 100644 index 5e5c457c728c42..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/mock.rb +++ /dev/null @@ -1,3 +0,0 @@ -# frozen_string_literal: true - -require_relative 'mock_request' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/mock_request.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/mock_request.rb deleted file mode 100644 index b6d7ef4fea53b1..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/mock_request.rb +++ /dev/null @@ -1,166 +0,0 @@ -# frozen_string_literal: true - -require 'uri' -require 'stringio' - -require_relative 'constants' -require_relative 'mock_response' - -module Rack - # Rack::MockRequest helps testing your Rack application without - # actually using HTTP. - # - # After performing a request on a URL with get/post/put/patch/delete, it - # returns a MockResponse with useful helper methods for effective - # testing. - # - # You can pass a hash with additional configuration to the - # get/post/put/patch/delete. - # :input:: A String or IO-like to be used as rack.input. - # :fatal:: Raise a FatalWarning if the app writes to rack.errors. - # :lint:: If true, wrap the application in a Rack::Lint. - - class MockRequest - class FatalWarning < RuntimeError - end - - class FatalWarner - def puts(warning) - raise FatalWarning, warning - end - - def write(warning) - raise FatalWarning, warning - end - - def flush - end - - def string - "" - end - end - - DEFAULT_ENV = { - RACK_INPUT => StringIO.new, - RACK_ERRORS => StringIO.new, - }.freeze - - def initialize(app) - @app = app - end - - # Make a GET request and return a MockResponse. See #request. - def get(uri, opts = {}) request(GET, uri, opts) end - # Make a POST request and return a MockResponse. See #request. - def post(uri, opts = {}) request(POST, uri, opts) end - # Make a PUT request and return a MockResponse. See #request. - def put(uri, opts = {}) request(PUT, uri, opts) end - # Make a PATCH request and return a MockResponse. See #request. - def patch(uri, opts = {}) request(PATCH, uri, opts) end - # Make a DELETE request and return a MockResponse. See #request. - def delete(uri, opts = {}) request(DELETE, uri, opts) end - # Make a HEAD request and return a MockResponse. See #request. - def head(uri, opts = {}) request(HEAD, uri, opts) end - # Make an OPTIONS request and return a MockResponse. See #request. - def options(uri, opts = {}) request(OPTIONS, uri, opts) end - - # Make a request using the given request method for the given - # uri to the rack application and return a MockResponse. - # Options given are passed to MockRequest.env_for. - def request(method = GET, uri = "", opts = {}) - env = self.class.env_for(uri, opts.merge(method: method)) - - if opts[:lint] - app = Rack::Lint.new(@app) - else - app = @app - end - - errors = env[RACK_ERRORS] - status, headers, body = app.call(env) - MockResponse.new(status, headers, body, errors) - ensure - body.close if body.respond_to?(:close) - end - - # For historical reasons, we're pinning to RFC 2396. - # URI::Parser = URI::RFC2396_Parser - def self.parse_uri_rfc2396(uri) - @parser ||= URI::Parser.new - @parser.parse(uri) - end - - # Return the Rack environment used for a request to +uri+. - # All options that are strings are added to the returned environment. - # Options: - # :fatal :: Whether to raise an exception if request outputs to rack.errors - # :input :: The rack.input to set - # :http_version :: The SERVER_PROTOCOL to set - # :method :: The HTTP request method to use - # :params :: The params to use - # :script_name :: The SCRIPT_NAME to set - def self.env_for(uri = "", opts = {}) - uri = parse_uri_rfc2396(uri) - uri.path = "/#{uri.path}" unless uri.path[0] == ?/ - - env = DEFAULT_ENV.dup - - env[REQUEST_METHOD] = (opts[:method] ? opts[:method].to_s.upcase : GET).b - env[SERVER_NAME] = (uri.host || "example.org").b - env[SERVER_PORT] = (uri.port ? uri.port.to_s : "80").b - env[SERVER_PROTOCOL] = opts[:http_version] || 'HTTP/1.1' - env[QUERY_STRING] = (uri.query.to_s).b - env[PATH_INFO] = (uri.path).b - env[RACK_URL_SCHEME] = (uri.scheme || "http").b - env[HTTPS] = (env[RACK_URL_SCHEME] == "https" ? "on" : "off").b - - env[SCRIPT_NAME] = opts[:script_name] || "" - - if opts[:fatal] - env[RACK_ERRORS] = FatalWarner.new - else - env[RACK_ERRORS] = StringIO.new - end - - if params = opts[:params] - if env[REQUEST_METHOD] == GET - params = Utils.parse_nested_query(params) if params.is_a?(String) - params.update(Utils.parse_nested_query(env[QUERY_STRING])) - env[QUERY_STRING] = Utils.build_nested_query(params) - elsif !opts.has_key?(:input) - opts["CONTENT_TYPE"] = "application/x-www-form-urlencoded" - if params.is_a?(Hash) - if data = Rack::Multipart.build_multipart(params) - opts[:input] = data - opts["CONTENT_LENGTH"] ||= data.length.to_s - opts["CONTENT_TYPE"] = "multipart/form-data; boundary=#{Rack::Multipart::MULTIPART_BOUNDARY}" - else - opts[:input] = Utils.build_nested_query(params) - end - else - opts[:input] = params - end - end - end - - opts[:input] ||= String.new - if String === opts[:input] - rack_input = StringIO.new(opts[:input]) - else - rack_input = opts[:input] - end - - rack_input.set_encoding(Encoding::BINARY) - env[RACK_INPUT] = rack_input - - env["CONTENT_LENGTH"] ||= env[RACK_INPUT].size.to_s if env[RACK_INPUT].respond_to?(:size) - - opts.each { |field, value| - env[field] = value if String === field - } - - env - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/mock_response.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/mock_response.rb deleted file mode 100644 index 3c70bb711a9263..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/mock_response.rb +++ /dev/null @@ -1,126 +0,0 @@ -# frozen_string_literal: true - -require 'cgi/cookie' -require 'time' - -require_relative 'response' - -module Rack - # Rack::MockResponse provides useful helpers for testing your apps. - # Usually, you don't create the MockResponse on your own, but use - # MockRequest. - - class MockResponse < Rack::Response - class << self - alias [] new - end - - # Headers - attr_reader :original_headers, :cookies - - # Errors - attr_accessor :errors - - def initialize(status, headers, body, errors = nil) - @original_headers = headers - - if errors - @errors = errors.string if errors.respond_to?(:string) - else - @errors = "" - end - - super(body, status, headers) - - @cookies = parse_cookies_from_header - buffered_body! - end - - def =~(other) - body =~ other - end - - def match(other) - body.match other - end - - def body - return @buffered_body if defined?(@buffered_body) - - # FIXME: apparently users of MockResponse expect the return value of - # MockResponse#body to be a string. However, the real response object - # returns the body as a list. - # - # See spec_showstatus.rb: - # - # should "not replace existing messages" do - # ... - # res.body.should == "foo!" - # end - buffer = @buffered_body = String.new - - @body.each do |chunk| - buffer << chunk - end - - return buffer - end - - def empty? - [201, 204, 304].include? status - end - - def cookie(name) - cookies.fetch(name, nil) - end - - private - - def parse_cookies_from_header - cookies = Hash.new - if headers.has_key? 'set-cookie' - set_cookie_header = headers.fetch('set-cookie') - Array(set_cookie_header).each do |header_value| - header_value.split("\n").each do |cookie| - cookie_name, cookie_filling = cookie.split('=', 2) - cookie_attributes = identify_cookie_attributes cookie_filling - parsed_cookie = CGI::Cookie.new( - 'name' => cookie_name.strip, - 'value' => cookie_attributes.fetch('value'), - 'path' => cookie_attributes.fetch('path', nil), - 'domain' => cookie_attributes.fetch('domain', nil), - 'expires' => cookie_attributes.fetch('expires', nil), - 'secure' => cookie_attributes.fetch('secure', false) - ) - cookies.store(cookie_name, parsed_cookie) - end - end - end - cookies - end - - def identify_cookie_attributes(cookie_filling) - cookie_bits = cookie_filling.split(';') - cookie_attributes = Hash.new - cookie_attributes.store('value', cookie_bits[0].strip) - cookie_bits.drop(1).each do |bit| - if bit.include? '=' - cookie_attribute, attribute_value = bit.split('=', 2) - cookie_attributes.store(cookie_attribute.strip.downcase, attribute_value.strip) - end - if bit.include? 'secure' - cookie_attributes.store('secure', true) - end - end - - if cookie_attributes.key? 'max-age' - cookie_attributes.store('expires', Time.now + cookie_attributes['max-age'].to_i) - elsif cookie_attributes.key? 'expires' - cookie_attributes.store('expires', Time.httpdate(cookie_attributes['expires'])) - end - - cookie_attributes - end - - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/multipart.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/multipart.rb deleted file mode 100644 index 3347662acc3fb0..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/multipart.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -require_relative 'constants' -require_relative 'utils' - -require_relative 'multipart/parser' -require_relative 'multipart/generator' - -module Rack - # A multipart form data parser, adapted from IOWA. - # - # Usually, Rack::Request#POST takes care of calling this. - module Multipart - MULTIPART_BOUNDARY = "AaB03x" - - class << self - def parse_multipart(env, params = Rack::Utils.default_query_parser) - io = env[RACK_INPUT] - - if content_length = env['CONTENT_LENGTH'] - content_length = content_length.to_i - end - - content_type = env['CONTENT_TYPE'] - - tempfile = env[RACK_MULTIPART_TEMPFILE_FACTORY] || Parser::TEMPFILE_FACTORY - bufsize = env[RACK_MULTIPART_BUFFER_SIZE] || Parser::BUFSIZE - - info = Parser.parse(io, content_length, content_type, tempfile, bufsize, params) - env[RACK_TEMPFILES] = info.tmp_files - - return info.params - end - - def extract_multipart(request, params = Rack::Utils.default_query_parser) - parse_multipart(request.env) - end - - def build_multipart(params, first = true) - Generator.new(params, first).dump - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/multipart/generator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/multipart/generator.rb deleted file mode 100644 index 30d7f51dd1983f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/multipart/generator.rb +++ /dev/null @@ -1,99 +0,0 @@ -# frozen_string_literal: true - -require_relative 'uploaded_file' - -module Rack - module Multipart - class Generator - def initialize(params, first = true) - @params, @first = params, first - - if @first && !@params.is_a?(Hash) - raise ArgumentError, "value must be a Hash" - end - end - - def dump - return nil if @first && !multipart? - return flattened_params unless @first - - flattened_params.map do |name, file| - if file.respond_to?(:original_filename) - if file.path - ::File.open(file.path, 'rb') do |f| - f.set_encoding(Encoding::BINARY) - content_for_tempfile(f, file, name) - end - else - content_for_tempfile(file, file, name) - end - else - content_for_other(file, name) - end - end.join << "--#{MULTIPART_BOUNDARY}--\r" - end - - private - def multipart? - query = lambda { |value| - case value - when Array - value.any?(&query) - when Hash - value.values.any?(&query) - when Rack::Multipart::UploadedFile - true - end - } - - @params.values.any?(&query) - end - - def flattened_params - @flattened_params ||= begin - h = Hash.new - @params.each do |key, value| - k = @first ? key.to_s : "[#{key}]" - - case value - when Array - value.map { |v| - Multipart.build_multipart(v, false).each { |subkey, subvalue| - h["#{k}[]#{subkey}"] = subvalue - } - } - when Hash - Multipart.build_multipart(value, false).each { |subkey, subvalue| - h[k + subkey] = subvalue - } - else - h[k] = value - end - end - h - end - end - - def content_for_tempfile(io, file, name) - length = ::File.stat(file.path).size if file.path - filename = "; filename=\"#{Utils.escape_path(file.original_filename)}\"" -<<-EOF ---#{MULTIPART_BOUNDARY}\r -content-disposition: form-data; name="#{name}"#{filename}\r -content-type: #{file.content_type}\r -#{"content-length: #{length}\r\n" if length}\r -#{io.read}\r -EOF - end - - def content_for_other(file, name) -<<-EOF ---#{MULTIPART_BOUNDARY}\r -content-disposition: form-data; name="#{name}"\r -\r -#{file}\r -EOF - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/multipart/parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/multipart/parser.rb deleted file mode 100644 index 2469459d7ffb3f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/multipart/parser.rb +++ /dev/null @@ -1,434 +0,0 @@ -# frozen_string_literal: true - -require 'strscan' - -require_relative '../utils' - -module Rack - module Multipart - class MultipartPartLimitError < Errno::EMFILE; end - - class MultipartTotalPartLimitError < StandardError; end - - # Use specific error class when parsing multipart request - # that ends early. - class EmptyContentError < ::EOFError; end - - # Base class for multipart exceptions that do not subclass from - # other exception classes for backwards compatibility. - class Error < StandardError; end - - EOL = "\r\n" - MULTIPART = %r|\Amultipart/.*boundary=\"?([^\";,]+)\"?|ni - TOKEN = /[^\s()<>,;:\\"\/\[\]?=]+/ - CONDISP = /Content-Disposition:\s*#{TOKEN}\s*/i - VALUE = /"(?:\\"|[^"])*"|#{TOKEN}/ - BROKEN = /^#{CONDISP}.*;\s*filename=(#{VALUE})/i - MULTIPART_CONTENT_TYPE = /Content-Type: (.*)#{EOL}/ni - MULTIPART_CONTENT_DISPOSITION = /Content-Disposition:[^:]*;\s*name=(#{VALUE})/ni - MULTIPART_CONTENT_ID = /Content-ID:\s*([^#{EOL}]*)/ni - # Updated definitions from RFC 2231 - ATTRIBUTE_CHAR = %r{[^ \x00-\x1f\x7f)(><@,;:\\"/\[\]?='*%]} - ATTRIBUTE = /#{ATTRIBUTE_CHAR}+/ - SECTION = /\*[0-9]+/ - REGULAR_PARAMETER_NAME = /#{ATTRIBUTE}#{SECTION}?/ - REGULAR_PARAMETER = /(#{REGULAR_PARAMETER_NAME})=(#{VALUE})/ - EXTENDED_OTHER_NAME = /#{ATTRIBUTE}\*[1-9][0-9]*\*/ - EXTENDED_OTHER_VALUE = /%[0-9a-fA-F]{2}|#{ATTRIBUTE_CHAR}/ - EXTENDED_OTHER_PARAMETER = /(#{EXTENDED_OTHER_NAME})=(#{EXTENDED_OTHER_VALUE}*)/ - EXTENDED_INITIAL_NAME = /#{ATTRIBUTE}(?:\*0)?\*/ - EXTENDED_INITIAL_VALUE = /[a-zA-Z0-9\-]*'[a-zA-Z0-9\-]*'#{EXTENDED_OTHER_VALUE}*/ - EXTENDED_INITIAL_PARAMETER = /(#{EXTENDED_INITIAL_NAME})=(#{EXTENDED_INITIAL_VALUE})/ - EXTENDED_PARAMETER = /#{EXTENDED_INITIAL_PARAMETER}|#{EXTENDED_OTHER_PARAMETER}/ - DISPPARM = /;\s*(?:#{REGULAR_PARAMETER}|#{EXTENDED_PARAMETER})\s*/ - RFC2183 = /^#{CONDISP}(#{DISPPARM})+$/i - - class Parser - BUFSIZE = 1_048_576 - TEXT_PLAIN = "text/plain" - TEMPFILE_FACTORY = lambda { |filename, content_type| - Tempfile.new(["RackMultipart", ::File.extname(filename.gsub("\0", '%00'))]) - } - - class BoundedIO # :nodoc: - def initialize(io, content_length) - @io = io - @content_length = content_length - @cursor = 0 - end - - def read(size, outbuf = nil) - return if @cursor >= @content_length - - left = @content_length - @cursor - - str = if left < size - @io.read left, outbuf - else - @io.read size, outbuf - end - - if str - @cursor += str.bytesize - else - # Raise an error for mismatching content-length and actual contents - raise EOFError, "bad content body" - end - - str - end - end - - MultipartInfo = Struct.new :params, :tmp_files - EMPTY = MultipartInfo.new(nil, []) - - def self.parse_boundary(content_type) - return unless content_type - data = content_type.match(MULTIPART) - return unless data - data[1] - end - - def self.parse(io, content_length, content_type, tmpfile, bufsize, qp) - return EMPTY if 0 == content_length - - boundary = parse_boundary content_type - return EMPTY unless boundary - - if boundary.length > 70 - # RFC 1521 Section 7.2.1 imposes a 70 character maximum for the boundary. - # Most clients use no more than 55 characters. - raise Error, "multipart boundary size too large (#{boundary.length} characters)" - end - - io = BoundedIO.new(io, content_length) if content_length - - parser = new(boundary, tmpfile, bufsize, qp) - parser.parse(io) - - parser.result - end - - class Collector - class MimePart < Struct.new(:body, :head, :filename, :content_type, :name) - def get_data - data = body - if filename == "" - # filename is blank which means no file has been selected - return - elsif filename - body.rewind if body.respond_to?(:rewind) - - # Take the basename of the upload's original filename. - # This handles the full Windows paths given by Internet Explorer - # (and perhaps other broken user agents) without affecting - # those which give the lone filename. - fn = filename.split(/[\/\\]/).last - - data = { filename: fn, type: content_type, - name: name, tempfile: body, head: head } - end - - yield data - end - end - - class BufferPart < MimePart - def file?; false; end - def close; end - end - - class TempfilePart < MimePart - def file?; true; end - def close; body.close; end - end - - include Enumerable - - def initialize(tempfile) - @tempfile = tempfile - @mime_parts = [] - @open_files = 0 - end - - def each - @mime_parts.each { |part| yield part } - end - - def on_mime_head(mime_index, head, filename, content_type, name) - if filename - body = @tempfile.call(filename, content_type) - body.binmode if body.respond_to?(:binmode) - klass = TempfilePart - @open_files += 1 - else - body = String.new - klass = BufferPart - end - - @mime_parts[mime_index] = klass.new(body, head, filename, content_type, name) - - check_part_limits - end - - def on_mime_body(mime_index, content) - @mime_parts[mime_index].body << content - end - - def on_mime_finish(mime_index) - end - - private - - def check_part_limits - file_limit = Utils.multipart_file_limit - part_limit = Utils.multipart_total_part_limit - - if file_limit && file_limit > 0 - if @open_files >= file_limit - @mime_parts.each(&:close) - raise MultipartPartLimitError, 'Maximum file multiparts in content reached' - end - end - - if part_limit && part_limit > 0 - if @mime_parts.size >= part_limit - @mime_parts.each(&:close) - raise MultipartTotalPartLimitError, 'Maximum total multiparts in content reached' - end - end - end - end - - attr_reader :state - - def initialize(boundary, tempfile, bufsize, query_parser) - @query_parser = query_parser - @params = query_parser.make_params - @bufsize = bufsize - - @state = :FAST_FORWARD - @mime_index = 0 - @collector = Collector.new tempfile - - @sbuf = StringScanner.new("".dup) - @body_regex = /(?:#{EOL}|\A)--#{Regexp.quote(boundary)}(?:#{EOL}|--)/m - @rx_max_size = boundary.bytesize + 6 # (\r\n-- at start, either \r\n or -- at finish) - @head_regex = /(.*?#{EOL})#{EOL}/m - end - - def parse(io) - outbuf = String.new - read_data(io, outbuf) - - loop do - status = - case @state - when :FAST_FORWARD - handle_fast_forward - when :CONSUME_TOKEN - handle_consume_token - when :MIME_HEAD - handle_mime_head - when :MIME_BODY - handle_mime_body - else # when :DONE - return - end - - read_data(io, outbuf) if status == :want_read - end - end - - def result - @collector.each do |part| - part.get_data do |data| - tag_multipart_encoding(part.filename, part.content_type, part.name, data) - @query_parser.normalize_params(@params, part.name, data) - end - end - MultipartInfo.new @params.to_params_hash, @collector.find_all(&:file?).map(&:body) - end - - private - - def dequote(str) # From WEBrick::HTTPUtils - ret = (/\A"(.*)"\Z/ =~ str) ? $1 : str.dup - ret.gsub!(/\\(.)/, "\\1") - ret - end - - def read_data(io, outbuf) - content = io.read(@bufsize, outbuf) - handle_empty_content!(content) - @sbuf.concat(content) - end - - # This handles the initial parser state. We read until we find the starting - # boundary, then we can transition to the next state. If we find the ending - # boundary, this is an invalid multipart upload, but keep scanning for opening - # boundary in that case. If no boundary found, we need to keep reading data - # and retry. It's highly unlikely the initial read will not consume the - # boundary. The client would have to deliberately craft a response - # with the opening boundary beyond the buffer size for that to happen. - def handle_fast_forward - while true - case consume_boundary - when :BOUNDARY - # found opening boundary, transition to next state - @state = :MIME_HEAD - return - when :END_BOUNDARY - # invalid multipart upload, but retry for opening boundary - else - # no boundary found, keep reading data - return :want_read - end - end - end - - def handle_consume_token - tok = consume_boundary - # break if we're at the end of a buffer, but not if it is the end of a field - @state = if tok == :END_BOUNDARY || (@sbuf.eos? && tok != :BOUNDARY) - :DONE - else - :MIME_HEAD - end - end - - def handle_mime_head - if @sbuf.scan_until(@head_regex) - head = @sbuf[1] - content_type = head[MULTIPART_CONTENT_TYPE, 1] - if name = head[MULTIPART_CONTENT_DISPOSITION, 1] - name = dequote(name) - else - name = head[MULTIPART_CONTENT_ID, 1] - end - - filename = get_filename(head) - - if name.nil? || name.empty? - name = filename || "#{content_type || TEXT_PLAIN}[]".dup - end - - @collector.on_mime_head @mime_index, head, filename, content_type, name - @state = :MIME_BODY - else - :want_read - end - end - - def handle_mime_body - if (body_with_boundary = @sbuf.check_until(@body_regex)) # check but do not advance the pointer yet - body = body_with_boundary.sub(/#{@body_regex}\z/m, '') # remove the boundary from the string - @collector.on_mime_body @mime_index, body - @sbuf.pos += body.length + 2 # skip \r\n after the content - @state = :CONSUME_TOKEN - @mime_index += 1 - else - # Save what we have so far - if @rx_max_size < @sbuf.rest_size - delta = @sbuf.rest_size - @rx_max_size - @collector.on_mime_body @mime_index, @sbuf.peek(delta) - @sbuf.pos += delta - @sbuf.string = @sbuf.rest - end - :want_read - end - end - - # Scan until the we find the start or end of the boundary. - # If we find it, return the appropriate symbol for the start or - # end of the boundary. If we don't find the start or end of the - # boundary, clear the buffer and return nil. - def consume_boundary - if read_buffer = @sbuf.scan_until(@body_regex) - read_buffer.end_with?(EOL) ? :BOUNDARY : :END_BOUNDARY - else - @sbuf.terminate - nil - end - end - - def get_filename(head) - filename = nil - case head - when RFC2183 - params = Hash[*head.scan(DISPPARM).flat_map(&:compact)] - - if filename = params['filename*'] - encoding, _, filename = filename.split("'", 3) - elsif filename = params['filename'] - filename = $1 if filename =~ /^"(.*)"$/ - end - when BROKEN - filename = $1 - filename = $1 if filename =~ /^"(.*)"$/ - end - - return unless filename - - if filename.scan(/%.?.?/).all? { |s| /%[0-9a-fA-F]{2}/.match?(s) } - filename = Utils.unescape_path(filename) - end - - filename.scrub! - - if filename !~ /\\[^\\"]/ - filename = filename.gsub(/\\(.)/, '\1') - end - - if encoding - filename.force_encoding ::Encoding.find(encoding) - end - - filename - end - - CHARSET = "charset" - deprecate_constant :CHARSET - - def tag_multipart_encoding(filename, content_type, name, body) - name = name.to_s - encoding = Encoding::UTF_8 - - name.force_encoding(encoding) - - return if filename - - if content_type - list = content_type.split(';') - type_subtype = list.first - type_subtype.strip! - if TEXT_PLAIN == type_subtype - rest = list.drop 1 - rest.each do |param| - k, v = param.split('=', 2) - k.strip! - v.strip! - v = v[1..-2] if v.start_with?('"') && v.end_with?('"') - if k == "charset" - encoding = begin - Encoding.find v - rescue ArgumentError - Encoding::BINARY - end - end - end - end - end - - name.force_encoding(encoding) - body.force_encoding(encoding) - end - - def handle_empty_content!(content) - if content.nil? || content.empty? - raise EmptyContentError - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/multipart/uploaded_file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/multipart/uploaded_file.rb deleted file mode 100644 index 2782e44c73afcb..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/multipart/uploaded_file.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -require 'tempfile' -require 'fileutils' - -module Rack - module Multipart - class UploadedFile - - # The filename, *not* including the path, of the "uploaded" file - attr_reader :original_filename - - # The content type of the "uploaded" file - attr_accessor :content_type - - def initialize(filepath = nil, ct = "text/plain", bin = false, - path: filepath, content_type: ct, binary: bin, filename: nil, io: nil) - if io - @tempfile = io - @original_filename = filename - else - raise "#{path} file does not exist" unless ::File.exist?(path) - @original_filename = filename || ::File.basename(path) - @tempfile = Tempfile.new([@original_filename, ::File.extname(path)], encoding: Encoding::BINARY) - @tempfile.binmode if binary - FileUtils.copy_file(path, @tempfile.path) - end - @content_type = content_type - end - - def path - @tempfile.path if @tempfile.respond_to?(:path) - end - alias_method :local_path, :path - - def respond_to?(*args) - super or @tempfile.respond_to?(*args) - end - - def method_missing(method_name, *args, &block) #:nodoc: - @tempfile.__send__(method_name, *args, &block) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/null_logger.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/null_logger.rb deleted file mode 100644 index 52fc125c3dc4cf..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/null_logger.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -require_relative 'constants' - -module Rack - class NullLogger - def initialize(app) - @app = app - end - - def call(env) - env[RACK_LOGGER] = self - @app.call(env) - end - - def info(progname = nil, &block); end - def debug(progname = nil, &block); end - def warn(progname = nil, &block); end - def error(progname = nil, &block); end - def fatal(progname = nil, &block); end - def unknown(progname = nil, &block); end - def info? ; end - def debug? ; end - def warn? ; end - def error? ; end - def fatal? ; end - def debug! ; end - def error! ; end - def fatal! ; end - def info! ; end - def warn! ; end - def level ; end - def progname ; end - def datetime_format ; end - def formatter ; end - def sev_threshold ; end - def level=(level); end - def progname=(progname); end - def datetime_format=(datetime_format); end - def formatter=(formatter); end - def sev_threshold=(sev_threshold); end - def close ; end - def add(severity, message = nil, progname = nil, &block); end - def log(severity, message = nil, progname = nil, &block); end - def <<(msg); end - def reopen(logdev = nil); end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/query_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/query_parser.rb deleted file mode 100644 index 9e8434cf3a9ccb..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/query_parser.rb +++ /dev/null @@ -1,253 +0,0 @@ -# frozen_string_literal: true - -require 'uri' - -module Rack - class QueryParser - DEFAULT_SEP = /[&] */n - COMMON_SEP = { ";" => /[;] */n, ";," => /[;,] */n, "&" => /[&] */n } - - # ParameterTypeError is the error that is raised when incoming structural - # parameters (parsed by parse_nested_query) contain conflicting types. - class ParameterTypeError < TypeError; end - - # InvalidParameterError is the error that is raised when incoming structural - # parameters (parsed by parse_nested_query) contain invalid format or byte - # sequence. - class InvalidParameterError < ArgumentError; end - - # ParamsTooDeepError is the error that is raised when params are recursively - # nested over the specified limit. - class ParamsTooDeepError < RangeError; end - - def self.make_default(_key_space_limit=(not_deprecated = true; nil), param_depth_limit) - unless not_deprecated - warn("`first argument `key_space limit` is deprecated and no longer has an effect. Please call with only one argument, which will be required in a future version of Rack", uplevel: 1) - end - - new Params, param_depth_limit - end - - attr_reader :param_depth_limit - - def initialize(params_class, _key_space_limit=(not_deprecated = true; nil), param_depth_limit) - unless not_deprecated - warn("`second argument `key_space limit` is deprecated and no longer has an effect. Please call with only two arguments, which will be required in a future version of Rack", uplevel: 1) - end - - @params_class = params_class - @param_depth_limit = param_depth_limit - end - - # Stolen from Mongrel, with some small modifications: - # Parses a query string by breaking it up at the '&'. You can also use this - # to parse cookies by changing the characters used in the second parameter - # (which defaults to '&'). - def parse_query(qs, separator = nil, &unescaper) - unescaper ||= method(:unescape) - - params = make_params - - (qs || '').split(separator ? (COMMON_SEP[separator] || /[#{separator}] */n) : DEFAULT_SEP).each do |p| - next if p.empty? - k, v = p.split('=', 2).map!(&unescaper) - - if cur = params[k] - if cur.class == Array - params[k] << v - else - params[k] = [cur, v] - end - else - params[k] = v - end - end - - return params.to_h - end - - # parse_nested_query expands a query string into structural types. Supported - # types are Arrays, Hashes and basic value types. It is possible to supply - # query strings with parameters of conflicting types, in this case a - # ParameterTypeError is raised. Users are encouraged to return a 400 in this - # case. - def parse_nested_query(qs, separator = nil) - params = make_params - - unless qs.nil? || qs.empty? - (qs || '').split(separator ? (COMMON_SEP[separator] || /[#{separator}] */n) : DEFAULT_SEP).each do |p| - k, v = p.split('=', 2).map! { |s| unescape(s) } - - _normalize_params(params, k, v, 0) - end - end - - return params.to_h - rescue ArgumentError => e - raise InvalidParameterError, e.message, e.backtrace - end - - # normalize_params recursively expands parameters into structural types. If - # the structural types represented by two different parameter names are in - # conflict, a ParameterTypeError is raised. The depth argument is deprecated - # and should no longer be used, it is kept for backwards compatibility with - # earlier versions of rack. - def normalize_params(params, name, v, _depth=nil) - _normalize_params(params, name, v, 0) - end - - private def _normalize_params(params, name, v, depth) - raise ParamsTooDeepError if depth >= param_depth_limit - - if !name - # nil name, treat same as empty string (required by tests) - k = after = '' - elsif depth == 0 - # Start of parsing, don't treat [] or [ at start of string specially - if start = name.index('[', 1) - # Start of parameter nesting, use part before brackets as key - k = name[0, start] - after = name[start, name.length] - else - # Plain parameter with no nesting - k = name - after = '' - end - elsif name.start_with?('[]') - # Array nesting - k = '[]' - after = name[2, name.length] - elsif name.start_with?('[') && (start = name.index(']', 1)) - # Hash nesting, use the part inside brackets as the key - k = name[1, start-1] - after = name[start+1, name.length] - else - # Probably malformed input, nested but not starting with [ - # treat full name as key for backwards compatibility. - k = name - after = '' - end - - return if k.empty? - - if after == '' - if k == '[]' && depth != 0 - return [v] - else - params[k] = v - end - elsif after == "[" - params[name] = v - elsif after == "[]" - params[k] ||= [] - raise ParameterTypeError, "expected Array (got #{params[k].class.name}) for param `#{k}'" unless params[k].is_a?(Array) - params[k] << v - elsif after.start_with?('[]') - # Recognize x[][y] (hash inside array) parameters - unless after[2] == '[' && after.end_with?(']') && (child_key = after[3, after.length-4]) && !child_key.empty? && !child_key.index('[') && !child_key.index(']') - # Handle other nested array parameters - child_key = after[2, after.length] - end - params[k] ||= [] - raise ParameterTypeError, "expected Array (got #{params[k].class.name}) for param `#{k}'" unless params[k].is_a?(Array) - if params_hash_type?(params[k].last) && !params_hash_has_key?(params[k].last, child_key) - _normalize_params(params[k].last, child_key, v, depth + 1) - else - params[k] << _normalize_params(make_params, child_key, v, depth + 1) - end - else - params[k] ||= make_params - raise ParameterTypeError, "expected Hash (got #{params[k].class.name}) for param `#{k}'" unless params_hash_type?(params[k]) - params[k] = _normalize_params(params[k], after, v, depth + 1) - end - - params - end - - def make_params - @params_class.new - end - - def new_depth_limit(param_depth_limit) - self.class.new @params_class, param_depth_limit - end - - private - - def params_hash_type?(obj) - obj.kind_of?(@params_class) - end - - def params_hash_has_key?(hash, key) - return false if /\[\]/.match?(key) - - key.split(/[\[\]]+/).inject(hash) do |h, part| - next h if part == '' - return false unless params_hash_type?(h) && h.key?(part) - h[part] - end - - true - end - - def unescape(string, encoding = Encoding::UTF_8) - URI.decode_www_form_component(string, encoding) - end - - class Params - def initialize - @size = 0 - @params = {} - end - - def [](key) - @params[key] - end - - def []=(key, value) - @params[key] = value - end - - def key?(key) - @params.key?(key) - end - - # Recursively unwraps nested `Params` objects and constructs an object - # of the same shape, but using the objects' internal representations - # (Ruby hashes) in place of the objects. The result is a hash consisting - # purely of Ruby primitives. - # - # Mutation warning! - # - # 1. This method mutates the internal representation of the `Params` - # objects in order to save object allocations. - # - # 2. The value you get back is a reference to the internal hash - # representation, not a copy. - # - # 3. Because the `Params` object's internal representation is mutable - # through the `#[]=` method, it is not thread safe. The result of - # getting the hash representation while another thread is adding a - # key to it is non-deterministic. - # - def to_h - @params.each do |key, value| - case value - when self - # Handle circular references gracefully. - @params[key] = @params - when Params - @params[key] = value.to_h - when Array - value.map! { |v| v.kind_of?(Params) ? v.to_h : v } - else - # Ignore anything that is not a `Params` object or - # a collection that can contain one. - end - end - @params - end - alias_method :to_params_hash, :to_h - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/recursive.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/recursive.rb deleted file mode 100644 index 0945d3227814b9..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/recursive.rb +++ /dev/null @@ -1,66 +0,0 @@ -# frozen_string_literal: true - -require 'uri' - -require_relative 'constants' - -module Rack - # Rack::ForwardRequest gets caught by Rack::Recursive and redirects - # the current request to the app at +url+. - # - # raise ForwardRequest.new("/not-found") - # - - class ForwardRequest < Exception - attr_reader :url, :env - - def initialize(url, env = {}) - @url = URI(url) - @env = env - - @env[PATH_INFO] = @url.path - @env[QUERY_STRING] = @url.query if @url.query - @env[HTTP_HOST] = @url.host if @url.host - @env[HTTP_PORT] = @url.port if @url.port - @env[RACK_URL_SCHEME] = @url.scheme if @url.scheme - - super "forwarding to #{url}" - end - end - - # Rack::Recursive allows applications called down the chain to - # include data from other applications (by using - # rack['rack.recursive.include'][...] or raise a - # ForwardRequest to redirect internally. - - class Recursive - def initialize(app) - @app = app - end - - def call(env) - dup._call(env) - end - - def _call(env) - @script_name = env[SCRIPT_NAME] - @app.call(env.merge(RACK_RECURSIVE_INCLUDE => method(:include))) - rescue ForwardRequest => req - call(env.merge(req.env)) - end - - def include(env, path) - unless path.index(@script_name) == 0 && (path[@script_name.size] == ?/ || - path[@script_name.size].nil?) - raise ArgumentError, "can only include below #{@script_name}, not #{path}" - end - - env = env.merge(PATH_INFO => path, - SCRIPT_NAME => @script_name, - REQUEST_METHOD => GET, - "CONTENT_LENGTH" => "0", "CONTENT_TYPE" => "", - RACK_INPUT => StringIO.new("")) - @app.call(env) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/reloader.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/reloader.rb deleted file mode 100644 index a15064acc498b2..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/reloader.rb +++ /dev/null @@ -1,112 +0,0 @@ -# frozen_string_literal: true - -# Copyright (C) 2009-2018 Michael Fellinger -# Rack::Reloader is subject to the terms of an MIT-style license. -# See MIT-LICENSE or https://opensource.org/licenses/MIT. - -require 'pathname' - -module Rack - - # High performant source reloader - # - # This class acts as Rack middleware. - # - # What makes it especially suited for use in a production environment is that - # any file will only be checked once and there will only be made one system - # call stat(2). - # - # Please note that this will not reload files in the background, it does so - # only when actively called. - # - # It is performing a check/reload cycle at the start of every request, but - # also respects a cool down time, during which nothing will be done. - class Reloader - def initialize(app, cooldown = 10, backend = Stat) - @app = app - @cooldown = cooldown - @last = (Time.now - cooldown) - @cache = {} - @mtimes = {} - @reload_mutex = Mutex.new - - extend backend - end - - def call(env) - if @cooldown and Time.now > @last + @cooldown - if Thread.list.size > 1 - @reload_mutex.synchronize{ reload! } - else - reload! - end - - @last = Time.now - end - - @app.call(env) - end - - def reload!(stderr = $stderr) - rotation do |file, mtime| - previous_mtime = @mtimes[file] ||= mtime - safe_load(file, mtime, stderr) if mtime > previous_mtime - end - end - - # A safe Kernel::load, issuing the hooks depending on the results - def safe_load(file, mtime, stderr = $stderr) - load(file) - stderr.puts "#{self.class}: reloaded `#{file}'" - file - rescue LoadError, SyntaxError => ex - stderr.puts ex - ensure - @mtimes[file] = mtime - end - - module Stat - def rotation - files = [$0, *$LOADED_FEATURES].uniq - paths = ['./', *$LOAD_PATH].uniq - - files.map{|file| - next if /\.(so|bundle)$/.match?(file) # cannot reload compiled files - - found, stat = figure_path(file, paths) - next unless found && stat && mtime = stat.mtime - - @cache[file] = found - - yield(found, mtime) - }.compact - end - - # Takes a relative or absolute +file+ name, a couple possible +paths+ that - # the +file+ might reside in. Returns the full path and File::Stat for the - # path. - def figure_path(file, paths) - found = @cache[file] - found = file if !found and Pathname.new(file).absolute? - found, stat = safe_stat(found) - return found, stat if found - - paths.find do |possible_path| - path = ::File.join(possible_path, file) - found, stat = safe_stat(path) - return ::File.expand_path(found), stat if found - end - - return false, false - end - - def safe_stat(file) - return unless file - stat = ::File.stat(file) - return file, stat if stat.file? - rescue Errno::ENOENT, Errno::ENOTDIR, Errno::ESRCH - @cache.delete(file) and false - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/request.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/request.rb deleted file mode 100644 index 99a33aa1ec48f7..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/request.rb +++ /dev/null @@ -1,777 +0,0 @@ -# frozen_string_literal: true - -require_relative 'constants' -require_relative 'utils' -require_relative 'media_type' - -module Rack - # Rack::Request provides a convenient interface to a Rack - # environment. It is stateless, the environment +env+ passed to the - # constructor will be directly modified. - # - # req = Rack::Request.new(env) - # req.post? - # req.params["data"] - - class Request - class << self - attr_accessor :ip_filter - - # The priority when checking forwarded headers. The default - # is [:forwarded, :x_forwarded], which means, check the - # +Forwarded+ header first, followed by the appropriate - # X-Forwarded-* header. You can revert the priority by - # reversing the priority, or remove checking of either - # or both headers by removing elements from the array. - # - # This should be set as appropriate in your environment - # based on what reverse proxies are in use. If you are not - # using reverse proxies, you should probably use an empty - # array. - attr_accessor :forwarded_priority - - # The priority when checking either the X-Forwarded-Proto - # or X-Forwarded-Scheme header for the forwarded protocol. - # The default is [:proto, :scheme], to try the - # X-Forwarded-Proto header before the - # X-Forwarded-Scheme header. Rack 2 had behavior - # similar to [:scheme, :proto]. You can remove either or - # both of the entries in array to ignore that respective header. - attr_accessor :x_forwarded_proto_priority - end - - @forwarded_priority = [:forwarded, :x_forwarded] - @x_forwarded_proto_priority = [:proto, :scheme] - - valid_ipv4_octet = /\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])/ - - trusted_proxies = Regexp.union( - /\A127#{valid_ipv4_octet}{3}\z/, # localhost IPv4 range 127.x.x.x, per RFC-3330 - /\A::1\z/, # localhost IPv6 ::1 - /\Af[cd][0-9a-f]{2}(?::[0-9a-f]{0,4}){0,7}\z/i, # private IPv6 range fc00 .. fdff - /\A10#{valid_ipv4_octet}{3}\z/, # private IPv4 range 10.x.x.x - /\A172\.(1[6-9]|2[0-9]|3[01])#{valid_ipv4_octet}{2}\z/, # private IPv4 range 172.16.0.0 .. 172.31.255.255 - /\A192\.168#{valid_ipv4_octet}{2}\z/, # private IPv4 range 192.168.x.x - /\Alocalhost\z|\Aunix(\z|:)/i, # localhost hostname, and unix domain sockets - ) - - self.ip_filter = lambda { |ip| trusted_proxies.match?(ip) } - - ALLOWED_SCHEMES = %w(https http wss ws).freeze - - def initialize(env) - @env = env - @params = nil - end - - def params - @params ||= super - end - - def update_param(k, v) - super - @params = nil - end - - def delete_param(k) - v = super - @params = nil - v - end - - module Env - # The environment of the request. - attr_reader :env - - def initialize(env) - @env = env - # This module is included at least in `ActionDispatch::Request` - # The call to `super()` allows additional mixed-in initializers are called - super() - end - - # Predicate method to test to see if `name` has been set as request - # specific data - def has_header?(name) - @env.key? name - end - - # Get a request specific value for `name`. - def get_header(name) - @env[name] - end - - # If a block is given, it yields to the block if the value hasn't been set - # on the request. - def fetch_header(name, &block) - @env.fetch(name, &block) - end - - # Loops through each key / value pair in the request specific data. - def each_header(&block) - @env.each(&block) - end - - # Set a request specific value for `name` to `v` - def set_header(name, v) - @env[name] = v - end - - # Add a header that may have multiple values. - # - # Example: - # request.add_header 'Accept', 'image/png' - # request.add_header 'Accept', '*/*' - # - # assert_equal 'image/png,*/*', request.get_header('Accept') - # - # http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 - def add_header(key, v) - if v.nil? - get_header key - elsif has_header? key - set_header key, "#{get_header key},#{v}" - else - set_header key, v - end - end - - # Delete a request specific value for `name`. - def delete_header(name) - @env.delete name - end - - def initialize_copy(other) - @env = other.env.dup - end - end - - module Helpers - # The set of form-data media-types. Requests that do not indicate - # one of the media types present in this list will not be eligible - # for form-data / param parsing. - FORM_DATA_MEDIA_TYPES = [ - 'application/x-www-form-urlencoded', - 'multipart/form-data' - ] - - # The set of media-types. Requests that do not indicate - # one of the media types present in this list will not be eligible - # for param parsing like soap attachments or generic multiparts - PARSEABLE_DATA_MEDIA_TYPES = [ - 'multipart/related', - 'multipart/mixed' - ] - - # Default ports depending on scheme. Used to decide whether or not - # to include the port in a generated URI. - DEFAULT_PORTS = { 'http' => 80, 'https' => 443, 'coffee' => 80 } - - # The address of the client which connected to the proxy. - HTTP_X_FORWARDED_FOR = 'HTTP_X_FORWARDED_FOR' - - # The contents of the host/:authority header sent to the proxy. - HTTP_X_FORWARDED_HOST = 'HTTP_X_FORWARDED_HOST' - - HTTP_FORWARDED = 'HTTP_FORWARDED' - - # The value of the scheme sent to the proxy. - HTTP_X_FORWARDED_SCHEME = 'HTTP_X_FORWARDED_SCHEME' - - # The protocol used to connect to the proxy. - HTTP_X_FORWARDED_PROTO = 'HTTP_X_FORWARDED_PROTO' - - # The port used to connect to the proxy. - HTTP_X_FORWARDED_PORT = 'HTTP_X_FORWARDED_PORT' - - # Another way for specifying https scheme was used. - HTTP_X_FORWARDED_SSL = 'HTTP_X_FORWARDED_SSL' - - def body; get_header(RACK_INPUT) end - def script_name; get_header(SCRIPT_NAME).to_s end - def script_name=(s); set_header(SCRIPT_NAME, s.to_s) end - - def path_info; get_header(PATH_INFO).to_s end - def path_info=(s); set_header(PATH_INFO, s.to_s) end - - def request_method; get_header(REQUEST_METHOD) end - def query_string; get_header(QUERY_STRING).to_s end - def content_length; get_header('CONTENT_LENGTH') end - def logger; get_header(RACK_LOGGER) end - def user_agent; get_header('HTTP_USER_AGENT') end - - # the referer of the client - def referer; get_header('HTTP_REFERER') end - alias referrer referer - - def session - fetch_header(RACK_SESSION) do |k| - set_header RACK_SESSION, default_session - end - end - - def session_options - fetch_header(RACK_SESSION_OPTIONS) do |k| - set_header RACK_SESSION_OPTIONS, {} - end - end - - # Checks the HTTP request method (or verb) to see if it was of type DELETE - def delete?; request_method == DELETE end - - # Checks the HTTP request method (or verb) to see if it was of type GET - def get?; request_method == GET end - - # Checks the HTTP request method (or verb) to see if it was of type HEAD - def head?; request_method == HEAD end - - # Checks the HTTP request method (or verb) to see if it was of type OPTIONS - def options?; request_method == OPTIONS end - - # Checks the HTTP request method (or verb) to see if it was of type LINK - def link?; request_method == LINK end - - # Checks the HTTP request method (or verb) to see if it was of type PATCH - def patch?; request_method == PATCH end - - # Checks the HTTP request method (or verb) to see if it was of type POST - def post?; request_method == POST end - - # Checks the HTTP request method (or verb) to see if it was of type PUT - def put?; request_method == PUT end - - # Checks the HTTP request method (or verb) to see if it was of type TRACE - def trace?; request_method == TRACE end - - # Checks the HTTP request method (or verb) to see if it was of type UNLINK - def unlink?; request_method == UNLINK end - - def scheme - if get_header(HTTPS) == 'on' - 'https' - elsif get_header(HTTP_X_FORWARDED_SSL) == 'on' - 'https' - elsif forwarded_scheme - forwarded_scheme - else - get_header(RACK_URL_SCHEME) - end - end - - # The authority of the incoming request as defined by RFC3976. - # https://tools.ietf.org/html/rfc3986#section-3.2 - # - # In HTTP/1, this is the `host` header. - # In HTTP/2, this is the `:authority` pseudo-header. - def authority - forwarded_authority || host_authority || server_authority - end - - # The authority as defined by the `SERVER_NAME` and `SERVER_PORT` - # variables. - def server_authority - host = self.server_name - port = self.server_port - - if host - if port - "#{host}:#{port}" - else - host - end - end - end - - def server_name - get_header(SERVER_NAME) - end - - def server_port - get_header(SERVER_PORT) - end - - def cookies - hash = fetch_header(RACK_REQUEST_COOKIE_HASH) do |key| - set_header(key, {}) - end - - string = get_header(HTTP_COOKIE) - - unless string == get_header(RACK_REQUEST_COOKIE_STRING) - hash.replace Utils.parse_cookies_header(string) - set_header(RACK_REQUEST_COOKIE_STRING, string) - end - - hash - end - - def content_type - content_type = get_header('CONTENT_TYPE') - content_type.nil? || content_type.empty? ? nil : content_type - end - - def xhr? - get_header("HTTP_X_REQUESTED_WITH") == "XMLHttpRequest" - end - - # The `HTTP_HOST` header. - def host_authority - get_header(HTTP_HOST) - end - - def host_with_port(authority = self.authority) - host, _, port = split_authority(authority) - - if port == DEFAULT_PORTS[self.scheme] - host - else - authority - end - end - - # Returns a formatted host, suitable for being used in a URI. - def host - split_authority(self.authority)[0] - end - - # Returns an address suitable for being to resolve to an address. - # In the case of a domain name or IPv4 address, the result is the same - # as +host+. In the case of IPv6 or future address formats, the square - # brackets are removed. - def hostname - split_authority(self.authority)[1] - end - - def port - if authority = self.authority - _, _, port = split_authority(authority) - end - - port || forwarded_port&.last || DEFAULT_PORTS[scheme] || server_port - end - - def forwarded_for - forwarded_priority.each do |type| - case type - when :forwarded - if forwarded_for = get_http_forwarded(:for) - return(forwarded_for.map! do |authority| - split_authority(authority)[1] - end) - end - when :x_forwarded - if value = get_header(HTTP_X_FORWARDED_FOR) - return(split_header(value).map do |authority| - split_authority(wrap_ipv6(authority))[1] - end) - end - end - end - - nil - end - - def forwarded_port - forwarded_priority.each do |type| - case type - when :forwarded - if forwarded = get_http_forwarded(:for) - return(forwarded.map do |authority| - split_authority(authority)[2] - end.compact) - end - when :x_forwarded - if value = get_header(HTTP_X_FORWARDED_PORT) - return split_header(value).map(&:to_i) - end - end - end - - nil - end - - def forwarded_authority - forwarded_priority.each do |type| - case type - when :forwarded - if forwarded = get_http_forwarded(:host) - return forwarded.last - end - when :x_forwarded - if value = get_header(HTTP_X_FORWARDED_HOST) - return wrap_ipv6(split_header(value).last) - end - end - end - - nil - end - - def ssl? - scheme == 'https' || scheme == 'wss' - end - - def ip - remote_addresses = split_header(get_header('REMOTE_ADDR')) - external_addresses = reject_trusted_ip_addresses(remote_addresses) - - unless external_addresses.empty? - return external_addresses.last - end - - if (forwarded_for = self.forwarded_for) && !forwarded_for.empty? - # The forwarded for addresses are ordered: client, proxy1, proxy2. - # So we reject all the trusted addresses (proxy*) and return the - # last client. Or if we trust everyone, we just return the first - # address. - return reject_trusted_ip_addresses(forwarded_for).last || forwarded_for.first - end - - # If all the addresses are trusted, and we aren't forwarded, just return - # the first remote address, which represents the source of the request. - remote_addresses.first - end - - # The media type (type/subtype) portion of the CONTENT_TYPE header - # without any media type parameters. e.g., when CONTENT_TYPE is - # "text/plain;charset=utf-8", the media-type is "text/plain". - # - # For more information on the use of media types in HTTP, see: - # http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7 - def media_type - MediaType.type(content_type) - end - - # The media type parameters provided in CONTENT_TYPE as a Hash, or - # an empty Hash if no CONTENT_TYPE or media-type parameters were - # provided. e.g., when the CONTENT_TYPE is "text/plain;charset=utf-8", - # this method responds with the following Hash: - # { 'charset' => 'utf-8' } - def media_type_params - MediaType.params(content_type) - end - - # The character set of the request body if a "charset" media type - # parameter was given, or nil if no "charset" was specified. Note - # that, per RFC2616, text/* media types that specify no explicit - # charset are to be considered ISO-8859-1. - def content_charset - media_type_params['charset'] - end - - # Determine whether the request body contains form-data by checking - # the request content-type for one of the media-types: - # "application/x-www-form-urlencoded" or "multipart/form-data". The - # list of form-data media types can be modified through the - # +FORM_DATA_MEDIA_TYPES+ array. - # - # A request body is also assumed to contain form-data when no - # content-type header is provided and the request_method is POST. - def form_data? - type = media_type - meth = get_header(RACK_METHODOVERRIDE_ORIGINAL_METHOD) || get_header(REQUEST_METHOD) - - (meth == POST && type.nil?) || FORM_DATA_MEDIA_TYPES.include?(type) - end - - # Determine whether the request body contains data by checking - # the request media_type against registered parse-data media-types - def parseable_data? - PARSEABLE_DATA_MEDIA_TYPES.include?(media_type) - end - - # Returns the data received in the query string. - def GET - if get_header(RACK_REQUEST_QUERY_STRING) == query_string - get_header(RACK_REQUEST_QUERY_HASH) - else - query_hash = parse_query(query_string, '&') - set_header(RACK_REQUEST_QUERY_STRING, query_string) - set_header(RACK_REQUEST_QUERY_HASH, query_hash) - end - end - - # Returns the data received in the request body. - # - # This method support both application/x-www-form-urlencoded and - # multipart/form-data. - def POST - if error = get_header(RACK_REQUEST_FORM_ERROR) - raise error.class, error.message, cause: error.cause - end - - begin - rack_input = get_header(RACK_INPUT) - - # If the form hash was already memoized: - if form_hash = get_header(RACK_REQUEST_FORM_HASH) - # And it was memoized from the same input: - if get_header(RACK_REQUEST_FORM_INPUT).equal?(rack_input) - return form_hash - end - end - - # Otherwise, figure out how to parse the input: - if rack_input.nil? - set_header RACK_REQUEST_FORM_INPUT, nil - set_header(RACK_REQUEST_FORM_HASH, {}) - elsif form_data? || parseable_data? - unless set_header(RACK_REQUEST_FORM_HASH, parse_multipart) - form_vars = get_header(RACK_INPUT).read - - # Fix for Safari Ajax postings that always append \0 - # form_vars.sub!(/\0\z/, '') # performance replacement: - form_vars.slice!(-1) if form_vars.end_with?("\0") - - set_header RACK_REQUEST_FORM_VARS, form_vars - set_header RACK_REQUEST_FORM_HASH, parse_query(form_vars, '&') - end - - set_header RACK_REQUEST_FORM_INPUT, get_header(RACK_INPUT) - get_header RACK_REQUEST_FORM_HASH - else - set_header RACK_REQUEST_FORM_INPUT, get_header(RACK_INPUT) - set_header(RACK_REQUEST_FORM_HASH, {}) - end - rescue => error - set_header(RACK_REQUEST_FORM_ERROR, error) - raise - end - end - - # The union of GET and POST data. - # - # Note that modifications will not be persisted in the env. Use update_param or delete_param if you want to destructively modify params. - def params - self.GET.merge(self.POST) - end - - # Destructively update a parameter, whether it's in GET and/or POST. Returns nil. - # - # The parameter is updated wherever it was previous defined, so GET, POST, or both. If it wasn't previously defined, it's inserted into GET. - # - # env['rack.input'] is not touched. - def update_param(k, v) - found = false - if self.GET.has_key?(k) - found = true - self.GET[k] = v - end - if self.POST.has_key?(k) - found = true - self.POST[k] = v - end - unless found - self.GET[k] = v - end - end - - # Destructively delete a parameter, whether it's in GET or POST. Returns the value of the deleted parameter. - # - # If the parameter is in both GET and POST, the POST value takes precedence since that's how #params works. - # - # env['rack.input'] is not touched. - def delete_param(k) - post_value, get_value = self.POST.delete(k), self.GET.delete(k) - post_value || get_value - end - - def base_url - "#{scheme}://#{host_with_port}" - end - - # Tries to return a remake of the original request URL as a string. - def url - base_url + fullpath - end - - def path - script_name + path_info - end - - def fullpath - query_string.empty? ? path : "#{path}?#{query_string}" - end - - def accept_encoding - parse_http_accept_header(get_header("HTTP_ACCEPT_ENCODING")) - end - - def accept_language - parse_http_accept_header(get_header("HTTP_ACCEPT_LANGUAGE")) - end - - def trusted_proxy?(ip) - Rack::Request.ip_filter.call(ip) - end - - # shortcut for request.params[key] - def [](key) - warn("Request#[] is deprecated and will be removed in a future version of Rack. Please use request.params[] instead", uplevel: 1) - - params[key.to_s] - end - - # shortcut for request.params[key] = value - # - # Note that modifications will not be persisted in the env. Use update_param or delete_param if you want to destructively modify params. - def []=(key, value) - warn("Request#[]= is deprecated and will be removed in a future version of Rack. Please use request.params[]= instead", uplevel: 1) - - params[key.to_s] = value - end - - # like Hash#values_at - def values_at(*keys) - keys.map { |key| params[key] } - end - - private - - def default_session; {}; end - - # Assist with compatibility when processing `X-Forwarded-For`. - def wrap_ipv6(host) - # Even thought IPv6 addresses should be wrapped in square brackets, - # sometimes this is not done in various legacy/underspecified headers. - # So we try to fix this situation for compatibility reasons. - - # Try to detect IPv6 addresses which aren't escaped yet: - if !host.start_with?('[') && host.count(':') > 1 - "[#{host}]" - else - host - end - end - - def parse_http_accept_header(header) - header.to_s.split(",").each(&:strip!).map do |part| - attribute, parameters = part.split(";", 2).each(&:strip!) - quality = 1.0 - if parameters and /\Aq=([\d.]+)/ =~ parameters - quality = $1.to_f - end - [attribute, quality] - end - end - - # Get an array of values set in the RFC 7239 `Forwarded` request header. - def get_http_forwarded(token) - Utils.forwarded_values(get_header(HTTP_FORWARDED))&.[](token) - end - - def query_parser - Utils.default_query_parser - end - - def parse_query(qs, d = '&') - query_parser.parse_nested_query(qs, d) - end - - def parse_multipart - Rack::Multipart.extract_multipart(self, query_parser) - end - - def split_header(value) - value ? value.strip.split(/[,\s]+/) : [] - end - - # ipv6 extracted from resolv stdlib, simplified - # to remove numbered match group creation. - ipv6 = Regexp.union( - /(?:[0-9A-Fa-f]{1,4}:){7} - [0-9A-Fa-f]{1,4}/x, - /(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)? :: - (?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?/x, - /(?:[0-9A-Fa-f]{1,4}:){6,6} - \d+\.\d+\.\d+\.\d+/x, - /(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)? :: - (?:[0-9A-Fa-f]{1,4}:)* - \d+\.\d+\.\d+\.\d+/x, - /[Ff][Ee]80 - (?::[0-9A-Fa-f]{1,4}){7} - %[-0-9A-Za-z._~]+/x, - /[Ff][Ee]80: - (?: - (?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)? :: - (?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)? - | - :(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)? - )? - :[0-9A-Fa-f]{1,4}%[-0-9A-Za-z._~]+/x) - - AUTHORITY = / - \A - (? - # Match IPv6 as a string of hex digits and colons in square brackets - \[(?
#{ipv6})\] - | - # Match any other printable string (except square brackets) as a hostname - (?
[[[:graph:]&&[^\[\]]]]*?) - ) - (:(?\d+))? - \z - /x - - private_constant :AUTHORITY - - def split_authority(authority) - return [] if authority.nil? - return [] unless match = AUTHORITY.match(authority) - return match[:host], match[:address], match[:port]&.to_i - end - - def reject_trusted_ip_addresses(ip_addresses) - ip_addresses.reject { |ip| trusted_proxy?(ip) } - end - - FORWARDED_SCHEME_HEADERS = { - proto: HTTP_X_FORWARDED_PROTO, - scheme: HTTP_X_FORWARDED_SCHEME - }.freeze - private_constant :FORWARDED_SCHEME_HEADERS - def forwarded_scheme - forwarded_priority.each do |type| - case type - when :forwarded - if (forwarded_proto = get_http_forwarded(:proto)) && - (scheme = allowed_scheme(forwarded_proto.last)) - return scheme - end - when :x_forwarded - x_forwarded_proto_priority.each do |x_type| - if header = FORWARDED_SCHEME_HEADERS[x_type] - split_header(get_header(header)).reverse_each do |scheme| - if allowed_scheme(scheme) - return scheme - end - end - end - end - end - end - - nil - end - - def allowed_scheme(header) - header if ALLOWED_SCHEMES.include?(header) - end - - def forwarded_priority - Request.forwarded_priority - end - - def x_forwarded_proto_priority - Request.x_forwarded_proto_priority - end - end - - include Env - include Helpers - end -end - -# :nocov: -require_relative 'multipart' unless defined?(Rack::Multipart) -# :nocov: diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/response.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/response.rb deleted file mode 100644 index f24683bcb54be6..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/response.rb +++ /dev/null @@ -1,393 +0,0 @@ -# frozen_string_literal: true - -require 'time' - -require_relative 'constants' -require_relative 'utils' -require_relative 'media_type' -require_relative 'headers' - -module Rack - # Rack::Response provides a convenient interface to create a Rack - # response. - # - # It allows setting of headers and cookies, and provides useful - # defaults (an OK response with empty headers and body). - # - # You can use Response#write to iteratively generate your response, - # but note that this is buffered by Rack::Response until you call - # +finish+. +finish+ however can take a block inside which calls to - # +write+ are synchronous with the Rack response. - # - # Your application's +call+ should end returning Response#finish. - class Response - def self.[](status, headers, body) - self.new(body, status, headers) - end - - CHUNKED = 'chunked' - STATUS_WITH_NO_ENTITY_BODY = Utils::STATUS_WITH_NO_ENTITY_BODY - - attr_accessor :length, :status, :body - attr_reader :headers - - # Deprecated, use headers instead. - def header - warn 'Rack::Response#header is deprecated and will be removed in Rack 3.1', uplevel: 1 - - headers - end - - # Initialize the response object with the specified +body+, +status+ - # and +headers+. - # - # If the +body+ is +nil+, construct an empty response object with internal - # buffering. - # - # If the +body+ responds to +to_str+, assume it's a string-like object and - # construct a buffered response object containing using that string as the - # initial contents of the buffer. - # - # Otherwise it is expected +body+ conforms to the normal requirements of a - # Rack response body, typically implementing one of +each+ (enumerable - # body) or +call+ (streaming body). - # - # The +status+ defaults to +200+ which is the "OK" HTTP status code. You - # can provide any other valid status code. - # - # The +headers+ must be a +Hash+ of key-value header pairs which conform to - # the Rack specification for response headers. The key must be a +String+ - # instance and the value can be either a +String+ or +Array+ instance. - def initialize(body = nil, status = 200, headers = {}) - @status = status.to_i - - unless headers.is_a?(Hash) - warn "Providing non-hash headers to Rack::Response is deprecated and will be removed in Rack 3.1", uplevel: 1 - end - - @headers = Headers.new - # Convert headers input to a plain hash with lowercase keys. - headers.each do |k, v| - @headers[k] = v - end - - @writer = self.method(:append) - - @block = nil - - # Keep track of whether we have expanded the user supplied body. - if body.nil? - @body = [] - @buffered = true - @length = 0 - elsif body.respond_to?(:to_str) - @body = [body] - @buffered = true - @length = body.to_str.bytesize - else - @body = body - @buffered = nil # undetermined as of yet. - @length = 0 - end - - yield self if block_given? - end - - def redirect(target, status = 302) - self.status = status - self.location = target - end - - def chunked? - CHUNKED == get_header(TRANSFER_ENCODING) - end - - def no_entity_body? - # The response body is an enumerable body and it is not allowed to have an entity body. - @body.respond_to?(:each) && STATUS_WITH_NO_ENTITY_BODY[@status] - end - - # Generate a response array consistent with the requirements of the SPEC. - # @return [Array] a 3-tuple suitable of `[status, headers, body]` - # which is suitable to be returned from the middleware `#call(env)` method. - def finish(&block) - if no_entity_body? - delete_header CONTENT_TYPE - delete_header CONTENT_LENGTH - close - return [@status, @headers, []] - else - if block_given? - @block = block - return [@status, @headers, self] - else - return [@status, @headers, @body] - end - end - end - - alias to_a finish # For *response - - def each(&callback) - @body.each(&callback) - @buffered = true - - if @block - @writer = callback - @block.call(self) - end - end - - # Append to body and update content-length. - # - # NOTE: Do not mix #write and direct #body access! - # - def write(chunk) - buffered_body! - - @writer.call(chunk.to_s) - end - - def close - @body.close if @body.respond_to?(:close) - end - - def empty? - @block == nil && @body.empty? - end - - def has_header?(key) - raise ArgumentError unless key.is_a?(String) - @headers.key?(key) - end - def get_header(key) - raise ArgumentError unless key.is_a?(String) - @headers[key] - end - def set_header(key, value) - raise ArgumentError unless key.is_a?(String) - @headers[key] = value - end - def delete_header(key) - raise ArgumentError unless key.is_a?(String) - @headers.delete key - end - - alias :[] :get_header - alias :[]= :set_header - - module Helpers - def invalid?; status < 100 || status >= 600; end - - def informational?; status >= 100 && status < 200; end - def successful?; status >= 200 && status < 300; end - def redirection?; status >= 300 && status < 400; end - def client_error?; status >= 400 && status < 500; end - def server_error?; status >= 500 && status < 600; end - - def ok?; status == 200; end - def created?; status == 201; end - def accepted?; status == 202; end - def no_content?; status == 204; end - def moved_permanently?; status == 301; end - def bad_request?; status == 400; end - def unauthorized?; status == 401; end - def forbidden?; status == 403; end - def not_found?; status == 404; end - def method_not_allowed?; status == 405; end - def not_acceptable?; status == 406; end - def request_timeout?; status == 408; end - def precondition_failed?; status == 412; end - def unprocessable?; status == 422; end - - def redirect?; [301, 302, 303, 307, 308].include? status; end - - def include?(header) - has_header?(header) - end - - # Add a header that may have multiple values. - # - # Example: - # response.add_header 'vary', 'accept-encoding' - # response.add_header 'vary', 'cookie' - # - # assert_equal 'accept-encoding,cookie', response.get_header('vary') - # - # http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 - def add_header(key, value) - raise ArgumentError unless key.is_a?(String) - - if value.nil? - return get_header(key) - end - - value = value.to_s - - if header = get_header(key) - if header.is_a?(Array) - header << value - else - set_header(key, [header, value]) - end - else - set_header(key, value) - end - end - - # Get the content type of the response. - def content_type - get_header CONTENT_TYPE - end - - # Set the content type of the response. - def content_type=(content_type) - set_header CONTENT_TYPE, content_type - end - - def media_type - MediaType.type(content_type) - end - - def media_type_params - MediaType.params(content_type) - end - - def content_length - cl = get_header CONTENT_LENGTH - cl ? cl.to_i : cl - end - - def location - get_header "location" - end - - def location=(location) - set_header "location", location - end - - def set_cookie(key, value) - add_header SET_COOKIE, Utils.set_cookie_header(key, value) - end - - def delete_cookie(key, value = {}) - set_header(SET_COOKIE, - Utils.delete_set_cookie_header!( - get_header(SET_COOKIE), key, value - ) - ) - end - - def set_cookie_header - get_header SET_COOKIE - end - - def set_cookie_header=(value) - set_header SET_COOKIE, value - end - - def cache_control - get_header CACHE_CONTROL - end - - def cache_control=(value) - set_header CACHE_CONTROL, value - end - - # Specifies that the content shouldn't be cached. Overrides `cache!` if already called. - def do_not_cache! - set_header CACHE_CONTROL, "no-cache, must-revalidate" - set_header EXPIRES, Time.now.httpdate - end - - # Specify that the content should be cached. - # @param duration [Integer] The number of seconds until the cache expires. - # @option directive [String] The cache control directive, one of "public", "private", "no-cache" or "no-store". - def cache!(duration = 3600, directive: "public") - unless headers[CACHE_CONTROL] =~ /no-cache/ - set_header CACHE_CONTROL, "#{directive}, max-age=#{duration}" - set_header EXPIRES, (Time.now + duration).httpdate - end - end - - def etag - get_header ETAG - end - - def etag=(value) - set_header ETAG, value - end - - protected - - def buffered_body! - if @buffered.nil? - if @body.is_a?(Array) - # The user supplied body was an array: - @body = @body.compact - @body.each do |part| - @length += part.to_s.bytesize - end - elsif @body.respond_to?(:each) - # Turn the user supplied body into a buffered array: - body = @body - @body = Array.new - - body.each do |part| - @writer.call(part.to_s) - end - - body.close if body.respond_to?(:close) - - @buffered = true - else - @buffered = false - end - end - - return @buffered - end - - def append(chunk) - @body << chunk - - unless chunked? - @length += chunk.bytesize - set_header(CONTENT_LENGTH, @length.to_s) - end - - return chunk - end - end - - include Helpers - - class Raw - include Helpers - - attr_reader :headers - attr_accessor :status - - def initialize(status, headers) - @status = status - @headers = headers - end - - def has_header?(key) - headers.key?(key) - end - - def get_header(key) - headers[key] - end - - def set_header(key, value) - headers[key] = value - end - - def delete_header(key) - headers.delete(key) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/rewindable_input.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/rewindable_input.rb deleted file mode 100644 index 730c6a2851a17c..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/rewindable_input.rb +++ /dev/null @@ -1,113 +0,0 @@ -# -*- encoding: binary -*- -# frozen_string_literal: true - -require 'tempfile' - -require_relative 'constants' - -module Rack - # Class which can make any IO object rewindable, including non-rewindable ones. It does - # this by buffering the data into a tempfile, which is rewindable. - # - # Don't forget to call #close when you're done. This frees up temporary resources that - # RewindableInput uses, though it does *not* close the original IO object. - class RewindableInput - # Makes rack.input rewindable, for compatibility with applications and middleware - # designed for earlier versions of Rack (where rack.input was required to be - # rewindable). - class Middleware - def initialize(app) - @app = app - end - - def call(env) - env[RACK_INPUT] = RewindableInput.new(env[RACK_INPUT]) - @app.call(env) - end - end - - def initialize(io) - @io = io - @rewindable_io = nil - @unlinked = false - end - - def gets - make_rewindable unless @rewindable_io - @rewindable_io.gets - end - - def read(*args) - make_rewindable unless @rewindable_io - @rewindable_io.read(*args) - end - - def each(&block) - make_rewindable unless @rewindable_io - @rewindable_io.each(&block) - end - - def rewind - make_rewindable unless @rewindable_io - @rewindable_io.rewind - end - - def size - make_rewindable unless @rewindable_io - @rewindable_io.size - end - - # Closes this RewindableInput object without closing the originally - # wrapped IO object. Cleans up any temporary resources that this RewindableInput - # has created. - # - # This method may be called multiple times. It does nothing on subsequent calls. - def close - if @rewindable_io - if @unlinked - @rewindable_io.close - else - @rewindable_io.close! - end - @rewindable_io = nil - end - end - - private - - def make_rewindable - # Buffer all data into a tempfile. Since this tempfile is private to this - # RewindableInput object, we chmod it so that nobody else can read or write - # it. On POSIX filesystems we also unlink the file so that it doesn't - # even have a file entry on the filesystem anymore, though we can still - # access it because we have the file handle open. - @rewindable_io = Tempfile.new('RackRewindableInput') - @rewindable_io.chmod(0000) - @rewindable_io.set_encoding(Encoding::BINARY) - @rewindable_io.binmode - # :nocov: - if filesystem_has_posix_semantics? - raise 'Unlink failed. IO closed.' if @rewindable_io.closed? - @unlinked = true - end - # :nocov: - - buffer = "".dup - while @io.read(1024 * 4, buffer) - entire_buffer_written_out = false - while !entire_buffer_written_out - written = @rewindable_io.write(buffer) - entire_buffer_written_out = written == buffer.bytesize - if !entire_buffer_written_out - buffer.slice!(0 .. written - 1) - end - end - end - @rewindable_io.rewind - end - - def filesystem_has_posix_semantics? - RUBY_PLATFORM !~ /(mswin|mingw|cygwin|java)/ - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/runtime.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/runtime.rb deleted file mode 100644 index a1bfa696e3fae9..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/runtime.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -require_relative 'utils' - -module Rack - # Sets an "x-runtime" response header, indicating the response - # time of the request, in seconds - # - # You can put it right before the application to see the processing - # time, or before all the other middlewares to include time for them, - # too. - class Runtime - FORMAT_STRING = "%0.6f" # :nodoc: - HEADER_NAME = "x-runtime" # :nodoc: - - def initialize(app, name = nil) - @app = app - @header_name = HEADER_NAME - @header_name += "-#{name.to_s.downcase}" if name - end - - def call(env) - start_time = Utils.clock_time - _, headers, _ = response = @app.call(env) - - request_time = Utils.clock_time - start_time - - unless headers.key?(@header_name) - headers[@header_name] = FORMAT_STRING % request_time - end - - response - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/sendfile.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/sendfile.rb deleted file mode 100644 index 9c6e0c42fa8f91..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/sendfile.rb +++ /dev/null @@ -1,167 +0,0 @@ -# frozen_string_literal: true - -require_relative 'constants' -require_relative 'utils' -require_relative 'body_proxy' - -module Rack - - # = Sendfile - # - # The Sendfile middleware intercepts responses whose body is being - # served from a file and replaces it with a server specific x-sendfile - # header. The web server is then responsible for writing the file contents - # to the client. This can dramatically reduce the amount of work required - # by the Ruby backend and takes advantage of the web server's optimized file - # delivery code. - # - # In order to take advantage of this middleware, the response body must - # respond to +to_path+ and the request must include an x-sendfile-type - # header. Rack::Files and other components implement +to_path+ so there's - # rarely anything you need to do in your application. The x-sendfile-type - # header is typically set in your web servers configuration. The following - # sections attempt to document - # - # === Nginx - # - # Nginx supports the x-accel-redirect header. This is similar to x-sendfile - # but requires parts of the filesystem to be mapped into a private URL - # hierarchy. - # - # The following example shows the Nginx configuration required to create - # a private "/files/" area, enable x-accel-redirect, and pass the special - # x-sendfile-type and x-accel-mapping headers to the backend: - # - # location ~ /files/(.*) { - # internal; - # alias /var/www/$1; - # } - # - # location / { - # proxy_redirect off; - # - # proxy_set_header Host $host; - # proxy_set_header X-Real-IP $remote_addr; - # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - # - # proxy_set_header x-sendfile-type x-accel-redirect; - # proxy_set_header x-accel-mapping /var/www/=/files/; - # - # proxy_pass http://127.0.0.1:8080/; - # } - # - # Note that the x-sendfile-type header must be set exactly as shown above. - # The x-accel-mapping header should specify the location on the file system, - # followed by an equals sign (=), followed name of the private URL pattern - # that it maps to. The middleware performs a simple substitution on the - # resulting path. - # - # See Also: https://www.nginx.com/resources/wiki/start/topics/examples/xsendfile - # - # === lighttpd - # - # Lighttpd has supported some variation of the x-sendfile header for some - # time, although only recent version support x-sendfile in a reverse proxy - # configuration. - # - # $HTTP["host"] == "example.com" { - # proxy-core.protocol = "http" - # proxy-core.balancer = "round-robin" - # proxy-core.backends = ( - # "127.0.0.1:8000", - # "127.0.0.1:8001", - # ... - # ) - # - # proxy-core.allow-x-sendfile = "enable" - # proxy-core.rewrite-request = ( - # "x-sendfile-type" => (".*" => "x-sendfile") - # ) - # } - # - # See Also: http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModProxyCore - # - # === Apache - # - # x-sendfile is supported under Apache 2.x using a separate module: - # - # https://tn123.org/mod_xsendfile/ - # - # Once the module is compiled and installed, you can enable it using - # XSendFile config directive: - # - # RequestHeader Set x-sendfile-type x-sendfile - # ProxyPassReverse / http://localhost:8001/ - # XSendFile on - # - # === Mapping parameter - # - # The third parameter allows for an overriding extension of the - # x-accel-mapping header. Mappings should be provided in tuples of internal to - # external. The internal values may contain regular expression syntax, they - # will be matched with case indifference. - - class Sendfile - def initialize(app, variation = nil, mappings = []) - @app = app - @variation = variation - @mappings = mappings.map do |internal, external| - [/^#{internal}/i, external] - end - end - - def call(env) - _, headers, body = response = @app.call(env) - - if body.respond_to?(:to_path) - case type = variation(env) - when /x-accel-redirect/i - path = ::File.expand_path(body.to_path) - if url = map_accel_path(env, path) - headers[CONTENT_LENGTH] = '0' - # '?' must be percent-encoded because it is not query string but a part of path - headers[type.downcase] = ::Rack::Utils.escape_path(url).gsub('?', '%3F') - obody = body - response[2] = Rack::BodyProxy.new([]) do - obody.close if obody.respond_to?(:close) - end - else - env[RACK_ERRORS].puts "x-accel-mapping header missing" - end - when /x-sendfile|x-lighttpd-send-file/i - path = ::File.expand_path(body.to_path) - headers[CONTENT_LENGTH] = '0' - headers[type.downcase] = path - obody = body - response[2] = Rack::BodyProxy.new([]) do - obody.close if obody.respond_to?(:close) - end - when '', nil - else - env[RACK_ERRORS].puts "Unknown x-sendfile variation: '#{type}'.\n" - end - end - response - end - - private - def variation(env) - @variation || - env['sendfile.type'] || - env['HTTP_X_SENDFILE_TYPE'] - end - - def map_accel_path(env, path) - if mapping = @mappings.find { |internal, _| internal =~ path } - path.sub(*mapping) - elsif mapping = env['HTTP_X_ACCEL_MAPPING'] - mapping.split(',').map(&:strip).each do |m| - internal, external = m.split('=', 2).map(&:strip) - new_path = path.sub(/^#{internal}/i, external) - return new_path unless path == new_path - end - path - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/show_exceptions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/show_exceptions.rb deleted file mode 100644 index ca090a5048a27b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/show_exceptions.rb +++ /dev/null @@ -1,403 +0,0 @@ -# frozen_string_literal: true - -require 'ostruct' -require 'erb' - -require_relative 'constants' -require_relative 'utils' -require_relative 'request' - -module Rack - # Rack::ShowExceptions catches all exceptions raised from the app it - # wraps. It shows a useful backtrace with the sourcefile and - # clickable context, the whole Rack environment and the request - # data. - # - # Be careful when you use this on public-facing sites as it could - # reveal information helpful to attackers. - - class ShowExceptions - CONTEXT = 7 - - def initialize(app) - @app = app - end - - def call(env) - @app.call(env) - rescue StandardError, LoadError, SyntaxError => e - exception_string = dump_exception(e) - - env[RACK_ERRORS].puts(exception_string) - env[RACK_ERRORS].flush - - if accepts_html?(env) - content_type = "text/html" - body = pretty(env, e) - else - content_type = "text/plain" - body = exception_string - end - - [ - 500, - { - CONTENT_TYPE => content_type, - CONTENT_LENGTH => body.bytesize.to_s, - }, - [body], - ] - end - - def prefers_plaintext?(env) - !accepts_html?(env) - end - - def accepts_html?(env) - Rack::Utils.best_q_match(env["HTTP_ACCEPT"], %w[text/html]) - end - private :accepts_html? - - def dump_exception(exception) - if exception.respond_to?(:detailed_message) - message = exception.detailed_message(highlight: false) - else - message = exception.message - end - string = "#{exception.class}: #{message}\n".dup - string << exception.backtrace.map { |l| "\t#{l}" }.join("\n") - string - end - - def pretty(env, exception) - req = Rack::Request.new(env) - - # This double assignment is to prevent an "unused variable" warning. - # Yes, it is dumb, but I don't like Ruby yelling at me. - path = path = (req.script_name + req.path_info).squeeze("/") - - # This double assignment is to prevent an "unused variable" warning. - # Yes, it is dumb, but I don't like Ruby yelling at me. - frames = frames = exception.backtrace.map { |line| - frame = OpenStruct.new - if line =~ /(.*?):(\d+)(:in `(.*)')?/ - frame.filename = $1 - frame.lineno = $2.to_i - frame.function = $4 - - begin - lineno = frame.lineno - 1 - lines = ::File.readlines(frame.filename) - frame.pre_context_lineno = [lineno - CONTEXT, 0].max - frame.pre_context = lines[frame.pre_context_lineno...lineno] - frame.context_line = lines[lineno].chomp - frame.post_context_lineno = [lineno + CONTEXT, lines.size].min - frame.post_context = lines[lineno + 1..frame.post_context_lineno] - rescue - end - - frame - else - nil - end - }.compact - - template.result(binding) - end - - def template - TEMPLATE - end - - def h(obj) # :nodoc: - case obj - when String - Utils.escape_html(obj) - else - Utils.escape_html(obj.inspect) - end - end - - # :stopdoc: - - # adapted from Django - # Copyright (c) Django Software Foundation and individual contributors. - # Used under the modified BSD license: - # http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5 - TEMPLATE = ERB.new(<<-'HTML'.gsub(/^ /, '')) - - - - - - <%=h exception.class %> at <%=h path %> - - - - - -
-

<%=h exception.class %> at <%=h path %>

- <% if exception.respond_to?(:detailed_message) %> -

<%=h exception.detailed_message(highlight: false) %>

- <% else %> -

<%=h exception.message %>

- <% end %> - - - - - - -
Ruby - <% if first = frames.first %> - <%=h first.filename %>: in <%=h first.function %>, line <%=h frames.first.lineno %> - <% else %> - unknown location - <% end %> -
Web<%=h req.request_method %> <%=h(req.host + path)%>
- -

Jump to:

- -
- -
-

Traceback (innermost first)

-
    - <% frames.each { |frame| %> -
  • - <%=h frame.filename %>: in <%=h frame.function %> - - <% if frame.context_line %> -
    - <% if frame.pre_context %> -
      - <% frame.pre_context.each { |line| %> -
    1. <%=h line %>
    2. - <% } %> -
    - <% end %> - -
      -
    1. <%=h frame.context_line %>...
    - - <% if frame.post_context %> -
      - <% frame.post_context.each { |line| %> -
    1. <%=h line %>
    2. - <% } %> -
    - <% end %> -
    - <% end %> -
  • - <% } %> -
-
- -
-

Request information

- -

GET

- <% if req.GET and not req.GET.empty? %> - - - - - - - - - <% req.GET.sort_by { |k, v| k.to_s }.each { |key, val| %> - - - - - <% } %> - -
VariableValue
<%=h key %>
<%=h val.inspect %>
- <% else %> -

No GET data.

- <% end %> - -

POST

- <% if ((req.POST and not req.POST.empty?) rescue (no_post_data = "Invalid POST data"; nil)) %> - - - - - - - - - <% req.POST.sort_by { |k, v| k.to_s }.each { |key, val| %> - - - - - <% } %> - -
VariableValue
<%=h key %>
<%=h val.inspect %>
- <% else %> -

<%= no_post_data || "No POST data" %>.

- <% end %> - - - - <% unless req.cookies.empty? %> - - - - - - - - - <% req.cookies.each { |key, val| %> - - - - - <% } %> - -
VariableValue
<%=h key %>
<%=h val.inspect %>
- <% else %> -

No cookie data.

- <% end %> - -

Rack ENV

- - - - - - - - - <% env.sort_by { |k, v| k.to_s }.each { |key, val| %> - - - - - <% } %> - -
VariableValue
<%=h key %>
<%=h val.inspect %>
- -
- -
-

- You're seeing this error because you use Rack::ShowExceptions. -

-
- - - - HTML - - # :startdoc: - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/show_status.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/show_status.rb deleted file mode 100644 index b6f75a016e9682..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/show_status.rb +++ /dev/null @@ -1,123 +0,0 @@ -# frozen_string_literal: true - -require 'erb' - -require_relative 'constants' -require_relative 'utils' -require_relative 'request' -require_relative 'body_proxy' - -module Rack - # Rack::ShowStatus catches all empty responses and replaces them - # with a site explaining the error. - # - # Additional details can be put into rack.showstatus.detail - # and will be shown as HTML. If such details exist, the error page - # is always rendered, even if the reply was not empty. - - class ShowStatus - def initialize(app) - @app = app - @template = ERB.new(TEMPLATE) - end - - def call(env) - status, headers, body = response = @app.call(env) - empty = headers[CONTENT_LENGTH].to_i <= 0 - - # client or server error, or explicit message - if (status.to_i >= 400 && empty) || env[RACK_SHOWSTATUS_DETAIL] - # This double assignment is to prevent an "unused variable" warning. - # Yes, it is dumb, but I don't like Ruby yelling at me. - req = req = Rack::Request.new(env) - - message = Rack::Utils::HTTP_STATUS_CODES[status.to_i] || status.to_s - - # This double assignment is to prevent an "unused variable" warning. - # Yes, it is dumb, but I don't like Ruby yelling at me. - detail = detail = env[RACK_SHOWSTATUS_DETAIL] || message - - html = @template.result(binding) - size = html.bytesize - - response[2] = Rack::BodyProxy.new([html]) do - body.close if body.respond_to?(:close) - end - - headers[CONTENT_TYPE] = "text/html" - headers[CONTENT_LENGTH] = size.to_s - end - - response - end - - def h(obj) # :nodoc: - case obj - when String - Utils.escape_html(obj) - else - Utils.escape_html(obj.inspect) - end - end - - # :stopdoc: - -# adapted from Django -# Copyright (c) Django Software Foundation and individual contributors. -# Used under the modified BSD license: -# http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5 -TEMPLATE = <<'HTML' - - - - - <%=h message %> at <%=h req.script_name + req.path_info %> - - - - -
-

<%=h message %> (<%= status.to_i %>)

- - - - - - - - - -
Request Method:<%=h req.request_method %>
Request URL:<%=h req.url %>
-
-
-

<%=h detail %>

-
- -
-

- You're seeing this error because you use Rack::ShowStatus. -

-
- - -HTML - - # :startdoc: - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/static.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/static.rb deleted file mode 100644 index 5c9b6760ffce34..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/static.rb +++ /dev/null @@ -1,187 +0,0 @@ -# frozen_string_literal: true - -require_relative 'constants' -require_relative 'files' -require_relative 'mime' - -module Rack - - # The Rack::Static middleware intercepts requests for static files - # (javascript files, images, stylesheets, etc) based on the url prefixes or - # route mappings passed in the options, and serves them using a Rack::Files - # object. This allows a Rack stack to serve both static and dynamic content. - # - # Examples: - # - # Serve all requests beginning with /media from the "media" folder located - # in the current directory (ie media/*): - # - # use Rack::Static, :urls => ["/media"] - # - # Same as previous, but instead of returning 404 for missing files under - # /media, call the next middleware: - # - # use Rack::Static, :urls => ["/media"], :cascade => true - # - # Serve all requests beginning with /css or /images from the folder "public" - # in the current directory (ie public/css/* and public/images/*): - # - # use Rack::Static, :urls => ["/css", "/images"], :root => "public" - # - # Serve all requests to / with "index.html" from the folder "public" in the - # current directory (ie public/index.html): - # - # use Rack::Static, :urls => {"/" => 'index.html'}, :root => 'public' - # - # Serve all requests normally from the folder "public" in the current - # directory but uses index.html as default route for "/" - # - # use Rack::Static, :urls => [""], :root => 'public', :index => - # 'index.html' - # - # Set custom HTTP Headers for based on rules: - # - # use Rack::Static, :root => 'public', - # :header_rules => [ - # [rule, {header_field => content, header_field => content}], - # [rule, {header_field => content}] - # ] - # - # Rules for selecting files: - # - # 1) All files - # Provide the :all symbol - # :all => Matches every file - # - # 2) Folders - # Provide the folder path as a string - # '/folder' or '/folder/subfolder' => Matches files in a certain folder - # - # 3) File Extensions - # Provide the file extensions as an array - # ['css', 'js'] or %w(css js) => Matches files ending in .css or .js - # - # 4) Regular Expressions / Regexp - # Provide a regular expression - # %r{\.(?:css|js)\z} => Matches files ending in .css or .js - # /\.(?:eot|ttf|otf|woff2|woff|svg)\z/ => Matches files ending in - # the most common web font formats (.eot, .ttf, .otf, .woff2, .woff, .svg) - # Note: This Regexp is available as a shortcut, using the :fonts rule - # - # 5) Font Shortcut - # Provide the :fonts symbol - # :fonts => Uses the Regexp rule stated right above to match all common web font endings - # - # Rule Ordering: - # Rules are applied in the order that they are provided. - # List rather general rules above special ones. - # - # Complete example use case including HTTP header rules: - # - # use Rack::Static, :root => 'public', - # :header_rules => [ - # # Cache all static files in public caches (e.g. Rack::Cache) - # # as well as in the browser - # [:all, {'cache-control' => 'public, max-age=31536000'}], - # - # # Provide web fonts with cross-origin access-control-headers - # # Firefox requires this when serving assets using a Content Delivery Network - # [:fonts, {'access-control-allow-origin' => '*'}] - # ] - # - class Static - def initialize(app, options = {}) - @app = app - @urls = options[:urls] || ["/favicon.ico"] - @index = options[:index] - @gzip = options[:gzip] - @cascade = options[:cascade] - root = options[:root] || Dir.pwd - - # HTTP Headers - @header_rules = options[:header_rules] || [] - # Allow for legacy :cache_control option while prioritizing global header_rules setting - @header_rules.unshift([:all, { CACHE_CONTROL => options[:cache_control] }]) if options[:cache_control] - - @file_server = Rack::Files.new(root) - end - - def add_index_root?(path) - @index && route_file(path) && path.end_with?('/') - end - - def overwrite_file_path(path) - @urls.kind_of?(Hash) && @urls.key?(path) || add_index_root?(path) - end - - def route_file(path) - @urls.kind_of?(Array) && @urls.any? { |url| path.index(url) == 0 } - end - - def can_serve(path) - route_file(path) || overwrite_file_path(path) - end - - def call(env) - path = env[PATH_INFO] - - if can_serve(path) - if overwrite_file_path(path) - env[PATH_INFO] = (add_index_root?(path) ? path + @index : @urls[path]) - elsif @gzip && env['HTTP_ACCEPT_ENCODING'] && /\bgzip\b/.match?(env['HTTP_ACCEPT_ENCODING']) - path = env[PATH_INFO] - env[PATH_INFO] += '.gz' - response = @file_server.call(env) - env[PATH_INFO] = path - - if response[0] == 404 - response = nil - elsif response[0] == 304 - # Do nothing, leave headers as is - else - response[1][CONTENT_TYPE] = Mime.mime_type(::File.extname(path), 'text/plain') - response[1]['content-encoding'] = 'gzip' - end - end - - path = env[PATH_INFO] - response ||= @file_server.call(env) - - if @cascade && response[0] == 404 - return @app.call(env) - end - - headers = response[1] - applicable_rules(path).each do |rule, new_headers| - new_headers.each { |field, content| headers[field] = content } - end - - response - else - @app.call(env) - end - end - - # Convert HTTP header rules to HTTP headers - def applicable_rules(path) - @header_rules.find_all do |rule, new_headers| - case rule - when :all - true - when :fonts - /\.(?:ttf|otf|eot|woff2|woff|svg)\z/.match?(path) - when String - path = ::Rack::Utils.unescape(path) - path.start_with?(rule) || path.start_with?('/' + rule) - when Array - /\.(#{rule.join('|')})\z/.match?(path) - when Regexp - rule.match?(path) - else - false - end - end - end - - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/tempfile_reaper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/tempfile_reaper.rb deleted file mode 100644 index 0b94cc73a157b5..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/tempfile_reaper.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -require_relative 'constants' -require_relative 'body_proxy' - -module Rack - - # Middleware tracks and cleans Tempfiles created throughout a request (i.e. Rack::Multipart) - # Ideas/strategy based on posts by Eric Wong and Charles Oliver Nutter - # https://groups.google.com/forum/#!searchin/rack-devel/temp/rack-devel/brK8eh-MByw/sw61oJJCGRMJ - class TempfileReaper - def initialize(app) - @app = app - end - - def call(env) - env[RACK_TEMPFILES] ||= [] - - begin - _, _, body = response = @app.call(env) - rescue Exception - env[RACK_TEMPFILES]&.each(&:close!) - raise - end - - response[2] = BodyProxy.new(body) do - env[RACK_TEMPFILES]&.each(&:close!) - end - - response - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/urlmap.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/urlmap.rb deleted file mode 100644 index 99c4d82365a298..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/urlmap.rb +++ /dev/null @@ -1,99 +0,0 @@ -# frozen_string_literal: true - -require 'set' - -require_relative 'constants' - -module Rack - # Rack::URLMap takes a hash mapping urls or paths to apps, and - # dispatches accordingly. Support for HTTP/1.1 host names exists if - # the URLs start with http:// or https://. - # - # URLMap modifies the SCRIPT_NAME and PATH_INFO such that the part - # relevant for dispatch is in the SCRIPT_NAME, and the rest in the - # PATH_INFO. This should be taken care of when you need to - # reconstruct the URL in order to create links. - # - # URLMap dispatches in such a way that the longest paths are tried - # first, since they are most specific. - - class URLMap - def initialize(map = {}) - remap(map) - end - - def remap(map) - @known_hosts = Set[] - @mapping = map.map { |location, app| - if location =~ %r{\Ahttps?://(.*?)(/.*)} - host, location = $1, $2 - @known_hosts << host - else - host = nil - end - - unless location[0] == ?/ - raise ArgumentError, "paths need to start with /" - end - - location = location.chomp('/') - match = Regexp.new("^#{Regexp.quote(location).gsub('/', '/+')}(.*)", Regexp::NOENCODING) - - [host, location, match, app] - }.sort_by do |(host, location, _, _)| - [host ? -host.size : Float::INFINITY, -location.size] - end - end - - def call(env) - path = env[PATH_INFO] - script_name = env[SCRIPT_NAME] - http_host = env[HTTP_HOST] - server_name = env[SERVER_NAME] - server_port = env[SERVER_PORT] - - is_same_server = casecmp?(http_host, server_name) || - casecmp?(http_host, "#{server_name}:#{server_port}") - - is_host_known = @known_hosts.include? http_host - - @mapping.each do |host, location, match, app| - unless casecmp?(http_host, host) \ - || casecmp?(server_name, host) \ - || (!host && is_same_server) \ - || (!host && !is_host_known) # If we don't have a matching host, default to the first without a specified host - next - end - - next unless m = match.match(path.to_s) - - rest = m[1] - next unless !rest || rest.empty? || rest[0] == ?/ - - env[SCRIPT_NAME] = (script_name + location) - env[PATH_INFO] = rest - - return app.call(env) - end - - [404, { CONTENT_TYPE => "text/plain", "x-cascade" => "pass" }, ["Not Found: #{path}"]] - - ensure - env[PATH_INFO] = path - env[SCRIPT_NAME] = script_name - end - - private - def casecmp?(v1, v2) - # if both nil, or they're the same string - return true if v1 == v2 - - # if either are nil... (but they're not the same) - return false if v1.nil? - return false if v2.nil? - - # otherwise check they're not case-insensitive the same - v1.casecmp(v2).zero? - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/utils.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/utils.rb deleted file mode 100644 index 99d696dbf47c70..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/utils.rb +++ /dev/null @@ -1,654 +0,0 @@ -# -*- encoding: binary -*- -# frozen_string_literal: true - -require 'uri' -require 'fileutils' -require 'set' -require 'tempfile' -require 'time' - -require_relative 'query_parser' -require_relative 'mime' -require_relative 'headers' -require_relative 'constants' - -module Rack - # Rack::Utils contains a grab-bag of useful methods for writing web - # applications adopted from all kinds of Ruby libraries. - - module Utils - ParameterTypeError = QueryParser::ParameterTypeError - InvalidParameterError = QueryParser::InvalidParameterError - ParamsTooDeepError = QueryParser::ParamsTooDeepError - DEFAULT_SEP = QueryParser::DEFAULT_SEP - COMMON_SEP = QueryParser::COMMON_SEP - KeySpaceConstrainedParams = QueryParser::Params - - class << self - attr_accessor :default_query_parser - end - # The default amount of nesting to allowed by hash parameters. - # This helps prevent a rogue client from triggering a possible stack overflow - # when parsing parameters. - self.default_query_parser = QueryParser.make_default(32) - - module_function - - # URI escapes. (CGI style space to +) - def escape(s) - URI.encode_www_form_component(s) - end - - # Like URI escaping, but with %20 instead of +. Strictly speaking this is - # true URI escaping. - def escape_path(s) - ::URI::DEFAULT_PARSER.escape s - end - - # Unescapes the **path** component of a URI. See Rack::Utils.unescape for - # unescaping query parameters or form components. - def unescape_path(s) - ::URI::DEFAULT_PARSER.unescape s - end - - # Unescapes a URI escaped string with +encoding+. +encoding+ will be the - # target encoding of the string returned, and it defaults to UTF-8 - def unescape(s, encoding = Encoding::UTF_8) - URI.decode_www_form_component(s, encoding) - end - - class << self - attr_accessor :multipart_total_part_limit - - attr_accessor :multipart_file_limit - - # multipart_part_limit is the original name of multipart_file_limit, but - # the limit only counts parts with filenames. - alias multipart_part_limit multipart_file_limit - alias multipart_part_limit= multipart_file_limit= - end - - # The maximum number of file parts a request can contain. Accepting too - # many parts can lead to the server running out of file handles. - # Set to `0` for no limit. - self.multipart_file_limit = (ENV['RACK_MULTIPART_PART_LIMIT'] || ENV['RACK_MULTIPART_FILE_LIMIT'] || 128).to_i - - # The maximum total number of parts a request can contain. Accepting too - # many can lead to excessive memory use and parsing time. - self.multipart_total_part_limit = (ENV['RACK_MULTIPART_TOTAL_PART_LIMIT'] || 4096).to_i - - def self.param_depth_limit - default_query_parser.param_depth_limit - end - - def self.param_depth_limit=(v) - self.default_query_parser = self.default_query_parser.new_depth_limit(v) - end - - def self.key_space_limit - warn("`Rack::Utils.key_space_limit` is deprecated as this value no longer has an effect. It will be removed in Rack 3.1", uplevel: 1) - 65536 - end - - def self.key_space_limit=(v) - warn("`Rack::Utils.key_space_limit=` is deprecated and no longer has an effect. It will be removed in Rack 3.1", uplevel: 1) - end - - if defined?(Process::CLOCK_MONOTONIC) - def clock_time - Process.clock_gettime(Process::CLOCK_MONOTONIC) - end - else - # :nocov: - def clock_time - Time.now.to_f - end - # :nocov: - end - - def parse_query(qs, d = nil, &unescaper) - Rack::Utils.default_query_parser.parse_query(qs, d, &unescaper) - end - - def parse_nested_query(qs, d = nil) - Rack::Utils.default_query_parser.parse_nested_query(qs, d) - end - - def build_query(params) - params.map { |k, v| - if v.class == Array - build_query(v.map { |x| [k, x] }) - else - v.nil? ? escape(k) : "#{escape(k)}=#{escape(v)}" - end - }.join("&") - end - - def build_nested_query(value, prefix = nil) - case value - when Array - value.map { |v| - build_nested_query(v, "#{prefix}[]") - }.join("&") - when Hash - value.map { |k, v| - build_nested_query(v, prefix ? "#{prefix}[#{k}]" : k) - }.delete_if(&:empty?).join('&') - when nil - escape(prefix) - else - raise ArgumentError, "value must be a Hash" if prefix.nil? - "#{escape(prefix)}=#{escape(value)}" - end - end - - def q_values(q_value_header) - q_value_header.to_s.split(/\s*,\s*/).map do |part| - value, parameters = part.split(/\s*;\s*/, 2) - quality = 1.0 - if parameters && (md = /\Aq=([\d.]+)/.match(parameters)) - quality = md[1].to_f - end - [value, quality] - end - end - - def forwarded_values(forwarded_header) - return nil unless forwarded_header - forwarded_header = forwarded_header.to_s.gsub("\n", ";") - - forwarded_header.split(/\s*;\s*/).each_with_object({}) do |field, values| - field.split(/\s*,\s*/).each do |pair| - return nil unless pair =~ /\A\s*(by|for|host|proto)\s*=\s*"?([^"]+)"?\s*\Z/i - (values[$1.downcase.to_sym] ||= []) << $2 - end - end - end - module_function :forwarded_values - - # Return best accept value to use, based on the algorithm - # in RFC 2616 Section 14. If there are multiple best - # matches (same specificity and quality), the value returned - # is arbitrary. - def best_q_match(q_value_header, available_mimes) - values = q_values(q_value_header) - - matches = values.map do |req_mime, quality| - match = available_mimes.find { |am| Rack::Mime.match?(am, req_mime) } - next unless match - [match, quality] - end.compact.sort_by do |match, quality| - (match.split('/', 2).count('*') * -10) + quality - end.last - matches&.first - end - - ESCAPE_HTML = { - "&" => "&", - "<" => "<", - ">" => ">", - "'" => "'", - '"' => """, - "/" => "/" - } - - ESCAPE_HTML_PATTERN = Regexp.union(*ESCAPE_HTML.keys) - - # Escape ampersands, brackets and quotes to their HTML/XML entities. - def escape_html(string) - string.to_s.gsub(ESCAPE_HTML_PATTERN){|c| ESCAPE_HTML[c] } - end - - def select_best_encoding(available_encodings, accept_encoding) - # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html - - expanded_accept_encoding = [] - - accept_encoding.each do |m, q| - preference = available_encodings.index(m) || available_encodings.size - - if m == "*" - (available_encodings - accept_encoding.map(&:first)).each do |m2| - expanded_accept_encoding << [m2, q, preference] - end - else - expanded_accept_encoding << [m, q, preference] - end - end - - encoding_candidates = expanded_accept_encoding - .sort_by { |_, q, p| [-q, p] } - .map!(&:first) - - unless encoding_candidates.include?("identity") - encoding_candidates.push("identity") - end - - expanded_accept_encoding.each do |m, q| - encoding_candidates.delete(m) if q == 0.0 - end - - (encoding_candidates & available_encodings)[0] - end - - # :call-seq: - # parse_cookies_header(value) -> hash - # - # Parse cookies from the provided header +value+ according to RFC6265. The - # syntax for cookie headers only supports semicolons. Returns a map of - # cookie +key+ to cookie +value+. - # - # parse_cookies_header('myname=myvalue; max-age=0') - # # => {"myname"=>"myvalue", "max-age"=>"0"} - # - def parse_cookies_header(value) - return {} unless value - - value.split(/; */n).each_with_object({}) do |cookie, cookies| - next if cookie.empty? - key, value = cookie.split('=', 2) - cookies[key] = (unescape(value) rescue value) unless cookies.key?(key) - end - end - - def add_cookie_to_header(header, key, value) - warn("add_cookie_to_header is deprecated and will be removed in Rack 3.1", uplevel: 1) - - case header - when nil, '' - return set_cookie_header(key, value) - when String - [header, set_cookie_header(key, value)] - when Array - header + [set_cookie_header(key, value)] - else - raise ArgumentError, "Unrecognized cookie header value. Expected String, Array, or nil, got #{header.inspect}" - end - end - - # :call-seq: - # parse_cookies(env) -> hash - # - # Parse cookies from the provided request environment using - # parse_cookies_header. Returns a map of cookie +key+ to cookie +value+. - # - # parse_cookies({'HTTP_COOKIE' => 'myname=myvalue'}) - # # => {'myname' => 'myvalue'} - # - def parse_cookies(env) - parse_cookies_header env[HTTP_COOKIE] - end - - # :call-seq: - # set_cookie_header(key, value) -> encoded string - # - # Generate an encoded string using the provided +key+ and +value+ suitable - # for the +set-cookie+ header according to RFC6265. The +value+ may be an - # instance of either +String+ or +Hash+. - # - # If the cookie +value+ is an instance of +Hash+, it considers the following - # cookie attribute keys: +domain+, +max_age+, +expires+ (must be instance - # of +Time+), +secure+, +http_only+, +same_site+ and +value+. For more - # details about the interpretation of these fields, consult - # [RFC6265 Section 5.2](https://datatracker.ietf.org/doc/html/rfc6265#section-5.2). - # - # An extra cookie attribute +escape_key+ can be provided to control whether - # or not the cookie key is URL encoded. If explicitly set to +false+, the - # cookie key name will not be url encoded (escaped). The default is +true+. - # - # set_cookie_header("myname", "myvalue") - # # => "myname=myvalue" - # - # set_cookie_header("myname", {value: "myvalue", max_age: 10}) - # # => "myname=myvalue; max-age=10" - # - def set_cookie_header(key, value) - case value - when Hash - key = escape(key) unless value[:escape_key] == false - domain = "; domain=#{value[:domain]}" if value[:domain] - path = "; path=#{value[:path]}" if value[:path] - max_age = "; max-age=#{value[:max_age]}" if value[:max_age] - expires = "; expires=#{value[:expires].httpdate}" if value[:expires] - secure = "; secure" if value[:secure] - httponly = "; httponly" if (value.key?(:httponly) ? value[:httponly] : value[:http_only]) - same_site = - case value[:same_site] - when false, nil - nil - when :none, 'None', :None - '; SameSite=None' - when :lax, 'Lax', :Lax - '; SameSite=Lax' - when true, :strict, 'Strict', :Strict - '; SameSite=Strict' - else - raise ArgumentError, "Invalid SameSite value: #{value[:same_site].inspect}" - end - value = value[:value] - else - key = escape(key) - end - - value = [value] unless Array === value - - return "#{key}=#{value.map { |v| escape v }.join('&')}#{domain}" \ - "#{path}#{max_age}#{expires}#{secure}#{httponly}#{same_site}" - end - - # :call-seq: - # set_cookie_header!(headers, key, value) -> header value - # - # Append a cookie in the specified headers with the given cookie +key+ and - # +value+ using set_cookie_header. - # - # If the headers already contains a +set-cookie+ key, it will be converted - # to an +Array+ if not already, and appended to. - def set_cookie_header!(headers, key, value) - if header = headers[SET_COOKIE] - if header.is_a?(Array) - header << set_cookie_header(key, value) - else - headers[SET_COOKIE] = [header, set_cookie_header(key, value)] - end - else - headers[SET_COOKIE] = set_cookie_header(key, value) - end - end - - # :call-seq: - # delete_set_cookie_header(key, value = {}) -> encoded string - # - # Generate an encoded string based on the given +key+ and +value+ using - # set_cookie_header for the purpose of causing the specified cookie to be - # deleted. The +value+ may be an instance of +Hash+ and can include - # attributes as outlined by set_cookie_header. The encoded cookie will have - # a +max_age+ of 0 seconds, an +expires+ date in the past and an empty - # +value+. When used with the +set-cookie+ header, it will cause the client - # to *remove* any matching cookie. - # - # delete_set_cookie_header("myname") - # # => "myname=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT" - # - def delete_set_cookie_header(key, value = {}) - set_cookie_header(key, value.merge(max_age: '0', expires: Time.at(0), value: '')) - end - - def make_delete_cookie_header(header, key, value) - warn("make_delete_cookie_header is deprecated and will be removed in Rack 3.1, use delete_set_cookie_header! instead", uplevel: 1) - - delete_set_cookie_header!(header, key, value) - end - - def delete_cookie_header!(headers, key, value = {}) - headers[SET_COOKIE] = delete_set_cookie_header!(headers[SET_COOKIE], key, value) - - return nil - end - - def add_remove_cookie_to_header(header, key, value = {}) - warn("add_remove_cookie_to_header is deprecated and will be removed in Rack 3.1, use delete_set_cookie_header! instead", uplevel: 1) - - delete_set_cookie_header!(header, key, value) - end - - # :call-seq: - # delete_set_cookie_header!(header, key, value = {}) -> header value - # - # Set an expired cookie in the specified headers with the given cookie - # +key+ and +value+ using delete_set_cookie_header. This causes - # the client to immediately delete the specified cookie. - # - # delete_set_cookie_header!(nil, "mycookie") - # # => "mycookie=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT" - # - # If the header is non-nil, it will be modified in place. - # - # header = [] - # delete_set_cookie_header!(header, "mycookie") - # # => ["mycookie=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT"] - # header - # # => ["mycookie=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT"] - # - def delete_set_cookie_header!(header, key, value = {}) - if header - header = Array(header) - header << delete_set_cookie_header(key, value) - else - header = delete_set_cookie_header(key, value) - end - - return header - end - - def rfc2822(time) - time.rfc2822 - end - - # Parses the "Range:" header, if present, into an array of Range objects. - # Returns nil if the header is missing or syntactically invalid. - # Returns an empty array if none of the ranges are satisfiable. - def byte_ranges(env, size) - get_byte_ranges env['HTTP_RANGE'], size - end - - def get_byte_ranges(http_range, size) - # See - return nil unless http_range && http_range =~ /bytes=([^;]+)/ - ranges = [] - $1.split(/,\s*/).each do |range_spec| - return nil unless range_spec.include?('-') - range = range_spec.split('-') - r0, r1 = range[0], range[1] - if r0.nil? || r0.empty? - return nil if r1.nil? - # suffix-byte-range-spec, represents trailing suffix of file - r0 = size - r1.to_i - r0 = 0 if r0 < 0 - r1 = size - 1 - else - r0 = r0.to_i - if r1.nil? - r1 = size - 1 - else - r1 = r1.to_i - return nil if r1 < r0 # backwards range is syntactically invalid - r1 = size - 1 if r1 >= size - end - end - ranges << (r0..r1) if r0 <= r1 - end - ranges - end - - # :nocov: - if defined?(OpenSSL.fixed_length_secure_compare) - # Constant time string comparison. - # - # NOTE: the values compared should be of fixed length, such as strings - # that have already been processed by HMAC. This should not be used - # on variable length plaintext strings because it could leak length info - # via timing attacks. - def secure_compare(a, b) - return false unless a.bytesize == b.bytesize - - OpenSSL.fixed_length_secure_compare(a, b) - end - # :nocov: - else - def secure_compare(a, b) - return false unless a.bytesize == b.bytesize - - l = a.unpack("C*") - - r, i = 0, -1 - b.each_byte { |v| r |= v ^ l[i += 1] } - r == 0 - end - end - - # Context allows the use of a compatible middleware at different points - # in a request handling stack. A compatible middleware must define - # #context which should take the arguments env and app. The first of which - # would be the request environment. The second of which would be the rack - # application that the request would be forwarded to. - class Context - attr_reader :for, :app - - def initialize(app_f, app_r) - raise 'running context does not respond to #context' unless app_f.respond_to? :context - @for, @app = app_f, app_r - end - - def call(env) - @for.context(env, @app) - end - - def recontext(app) - self.class.new(@for, app) - end - - def context(env, app = @app) - recontext(app).call(env) - end - end - - # A wrapper around Headers - # header when set. - # - # @api private - class HeaderHash < Hash # :nodoc: - def self.[](headers) - warn "Rack::Utils::HeaderHash is deprecated and will be removed in Rack 3.1, switch to Rack::Headers", uplevel: 1 - if headers.is_a?(Headers) && !headers.frozen? - return headers - end - - new_headers = Headers.new - headers.each{|k,v| new_headers[k] = v} - new_headers - end - - def self.new(hash = {}) - warn "Rack::Utils::HeaderHash is deprecated and will be removed in Rack 3.1, switch to Rack::Headers", uplevel: 1 - headers = Headers.new - hash.each{|k,v| headers[k] = v} - headers - end - - def self.allocate - raise TypeError, "cannot allocate HeaderHash" - end - end - - # Every standard HTTP code mapped to the appropriate message. - # Generated with: - # curl -s https://www.iana.org/assignments/http-status-codes/http-status-codes-1.csv | \ - # ruby -ne 'm = /^(\d{3}),(?!Unassigned|\(Unused\))([^,]+)/.match($_) and \ - # puts "#{m[1]} => \x27#{m[2].strip}\x27,"' - HTTP_STATUS_CODES = { - 100 => 'Continue', - 101 => 'Switching Protocols', - 102 => 'Processing', - 103 => 'Early Hints', - 200 => 'OK', - 201 => 'Created', - 202 => 'Accepted', - 203 => 'Non-Authoritative Information', - 204 => 'No Content', - 205 => 'Reset Content', - 206 => 'Partial Content', - 207 => 'Multi-Status', - 208 => 'Already Reported', - 226 => 'IM Used', - 300 => 'Multiple Choices', - 301 => 'Moved Permanently', - 302 => 'Found', - 303 => 'See Other', - 304 => 'Not Modified', - 305 => 'Use Proxy', - 306 => '(Unused)', - 307 => 'Temporary Redirect', - 308 => 'Permanent Redirect', - 400 => 'Bad Request', - 401 => 'Unauthorized', - 402 => 'Payment Required', - 403 => 'Forbidden', - 404 => 'Not Found', - 405 => 'Method Not Allowed', - 406 => 'Not Acceptable', - 407 => 'Proxy Authentication Required', - 408 => 'Request Timeout', - 409 => 'Conflict', - 410 => 'Gone', - 411 => 'Length Required', - 412 => 'Precondition Failed', - 413 => 'Payload Too Large', - 414 => 'URI Too Long', - 415 => 'Unsupported Media Type', - 416 => 'Range Not Satisfiable', - 417 => 'Expectation Failed', - 421 => 'Misdirected Request', - 422 => 'Unprocessable Entity', - 423 => 'Locked', - 424 => 'Failed Dependency', - 425 => 'Too Early', - 426 => 'Upgrade Required', - 428 => 'Precondition Required', - 429 => 'Too Many Requests', - 431 => 'Request Header Fields Too Large', - 451 => 'Unavailable for Legal Reasons', - 500 => 'Internal Server Error', - 501 => 'Not Implemented', - 502 => 'Bad Gateway', - 503 => 'Service Unavailable', - 504 => 'Gateway Timeout', - 505 => 'HTTP Version Not Supported', - 506 => 'Variant Also Negotiates', - 507 => 'Insufficient Storage', - 508 => 'Loop Detected', - 509 => 'Bandwidth Limit Exceeded', - 510 => 'Not Extended', - 511 => 'Network Authentication Required' - } - - # Responses with HTTP status codes that should not have an entity body - STATUS_WITH_NO_ENTITY_BODY = Hash[((100..199).to_a << 204 << 304).product([true])] - - SYMBOL_TO_STATUS_CODE = Hash[*HTTP_STATUS_CODES.map { |code, message| - [message.downcase.gsub(/\s|-|'/, '_').to_sym, code] - }.flatten] - - def status_code(status) - if status.is_a?(Symbol) - SYMBOL_TO_STATUS_CODE.fetch(status) { raise ArgumentError, "Unrecognized status code #{status.inspect}" } - else - status.to_i - end - end - - PATH_SEPS = Regexp.union(*[::File::SEPARATOR, ::File::ALT_SEPARATOR].compact) - - def clean_path_info(path_info) - parts = path_info.split PATH_SEPS - - clean = [] - - parts.each do |part| - next if part.empty? || part == '.' - part == '..' ? clean.pop : clean << part - end - - clean_path = clean.join(::File::SEPARATOR) - clean_path.prepend("/") if parts.empty? || parts.first.empty? - clean_path - end - - NULL_BYTE = "\0" - - def valid_path?(path) - path.valid_encoding? && !path.include?(NULL_BYTE) - end - - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/version.rb deleted file mode 100644 index e634f23aecee4c..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rack-3.0.8/lib/rack/version.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -# Copyright (C) 2007-2019 Leah Neukirchen -# -# Rack is freely distributable under the terms of an MIT-style license. -# See MIT-LICENSE or https://opensource.org/licenses/MIT. - -# The Rack main module, serving as a namespace for all core Rack -# modules and classes. -# -# All modules meant for use in your application are autoloaded here, -# so it should be enough just to require 'rack' in your code. - -module Rack - # The Rack protocol version number implemented. - VERSION = [1, 3].freeze - deprecate_constant :VERSION - - VERSION_STRING = "1.3".freeze - deprecate_constant :VERSION_STRING - - # The Rack protocol version number implemented. - def self.version - warn "Rack.version is deprecated and will be removed in Rack 3.1!", uplevel: 1 - VERSION - end - - RELEASE = "3.0.8" - - # Return the Rack release as a dotted string. - def self.release - RELEASE - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop-capybara.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop-capybara.rb deleted file mode 100644 index 48a638f9d1708c..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop-capybara.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -require 'pathname' -require 'yaml' - -require 'rubocop' - -require_relative 'rubocop/cop/capybara/mixin/capybara_help' -require_relative 'rubocop/cop/capybara/mixin/css_selector' - -require_relative 'rubocop/cop/capybara_cops' - -project_root = File.join(__dir__, '..') -RuboCop::ConfigLoader.inject_defaults!(project_root) -obsoletion = File.join(project_root, 'config', 'obsoletion.yml') -RuboCop::ConfigObsoletion.files << obsoletion if File.exist?(obsoletion) - -RuboCop::Cop::Style::TrailingCommaInArguments.singleton_class.prepend( - Module.new do - def autocorrect_incompatible_with - super.push(RuboCop::Cop::Capybara::CurrentPathExpectation) - end - end -) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/capybara/config_formatter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/capybara/config_formatter.rb deleted file mode 100644 index 5a0848a61f339e..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/capybara/config_formatter.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -require 'yaml' - -module RuboCop - module Capybara - # Builds a YAML config file from two config hashes - class ConfigFormatter - EXTENSION_ROOT_DEPARTMENT = %r{^(Capybara/)}.freeze - SUBDEPARTMENTS = [].freeze - AMENDMENTS = [].freeze - COP_DOC_BASE_URL = 'https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/' - - def initialize(config, descriptions) - @config = config - @descriptions = descriptions - end - - def dump - YAML.dump(unified_config) - .gsub(EXTENSION_ROOT_DEPARTMENT, "\n\\1") - .gsub(/^(\s+)- /, '\1 - ') - .gsub('"~"', '~') - # .gsub(*AMENDMENTS, "\n\\0") - end - - private - - def unified_config - cops.each_with_object(config.dup) do |cop, unified| - next if SUBDEPARTMENTS.include?(cop) || AMENDMENTS.include?(cop) - - replace_nil(unified[cop]) - unified[cop].merge!(descriptions.fetch(cop)) - unified[cop]['Reference'] = reference(cop) - end - end - - def cops - (descriptions.keys | config.keys).grep(EXTENSION_ROOT_DEPARTMENT) - end - - def replace_nil(config) - config.each do |key, value| - config[key] = '~' if value.nil? - end - end - - def reference(cop) - COP_DOC_BASE_URL + cop - end - - attr_reader :config, :descriptions - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/capybara/description_extractor.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/capybara/description_extractor.rb deleted file mode 100644 index 3e9e51bf7dcdca..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/capybara/description_extractor.rb +++ /dev/null @@ -1,70 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Capybara - # Extracts cop descriptions from YARD docstrings - class DescriptionExtractor - def initialize(yardocs) - @code_objects = yardocs.map(&CodeObject.public_method(:new)) - end - - def to_h - code_objects - .select(&:cop?) - .map(&:configuration) - .reduce(:merge) - end - - private - - attr_reader :code_objects - - # Decorator of a YARD code object for working with documented cops - class CodeObject - RUBOCOP_COP_CLASS_NAME = 'RuboCop::Cop::Base' - - def initialize(yardoc) - @yardoc = yardoc - end - - # Test if the YARD code object documents a concrete cop class - # - # @return [Boolean] - def cop? - cop_subclass? && !abstract? - end - - # Configuration for the documented cop that would live in default.yml - # - # @return [Hash] - def configuration - { cop_name => { 'Description' => description } } - end - - private - - def cop_name - Object.const_get(documented_constant).cop_name - end - - def description - yardoc.docstring.split("\n\n").first.to_s - end - - def documented_constant - yardoc.to_s - end - - def cop_subclass? - yardoc.superclass.path == RUBOCOP_COP_CLASS_NAME - end - - def abstract? - yardoc.tags.any? { |tag| tag.tag_name.eql?('abstract') } - end - - attr_reader :yardoc - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/capybara/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/capybara/version.rb deleted file mode 100644 index 94846727a4cfa2..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/capybara/version.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Capybara - # Version information for the Capybara RuboCop plugin. - module Version - STRING = '2.18.0' - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/current_path_expectation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/current_path_expectation.rb deleted file mode 100644 index 5ac7a91150cf0f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/current_path_expectation.rb +++ /dev/null @@ -1,148 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Capybara - # Checks that no expectations are set on Capybara's `current_path`. - # - # The - # https://www.rubydoc.info/github/teamcapybara/capybara/master/Capybara/RSpecMatchers#have_current_path-instance_method[`have_current_path` matcher] - # should be used on `page` to set expectations on Capybara's - # current path, since it uses - # https://github.com/teamcapybara/capybara/blob/master/README.md#asynchronous-javascript-ajax-and-friends[Capybara's waiting functionality] - # which ensures that preceding actions (like `click_link`) have - # completed. - # - # This cop does not support autocorrection in some cases. - # - # @example - # # bad - # expect(current_path).to eq('/callback') - # - # # good - # expect(page).to have_current_path('/callback') - # - # # bad (does not support autocorrection) - # expect(page.current_path).to match(variable) - # - # # good - # expect(page).to have_current_path('/callback') - # - class CurrentPathExpectation < ::RuboCop::Cop::Base - extend AutoCorrector - include RangeHelp - - MSG = 'Do not set an RSpec expectation on `current_path` in ' \ - 'Capybara feature specs - instead, use the ' \ - '`have_current_path` matcher on `page`' - - RESTRICT_ON_SEND = %i[expect].freeze - - # @!method expectation_set_on_current_path(node) - def_node_matcher :expectation_set_on_current_path, <<-PATTERN - (send nil? :expect (send {(send nil? :page) nil?} :current_path)) - PATTERN - - # Supported matchers: eq(...) / match(/regexp/) / match('regexp') - # @!method as_is_matcher(node) - def_node_matcher :as_is_matcher, <<-PATTERN - (send - #expectation_set_on_current_path ${:to :to_not :not_to} - ${(send nil? :eq ...) (send nil? :match (regexp ...))}) - PATTERN - - # @!method regexp_node_matcher(node) - def_node_matcher :regexp_node_matcher, <<-PATTERN - (send - #expectation_set_on_current_path ${:to :to_not :not_to} - $(send nil? :match ${str dstr xstr})) - PATTERN - - def self.autocorrect_incompatible_with - [Style::TrailingCommaInArguments] - end - - def on_send(node) - expectation_set_on_current_path(node) do - add_offense(node.loc.selector) do |corrector| - next unless node.chained? - - autocorrect(corrector, node) - end - end - end - - private - - def autocorrect(corrector, node) - as_is_matcher(node.parent) do |to_sym, matcher_node| - rewrite_expectation(corrector, node, to_sym, matcher_node) - end - - regexp_node_matcher(node.parent) do |to_sym, matcher_node, regexp| - rewrite_expectation(corrector, node, to_sym, matcher_node) - convert_regexp_node_to_literal(corrector, matcher_node, regexp) - end - end - - def rewrite_expectation(corrector, node, to_symbol, matcher_node) - corrector.replace(node.first_argument, 'page') - corrector.replace(node.parent.loc.selector, 'to') - matcher_method = if to_symbol == :to - 'have_current_path' - else - 'have_no_current_path' - end - corrector.replace(matcher_node.loc.selector, matcher_method) - add_argument_parentheses(corrector, matcher_node.first_argument) - add_ignore_query_options(corrector, node) - end - - def convert_regexp_node_to_literal(corrector, matcher_node, regexp_node) - str_node = matcher_node.first_argument - regexp_expr = regexp_node_to_regexp_expr(regexp_node) - corrector.replace(str_node, regexp_expr) - end - - def regexp_node_to_regexp_expr(regexp_node) - if regexp_node.xstr_type? - "/\#{`#{regexp_node.value.value}`}/" - else - Regexp.new(regexp_node.value).inspect - end - end - - def add_argument_parentheses(corrector, arg_node) - return unless method_call_with_no_parentheses?(arg_node) - - first_argument_range = range_with_surrounding_space( - arg_node.first_argument.source_range, side: :left - ) - corrector.insert_before(first_argument_range, '(') - corrector.insert_after(arg_node.last_argument, ')') - end - - def method_call_with_no_parentheses?(arg_node) - arg_node.send_type? && arg_node.arguments? && !arg_node.parenthesized? - end - - # `have_current_path` with no options will include the querystring - # while `page.current_path` does not. - # This ensures the option `ignore_query: true` is added - # except when the expectation is a regexp or string - def add_ignore_query_options(corrector, node) - expectation_node = node.parent.last_argument - expectation_last_child = expectation_node.children.last - return if %i[ - regexp str dstr xstr - ].include?(expectation_last_child.type) - - corrector.insert_after( - expectation_last_child, - ', ignore_query: true' - ) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/match_style.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/match_style.rb deleted file mode 100644 index 1b0e8e13aae27b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/match_style.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Capybara - # Checks for usage of deprecated style methods. - # - # @example when using `assert_style` - # # bad - # page.find(:css, '#first').assert_style(display: 'block') - # - # # good - # page.find(:css, '#first').assert_matches_style(display: 'block') - # - # @example when using `has_style?` - # # bad - # expect(page.find(:css, 'first') - # .has_style?(display: 'block')).to be true - # - # # good - # expect(page.find(:css, 'first') - # .matches_style?(display: 'block')).to be true - # - # @example when using `have_style` - # # bad - # expect(page).to have_style(display: 'block') - # - # # good - # expect(page).to match_style(display: 'block') - # - class MatchStyle < ::RuboCop::Cop::Base - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s`.' - RESTRICT_ON_SEND = %i[assert_style has_style? have_style].freeze - PREFERRED_METHOD = { - 'assert_style' => 'assert_matches_style', - 'has_style?' => 'matches_style?', - 'have_style' => 'match_style' - }.freeze - - def on_send(node) - method_node = node.loc.selector - add_offense(method_node) do |corrector| - corrector.replace(method_node, - PREFERRED_METHOD[method_node.source]) - end - end - - private - - def message(node) - format(MSG, good: PREFERRED_METHOD[node.source], bad: node.source) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/mixin/capybara_help.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/mixin/capybara_help.rb deleted file mode 100644 index d18fab689a1a44..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/mixin/capybara_help.rb +++ /dev/null @@ -1,131 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Capybara - # Help methods for capybara. - # @api private - module CapybaraHelp - COMMON_OPTIONS = %w[ - id class style - ].freeze - SPECIFIC_OPTIONS = { - 'button' => ( - COMMON_OPTIONS + %w[disabled name value title type] - ).freeze, - 'link' => ( - COMMON_OPTIONS + %w[href alt title download] - ).freeze, - 'table' => ( - COMMON_OPTIONS + %w[cols rows] - ).freeze, - 'select' => ( - COMMON_OPTIONS + %w[ - disabled name placeholder - selected multiple - ] - ).freeze, - 'field' => ( - COMMON_OPTIONS + %w[ - checked disabled name placeholder - readonly type multiple - ] - ).freeze - }.freeze - SPECIFIC_PSEUDO_CLASSES = %w[ - not() disabled enabled checked unchecked - ].freeze - - module_function - - # @param node [RuboCop::AST::SendNode] - # @param locator [String] - # @param element [String] - # @return [Boolean] - def replaceable_option?(node, locator, element) - attrs = CssSelector.attributes(locator).keys - return false unless replaceable_element?(node, element, attrs) - - attrs.all? do |attr| - SPECIFIC_OPTIONS.fetch(element, []).include?(attr) - end - end - - # @param selector [String] - # @return [Boolean] - # @example - # common_attributes?('a[focused]') # => true - # common_attributes?('button[focused][visible]') # => true - # common_attributes?('table[id=some-id]') # => true - # common_attributes?('h1[invalid]') # => false - def common_attributes?(selector) - CssSelector.attributes(selector).keys.difference(COMMON_OPTIONS).none? - end - - # @param attrs [Array] - # @return [Boolean] - # @example - # replaceable_attributes?('table[id=some-id]') # => true - # replaceable_attributes?('a[focused]') # => false - def replaceable_attributes?(attrs) - attrs.values.none?(&:nil?) - end - - # @param locator [String] - # @return [Boolean] - def replaceable_pseudo_classes?(locator) - CssSelector.pseudo_classes(locator).all? do |pseudo_class| - replaceable_pseudo_class?(pseudo_class, locator) - end - end - - # @param pseudo_class [String] - # @param locator [String] - # @return [Boolean] - def replaceable_pseudo_class?(pseudo_class, locator) - return false unless SPECIFIC_PSEUDO_CLASSES.include?(pseudo_class) - - case pseudo_class - when 'not()' then replaceable_pseudo_class_not?(locator) - else true - end - end - - # @param locator [String] - # @return [Boolean] - def replaceable_pseudo_class_not?(locator) - locator.scan(/not\(.*?\)/).all? do |negation| - CssSelector.attributes(negation).values.all? do |v| - v.is_a?(TrueClass) || v.is_a?(FalseClass) - end - end - end - - # @param node [RuboCop::AST::SendNode] - # @param element [String] - # @param attrs [Array] - # @return [Boolean] - def replaceable_element?(node, element, attrs) - case element - when 'link' then replaceable_to_link?(node, attrs) - else true - end - end - - # @param node [RuboCop::AST::SendNode] - # @param attrs [Array] - # @return [Boolean] - def replaceable_to_link?(node, attrs) - include_option?(node, :href) || attrs.include?('href') - end - - # @param node [RuboCop::AST::SendNode] - # @param option [Symbol] - # @return [Boolean] - def include_option?(node, option) - node.each_descendant(:sym).find { |opt| opt.value == option } - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/mixin/css_selector.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/mixin/css_selector.rb deleted file mode 100644 index 66b0bfd8ffe818..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/mixin/css_selector.rb +++ /dev/null @@ -1,111 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Capybara - # Helps parsing css selector. - # @api private - module CssSelector - module_function - - # @param selector [String] - # @return [String] - # @example - # id('#some-id') # => some-id - # id('.some-cls') # => nil - # id('#some-id.cls') # => some-id - def id(selector) - return unless id?(selector) - - selector.delete('#').gsub(selector.scan(/[^\\]([>,+~.].*)/).join, '') - end - - # @param selector [String] - # @return [Boolean] - # @example - # id?('#some-id') # => true - # id?('.some-cls') # => false - def id?(selector) - selector.start_with?('#') - end - - # @param selector [String] - # @return [Array] - # @example - # classes('#some-id') # => [] - # classes('.some-cls') # => ['some-cls'] - # classes('#some-id.some-cls') # => ['some-cls'] - # classes('#some-id.cls1.cls2') # => ['cls1', 'cls2'] - def classes(selector) - selector.scan(/\.([\w-]*)/).flatten - end - - # @param selector [String] - # @return [Boolean] - # @example - # attribute?('[attribute]') # => true - # attribute?('attribute') # => false - def attribute?(selector) - selector.start_with?('[') - end - - # @param selector [String] - # @return [Array] - # @example - # attributes('a[foo-bar_baz]') # => {"foo-bar_baz=>nil} - # attributes('button[foo][bar=baz]') # => {"foo"=>nil, "bar"=>"'baz'"} - # attributes('table[foo=bar]') # => {"foo"=>"'bar'"} - def attributes(selector) - # Extract the inner strings of attributes. - # For example, extract the following: - # 'button[foo][bar=baz]' => 'foo][bar=baz' - inside_attributes = selector.scan(/\[(.*)\]/).flatten.join - inside_attributes.split('][').to_h do |attr| - key, value = attr.split('=') - [key, normalize_value(value)] - end - end - - # @param selector [String] - # @return [Array] - # @example - # pseudo_classes('button:not([disabled])') # => ['not()'] - # pseudo_classes('a:enabled:not([valid])') # => ['enabled', 'not()'] - def pseudo_classes(selector) - # Attributes must be excluded or else the colon in the `href`s URL - # will also be picked up as pseudo classes. - # "a:not([href='http://example.com']):enabled" => "a:not():enabled" - ignored_attribute = selector.gsub(/\[.*?\]/, '') - # "a:not():enabled" => ["not()", "enabled"] - ignored_attribute.scan(/:([^:]*)/).flatten - end - - # @param selector [String] - # @return [Boolean] - # @example - # multiple_selectors?('a.cls b#id') # => true - # multiple_selectors?('a.cls') # => false - def multiple_selectors?(selector) - normalize = selector.gsub(/(\\[>,+~]|\(.*\))/, '') - normalize.match?(/[ >,+~]/) - end - - # @param value [String] - # @return [Boolean, String] - # @example - # normalize_value('true') # => true - # normalize_value('false') # => false - # normalize_value(nil) # => nil - # normalize_value("foo") # => "'foo'" - def normalize_value(value) - case value - when 'true' then true - when 'false' then false - when nil then nil - else "'#{value.gsub(/"|'/, '')}'" - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/negation_matcher.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/negation_matcher.rb deleted file mode 100644 index f02afe5fa7fab7..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/negation_matcher.rb +++ /dev/null @@ -1,104 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Capybara - # Enforces use of `have_no_*` or `not_to` for negated expectations. - # - # @example EnforcedStyle: not_to (default) - # # bad - # expect(page).to have_no_selector - # expect(page).to have_no_css('a') - # - # # good - # expect(page).not_to have_selector - # expect(page).not_to have_css('a') - # - # @example EnforcedStyle: have_no - # # bad - # expect(page).not_to have_selector - # expect(page).not_to have_css('a') - # - # # good - # expect(page).to have_no_selector - # expect(page).to have_no_css('a') - # - class NegationMatcher < ::RuboCop::Cop::Base - extend AutoCorrector - include ConfigurableEnforcedStyle - - MSG = 'Use `expect(...).%s %s`.' - CAPYBARA_MATCHERS = %w[ - selector css xpath text title current_path link button - field checked_field unchecked_field select table - sibling ancestor content - ].freeze - POSITIVE_MATCHERS = - Set.new(CAPYBARA_MATCHERS) { |element| :"have_#{element}" }.freeze - NEGATIVE_MATCHERS = - Set.new(CAPYBARA_MATCHERS) { |element| :"have_no_#{element}" } - .freeze - RESTRICT_ON_SEND = (POSITIVE_MATCHERS + NEGATIVE_MATCHERS).freeze - - # @!method not_to?(node) - def_node_matcher :not_to?, <<~PATTERN - (send ... :not_to - (send nil? %POSITIVE_MATCHERS ...)) - PATTERN - - # @!method have_no?(node) - def_node_matcher :have_no?, <<~PATTERN - (send ... :to - (send nil? %NEGATIVE_MATCHERS ...)) - PATTERN - - def on_send(node) - return unless offense?(node.parent) - - matcher = node.method_name.to_s - add_offense(offense_range(node), - message: message(matcher)) do |corrector| - corrector.replace(node.parent.loc.selector, replaced_runner) - corrector.replace(node.loc.selector, - replaced_matcher(matcher)) - end - end - - private - - def offense?(node) - (style == :have_no && not_to?(node)) || - (style == :not_to && have_no?(node)) - end - - def offense_range(node) - node.parent.loc.selector.with(end_pos: node.loc.selector.end_pos) - end - - def message(matcher) - format(MSG, - runner: replaced_runner, - matcher: replaced_matcher(matcher)) - end - - def replaced_runner - case style - when :have_no - 'to' - when :not_to - 'not_to' - end - end - - def replaced_matcher(matcher) - case style - when :have_no - matcher.sub('have_', 'have_no_') - when :not_to - matcher.sub('have_no_', 'have_') - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/specific_actions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/specific_actions.rb deleted file mode 100644 index 01afbe6b13cacb..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/specific_actions.rb +++ /dev/null @@ -1,93 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Capybara - # Checks for there is a more specific actions offered by Capybara. - # - # @example - # - # # bad - # find('a').click - # find('button.cls').click - # find('a', exact_text: 'foo').click - # find('div button').click - # - # # good - # click_link - # click_button(class: 'cls') - # click_link(exact_text: 'foo') - # find('div').click_button - # - class SpecificActions < ::RuboCop::Cop::Base - MSG = "Prefer `%s` over `find('%s').click`." - RESTRICT_ON_SEND = %i[click].freeze - SPECIFIC_ACTION = { - 'button' => 'button', - 'a' => 'link' - }.freeze - - # @!method click_on_selector(node) - def_node_matcher :click_on_selector, <<-PATTERN - (send _ :find (str $_) ...) - PATTERN - - def on_send(node) - click_on_selector(node.receiver) do |arg| - next unless supported_selector?(arg) - # Always check the last selector in the case of multiple selectors - # separated by whitespace. - # because the `.click` is executed on the element to - # which the last selector points. - next unless (selector = last_selector(arg)) - next unless (action = specific_action(selector)) - next unless replaceable?(node, arg, action) - - range = offense_range(node, node.receiver) - add_offense(range, message: message(action, selector)) - end - end - - private - - def specific_action(selector) - SPECIFIC_ACTION[last_selector(selector)] - end - - def replaceable?(node, arg, action) - replaceable_attributes?(arg) && - CapybaraHelp.replaceable_option?(node.receiver, arg, action) && - CapybaraHelp.replaceable_pseudo_classes?(arg) - end - - def replaceable_attributes?(selector) - CapybaraHelp.replaceable_attributes?( - CssSelector.attributes(selector) - ) - end - - def supported_selector?(selector) - !selector.match?(/[>,+~]/) - end - - def last_selector(arg) - arg.split.last[/^\w+/, 0] - end - - def offense_range(node, receiver) - receiver.loc.selector.with(end_pos: node.source_range.end_pos) - end - - def message(action, selector) - format(MSG, - good_action: good_action(action), - selector: selector) - end - - def good_action(action) - "click_#{action}" - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/specific_finders.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/specific_finders.rb deleted file mode 100644 index 95d4ae7793f6b5..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/specific_finders.rb +++ /dev/null @@ -1,126 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Capybara - # Checks if there is a more specific finder offered by Capybara. - # - # @example - # # bad - # find('#some-id') - # find('[visible][id=some-id]') - # - # # good - # find_by_id('some-id') - # find_by_id('some-id', visible: true) - # - class SpecificFinders < ::RuboCop::Cop::Base - extend AutoCorrector - - include RangeHelp - - MSG = 'Prefer `find_by_id` over `find`.' - RESTRICT_ON_SEND = %i[find].freeze - - # @!method find_argument(node) - def_node_matcher :find_argument, <<~PATTERN - (send _ :find (str $_) ...) - PATTERN - - # @!method class_options(node) - def_node_search :class_options, <<~PATTERN - (pair (sym :class) $_ ...) - PATTERN - - def on_send(node) - find_argument(node) do |arg| - next if CssSelector.pseudo_classes(arg).any? - next if CssSelector.multiple_selectors?(arg) - - on_attr(node, arg) if attribute?(arg) - on_id(node, arg) if CssSelector.id?(arg) - end - end - - private - - def on_attr(node, arg) - attrs = CssSelector.attributes(arg) - return unless (id = attrs['id']) - return if attrs['class'] - - register_offense(node, replaced_arguments(arg, id)) - end - - def on_id(node, arg) - return if CssSelector.attributes(arg).any? - - id = CssSelector.id(arg) - register_offense(node, "'#{id}'", - CssSelector.classes(arg.sub("##{id}", ''))) - end - - def attribute?(arg) - CssSelector.attribute?(arg) && - CapybaraHelp.common_attributes?(arg) - end - - def register_offense(node, id, classes = []) - add_offense(offense_range(node)) do |corrector| - corrector.replace(node.loc.selector, 'find_by_id') - corrector.replace(node.first_argument, - id.delete('\\')) - unless classes.compact.empty? - autocorrect_classes(corrector, node, classes) - end - end - end - - def autocorrect_classes(corrector, node, classes) - if (options = class_options(node).first) - append_options(classes, options) - corrector.replace(options, classes.to_s) - else - corrector.insert_after(node.first_argument, - keyword_argument_class(classes)) - end - end - - def append_options(classes, options) - classes << options.value if options.str_type? - options.each_value { |v| classes << v.value } if options.array_type? - end - - def keyword_argument_class(classes) - value = classes.size > 1 ? classes.to_s : "'#{classes.first}'" - ", class: #{value}" - end - - def replaced_arguments(arg, id) - options = to_options(CssSelector.attributes(arg)) - options.empty? ? id : "#{id}, #{options}" - end - - def to_options(attrs) - attrs.each.map do |key, value| - next if key == 'id' - - "#{key}: #{value}" - end.compact.join(', ') - end - - def offense_range(node) - range_between(node.loc.selector.begin_pos, end_pos(node)) - end - - def end_pos(node) - if node.loc.end - node.loc.end.end_pos - else - node.source_range.end_pos - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/specific_matcher.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/specific_matcher.rb deleted file mode 100644 index b99e977ba6d72d..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/specific_matcher.rb +++ /dev/null @@ -1,88 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Capybara - # Checks for there is a more specific matcher offered by Capybara. - # - # @example - # - # # bad - # expect(page).to have_selector('button') - # expect(page).to have_no_selector('button.cls') - # expect(page).to have_css('button') - # expect(page).to have_no_css('a.cls', href: 'http://example.com') - # expect(page).to have_css('table.cls') - # expect(page).to have_css('select') - # expect(page).to have_css('input', exact_text: 'foo') - # - # # good - # expect(page).to have_button - # expect(page).to have_no_button(class: 'cls') - # expect(page).to have_button - # expect(page).to have_no_link('foo', class: 'cls', href: 'http://example.com') - # expect(page).to have_table(class: 'cls') - # expect(page).to have_select - # expect(page).to have_field('foo') - # - class SpecificMatcher < ::RuboCop::Cop::Base - MSG = 'Prefer `%s` over `%s`.' - RESTRICT_ON_SEND = %i[have_selector have_no_selector have_css - have_no_css].freeze - SPECIFIC_MATCHER = { - 'button' => 'button', - 'a' => 'link', - 'table' => 'table', - 'select' => 'select', - 'input' => 'field' - }.freeze - - # @!method first_argument(node) - def_node_matcher :first_argument, <<-PATTERN - (send nil? _ (str $_) ... ) - PATTERN - - def on_send(node) - first_argument(node) do |arg| - next unless (matcher = specific_matcher(arg)) - next if CssSelector.multiple_selectors?(arg) - next unless replaceable?(node, arg, matcher) - - add_offense(node, message: message(node, matcher)) - end - end - - private - - def specific_matcher(arg) - splitted_arg = arg[/^\w+/, 0] - SPECIFIC_MATCHER[splitted_arg] - end - - def replaceable?(node, arg, matcher) - replaceable_attributes?(arg) && - CapybaraHelp.replaceable_option?(node, arg, matcher) && - CapybaraHelp.replaceable_pseudo_classes?(arg) - end - - def replaceable_attributes?(selector) - CapybaraHelp.replaceable_attributes?( - CssSelector.attributes(selector) - ) - end - - def message(node, matcher) - format(MSG, - good_matcher: good_matcher(node, matcher), - bad_matcher: node.method_name) - end - - def good_matcher(node, matcher) - node.method_name - .to_s - .gsub(/selector|css/, matcher.to_s) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/visibility_matcher.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/visibility_matcher.rb deleted file mode 100644 index c06e38a8d6f8cc..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara/visibility_matcher.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Capybara - # Checks for boolean visibility in Capybara finders. - # - # Capybara lets you find elements that match a certain visibility using - # the `:visible` option. `:visible` accepts both boolean and symbols as - # values, however using booleans can have unwanted effects. `visible: - # false` does not find just invisible elements, but both visible and - # invisible elements. For expressiveness and clarity, use one of the - # symbol values, `:all`, `:hidden` or `:visible`. - # Read more in - # https://www.rubydoc.info/gems/capybara/Capybara%2FNode%2FFinders:all[the documentation]. - # - # @example - # # bad - # expect(page).to have_selector('.foo', visible: false) - # expect(page).to have_css('.foo', visible: true) - # expect(page).to have_link('my link', visible: false) - # - # # good - # expect(page).to have_selector('.foo', visible: :visible) - # expect(page).to have_css('.foo', visible: :all) - # expect(page).to have_link('my link', visible: :hidden) - # - class VisibilityMatcher < ::RuboCop::Cop::Base - MSG_FALSE = 'Use `:all` or `:hidden` instead of `false`.' - MSG_TRUE = 'Use `:visible` instead of `true`.' - CAPYBARA_MATCHER_METHODS = %w[ - button - checked_field - css - field - link - select - selector - table - unchecked_field - xpath - ].flat_map do |element| - ["have_#{element}".to_sym, "have_no_#{element}".to_sym] - end - - RESTRICT_ON_SEND = CAPYBARA_MATCHER_METHODS - - # @!method visible_true?(node) - def_node_matcher :visible_true?, <<~PATTERN - (send nil? #capybara_matcher? ... (hash <$(pair (sym :visible) true) ...>)) - PATTERN - - # @!method visible_false?(node) - def_node_matcher :visible_false?, <<~PATTERN - (send nil? #capybara_matcher? ... (hash <$(pair (sym :visible) false) ...>)) - PATTERN - - def on_send(node) - visible_false?(node) { |arg| add_offense(arg, message: MSG_FALSE) } - visible_true?(node) { |arg| add_offense(arg, message: MSG_TRUE) } - end - - private - - def capybara_matcher?(method_name) - CAPYBARA_MATCHER_METHODS.include? method_name - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara_cops.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara_cops.rb deleted file mode 100644 index 5166e6e7ea46c7..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-capybara-2.18.0/lib/rubocop/cop/capybara_cops.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -require_relative 'capybara/current_path_expectation' -require_relative 'capybara/match_style' -require_relative 'capybara/negation_matcher' -require_relative 'capybara/specific_actions' -require_relative 'capybara/specific_finders' -require_relative 'capybara/specific_matcher' -require_relative 'capybara/visibility_matcher' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/default.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/default.yml deleted file mode 100644 index 6993c89521caf8..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/default.yml +++ /dev/null @@ -1,367 +0,0 @@ -# This is the default configuration file. - -Performance: - Enabled: true - DocumentationBaseURL: https://docs.rubocop.org/rubocop-performance - -Performance/AncestorsInclude: - Description: 'Use `A <= B` instead of `A.ancestors.include?(B)`.' - Reference: 'https://github.com/JuanitoFatas/fast-ruby#ancestorsinclude-vs--code' - Enabled: 'pending' - Safe: false - VersionAdded: '1.7' - -Performance/ArraySemiInfiniteRangeSlice: - Description: 'Identifies places where slicing arrays with semi-infinite ranges can be replaced by `Array#take` and `Array#drop`.' - # This cop was created due to a mistake in microbenchmark. - # Refer https://github.com/rubocop/rubocop-performance/pull/175#issuecomment-731892717 - Enabled: false - # Unsafe for string slices because strings do not have `#take` and `#drop` methods. - Safe: false - VersionAdded: '1.9' - -Performance/BigDecimalWithNumericArgument: - Description: 'Convert numeric literal to string and pass it to `BigDecimal`.' - Enabled: 'pending' - VersionAdded: '1.7' - -Performance/BindCall: - Description: 'Use `bind_call(obj, args, ...)` instead of `bind(obj).call(args, ...)`.' - Enabled: true - VersionAdded: '1.6' - -Performance/BlockGivenWithExplicitBlock: - Description: 'Check block argument explicitly instead of using `block_given?`.' - Enabled: pending - VersionAdded: '1.9' - -Performance/Caller: - Description: >- - Use `caller(n..n)` instead of `caller`. - Enabled: true - VersionAdded: '0.49' - VersionChanged: '1.9' - -Performance/CaseWhenSplat: - Description: >- - Reordering `when` conditions with a splat to the end - of the `when` branches can improve performance. - Enabled: false - SafeAutoCorrect: false - VersionAdded: '0.34' - VersionChanged: '1.13' - -Performance/Casecmp: - Description: >- - Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`.. - Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code' - Enabled: true - Safe: false - VersionAdded: '0.36' - -Performance/ChainArrayAllocation: - Description: >- - Instead of chaining array methods that allocate new arrays, mutate an - existing array. - Reference: 'https://twitter.com/schneems/status/1034123879978029057' - Enabled: false - VersionAdded: '0.59' - -Performance/CollectionLiteralInLoop: - Description: 'Extract Array and Hash literals outside of loops into local variables or constants.' - Enabled: 'pending' - VersionAdded: '1.8' - # Min number of elements to consider an offense - MinSize: 1 - -Performance/CompareWithBlock: - Description: 'Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.' - Enabled: true - VersionAdded: '0.46' - -Performance/ConcurrentMonotonicTime: - Description: 'Use `Process.clock_gettime(Process::CLOCK_MONOTONIC)` instead of `Concurrent.monotonic_time`.' - Reference: 'https://github.com/rails/rails/pull/43502' - Enabled: pending - VersionAdded: '1.12' - -Performance/ConstantRegexp: - Description: 'Finds regular expressions with dynamic components that are all constants.' - Enabled: pending - VersionAdded: '1.9' - VersionChanged: '1.10' - -Performance/Count: - Description: >- - Use `count` instead of `{select,find_all,filter,reject}...{size,count,length}`. - # This cop has known compatibility issues with `ActiveRecord` and other - # frameworks. ActiveRecord's `count` ignores the block that is passed to it. - # For more information, see the documentation in the cop itself. - SafeAutoCorrect: false - Enabled: true - VersionAdded: '0.31' - VersionChanged: '1.8' - -Performance/DeletePrefix: - Description: 'Use `delete_prefix` instead of `gsub`.' - Enabled: true - Safe: false - SafeMultiline: true - VersionAdded: '1.6' - VersionChanged: '1.11' - -Performance/DeleteSuffix: - Description: 'Use `delete_suffix` instead of `gsub`.' - Enabled: true - Safe: false - SafeMultiline: true - VersionAdded: '1.6' - VersionChanged: '1.11' - -Performance/Detect: - Description: >- - Use `detect` instead of `select.first`, `find_all.first`, `filter.first`, - `select.last`, `find_all.last`, and `filter.last`. - Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code' - # This cop has known compatibility issues with `ActiveRecord` and other - # frameworks. `ActiveRecord` does not implement a `detect` method and `find` - # has its own meaning. Correcting `ActiveRecord` methods with this cop - # should be considered unsafe. - SafeAutoCorrect: false - Enabled: true - VersionAdded: '0.30' - VersionChanged: '1.8' - -Performance/DoubleStartEndWith: - Description: >- - Use `str.{start,end}_with?(x, ..., y, ...)` - instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`. - Enabled: true - VersionAdded: '0.36' - VersionChanged: '0.48' - # Used to check for `starts_with?` and `ends_with?`. - # These methods are defined by Active Support. - IncludeActiveSupportAliases: false - -Performance/EndWith: - Description: 'Use `end_with?` instead of a regex match anchored to the end of a string.' - Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end' - # This will change to a new method call which isn't guaranteed to be on the - # object. Switching these methods has to be done with knowledge of the types - # of the variables which rubocop doesn't have. - SafeAutoCorrect: false - Enabled: true - SafeMultiline: true - VersionAdded: '0.36' - VersionChanged: '1.10' - -Performance/FixedSize: - Description: 'Do not compute the size of statically sized objects except in constants.' - Enabled: true - VersionAdded: '0.35' - -Performance/FlatMap: - Description: >- - Use `Enumerable#flat_map` - instead of `Enumerable#map...Array#flatten(1)` - or `Enumerable#collect..Array#flatten(1)`. - Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code' - Enabled: true - VersionAdded: '0.30' - EnabledForFlattenWithoutParams: false - # If enabled, this cop will warn about usages of - # `flatten` being called without any parameters. - # This can be dangerous since `flat_map` will only flatten 1 level, and - # `flatten` without any parameters can flatten multiple levels. - -Performance/InefficientHashSearch: - Description: 'Use `key?` or `value?` instead of `keys.include?` or `values.include?`.' - Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashkey-instead-of-hashkeysinclude-code' - Enabled: true - VersionAdded: '0.56' - Safe: false - -Performance/IoReadlines: - Description: 'Use `IO.each_line` (`IO#each_line`) instead of `IO.readlines` (`IO#readlines`).' - Reference: 'https://docs.gitlab.com/ee/development/performance.html#reading-from-files-and-other-data-sources' - Enabled: false - VersionAdded: '1.7' - -Performance/MapCompact: - Description: 'Use `filter_map` instead of `collection.map(&:do_something).compact`.' - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '1.11' - -Performance/MethodObjectAsBlock: - Description: 'Use block explicitly instead of block-passing a method object.' - Reference: 'https://github.com/JuanitoFatas/fast-ruby#normal-way-to-apply-method-vs-method-code' - Enabled: pending - VersionAdded: '1.9' - -Performance/OpenStruct: - Description: 'Use `Struct` instead of `OpenStruct`.' - Enabled: false - VersionAdded: '0.61' - Safe: false - -Performance/RangeInclude: - Description: 'Use `Range#cover?` instead of `Range#include?` (or `Range#member?`).' - Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code' - Enabled: true - VersionAdded: '0.36' - VersionChanged: '1.7' - Safe: false - -Performance/RedundantBlockCall: - Description: 'Use `yield` instead of `block.call`.' - Reference: 'https://github.com/JuanitoFatas/fast-ruby#proccall-and-block-arguments-vs-yieldcode' - Enabled: true - VersionAdded: '0.36' - -Performance/RedundantEqualityComparisonBlock: - Description: >- - Checks for uses `Enumerable#all?`, `Enumerable#any?`, `Enumerable#one?`, - or `Enumerable#none?` are compared with `===` or similar methods in block. - Reference: 'https://github.com/rails/rails/pull/41363' - Enabled: pending - Safe: false - AllowRegexpMatch: true - VersionAdded: '1.10' - -Performance/RedundantMatch: - Description: >- - Use `=~` instead of `String#match` or `Regexp#match` in a context where the - returned `MatchData` is not needed. - Enabled: true - VersionAdded: '0.36' - -Performance/RedundantMerge: - Description: 'Use Hash#[]=, rather than Hash#merge! with a single key-value pair.' - Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code' - Enabled: true - Safe: false - VersionAdded: '0.36' - VersionChanged: '1.11' - # Max number of key-value pairs to consider an offense - MaxKeyValuePairs: 2 - -Performance/RedundantSortBlock: - Description: 'Use `sort` instead of `sort { |a, b| a <=> b }`.' - Enabled: 'pending' - VersionAdded: '1.7' - -Performance/RedundantSplitRegexpArgument: - Description: 'Identifies places where `split` argument can be replaced from a deterministic regexp to a string.' - Enabled: pending - VersionAdded: '1.10' - -Performance/RedundantStringChars: - Description: 'Checks for redundant `String#chars`.' - Enabled: 'pending' - VersionAdded: '1.7' - -Performance/RegexpMatch: - Description: >- - Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`, - `Regexp#===`, or `=~` when `MatchData` is not used. - Reference: 'https://github.com/JuanitoFatas/fast-ruby#regexp-vs-stringmatch-vs-string-vs-stringmatch-code-' - Enabled: true - VersionAdded: '0.47' - -Performance/ReverseEach: - Description: 'Use `reverse_each` instead of `reverse.each`.' - Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code' - Enabled: true - VersionAdded: '0.30' - -Performance/ReverseFirst: - Description: 'Use `last(n).reverse` instead of `reverse.first(n)`.' - Enabled: 'pending' - VersionAdded: '1.7' - -Performance/SelectMap: - Description: 'Use `filter_map` instead of `ary.select(&:foo).map(&:bar)`.' - Enabled: false - VersionAdded: '1.11' - -Performance/Size: - Description: >- - Use `size` instead of `count` for counting - the number of elements in `Array` and `Hash`. - Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code' - Enabled: true - VersionAdded: '0.30' - -Performance/SortReverse: - Description: 'Use `sort.reverse` instead of `sort { |a, b| b <=> a }`.' - Enabled: 'pending' - VersionAdded: '1.7' - -Performance/Squeeze: - Description: "Use `squeeze('a')` instead of `gsub(/a+/, 'a')`." - Reference: 'https://github.com/JuanitoFatas/fast-ruby#remove-extra-spaces-or-other-contiguous-characters-code' - Enabled: 'pending' - VersionAdded: '1.7' - -Performance/StartWith: - Description: 'Use `start_with?` instead of a regex match anchored to the beginning of a string.' - Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end' - # This will change to a new method call which isn't guaranteed to be on the - # object. Switching these methods has to be done with knowledge of the types - # of the variables which rubocop doesn't have. - SafeAutoCorrect: false - Enabled: true - SafeMultiline: true - VersionAdded: '0.36' - VersionChanged: '1.10' - -Performance/StringIdentifierArgument: - Description: 'Use symbol identifier argument instead of string identifier argument.' - Enabled: pending - VersionAdded: '1.13' - -Performance/StringInclude: - Description: 'Use `String#include?` instead of a regex match with literal-only pattern.' - Enabled: 'pending' - SafeAutoCorrect: false - VersionAdded: '1.7' - VersionChanged: '1.12' - -Performance/StringReplacement: - Description: >- - Use `tr` instead of `gsub` when you are replacing the same - number of characters. Use `delete` instead of `gsub` when - you are deleting characters. - Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code' - Enabled: true - VersionAdded: '0.33' - -Performance/Sum: - Description: 'Use `sum` instead of a custom array summation.' - SafeAutoCorrect: false - Reference: 'https://blog.bigbinary.com/2016/11/02/ruby-2-4-introduces-enumerable-sum.html' - Enabled: 'pending' - VersionAdded: '1.8' - VersionChanged: '1.13' - OnlySumOrWithInitialValue: false - -Performance/TimesMap: - Description: 'Checks for .times.map calls.' - Enabled: true - # See https://github.com/rubocop/rubocop/issues/4658 - SafeAutoCorrect: false - VersionAdded: '0.36' - VersionChanged: '1.13' - -Performance/UnfreezeString: - Description: 'Use unary plus to get an unfrozen string literal.' - Enabled: true - SafeAutoCorrect: false - VersionAdded: '0.50' - VersionChanged: '1.9' - -Performance/UriDefaultParser: - Description: 'Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.' - Enabled: true - VersionAdded: '0.50' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/obsoletion.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/obsoletion.yml deleted file mode 100644 index 2aade6c4135d10..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/obsoletion.yml +++ /dev/null @@ -1,7 +0,0 @@ -# -# Configuration for obsoletion. -# -# See: https://docs.rubocop.org/rubocop/extensions.html#config-obsoletions -# -extracted: - Performance/*: ~ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop-performance.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop-performance.rb deleted file mode 100644 index d7865b5453bb34..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop-performance.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -require 'rubocop' - -require_relative 'rubocop/performance' -require_relative 'rubocop/performance/version' -require_relative 'rubocop/performance/inject' - -RuboCop::Performance::Inject.defaults! - -require_relative 'rubocop/cop/performance_cops' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/mixin/regexp_metacharacter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/mixin/regexp_metacharacter.rb deleted file mode 100644 index e1f543b8c59efc..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/mixin/regexp_metacharacter.rb +++ /dev/null @@ -1,76 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - # Common functionality for handling regexp metacharacters. - module RegexpMetacharacter - private - - def literal_at_start?(regexp) - return true if literal_at_start_with_backslash_a?(regexp) - - !safe_multiline? && literal_at_start_with_caret?(regexp) - end - - def literal_at_end?(regexp) - return true if literal_at_end_with_backslash_z?(regexp) - - !safe_multiline? && literal_at_end_with_dollar?(regexp) - end - - def literal_at_start_with_backslash_a?(regex_str) - # is this regexp 'literal' in the sense of only matching literal - # chars, rather than using metachars like `.` and `*` and so on? - # also, is it anchored at the start of the string? - # (tricky: \s, \d, and so on are metacharacters, but other characters - # escaped with a slash are just literals. LITERAL_REGEX takes all - # that into account.) - /\A\\A(?:#{Util::LITERAL_REGEX})+\z/o.match?(regex_str) - end - - def literal_at_start_with_caret?(regex_str) - # is this regexp 'literal' in the sense of only matching literal - # chars, rather than using metachars like `.` and `*` and so on? - # also, is it anchored at the start of the string? - # (tricky: \s, \d, and so on are metacharacters, but other characters - # escaped with a slash are just literals. LITERAL_REGEX takes all - # that into account.) - /\A\^(?:#{Util::LITERAL_REGEX})+\z/o.match?(regex_str) - end - - def literal_at_end_with_backslash_z?(regex_str) - # is this regexp 'literal' in the sense of only matching literal - # chars, rather than using metachars like . and * and so on? - # also, is it anchored at the end of the string? - /\A(?:#{Util::LITERAL_REGEX})+\\z\z/o.match?(regex_str) - end - - def literal_at_end_with_dollar?(regex_str) - # is this regexp 'literal' in the sense of only matching literal - # chars, rather than using metachars like . and * and so on? - # also, is it anchored at the end of the string? - /\A(?:#{Util::LITERAL_REGEX})+\$\z/o.match?(regex_str) - end - - def drop_start_metacharacter(regexp_string) - if regexp_string.start_with?('\\A') - regexp_string[2..] # drop `\A` anchor - else - regexp_string[1..] # drop `^` anchor - end - end - - def drop_end_metacharacter(regexp_string) - if regexp_string.end_with?('\\z') - regexp_string.chomp('\z') # drop `\z` anchor - else - regexp_string.chop # drop `$` anchor - end - end - - def safe_multiline? - cop_config.fetch('SafeMultiline', true) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/mixin/sort_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/mixin/sort_block.rb deleted file mode 100644 index cc62dc16832028..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/mixin/sort_block.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - # Common functionality for cops checking `Enumerable#sort` blocks. - module SortBlock - extend NodePattern::Macros - include RangeHelp - - def_node_matcher :sort_with_block?, <<~PATTERN - (block - $(send _ :sort) - (args (arg $_a) (arg $_b)) - $send) - PATTERN - - def_node_matcher :sort_with_numblock?, <<~PATTERN - (numblock - $(send _ :sort) - $_arg_count - $send) - PATTERN - - def_node_matcher :replaceable_body?, <<~PATTERN - (send (lvar %1) :<=> (lvar %2)) - PATTERN - - private - - def sort_range(send, node) - range_between(send.loc.selector.begin_pos, node.loc.end.end_pos) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/ancestors_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/ancestors_include.rb deleted file mode 100644 index a65db86b0cd7b8..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/ancestors_include.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies usages of `ancestors.include?` and change them to use `<=` instead. - # - # @safety - # This cop is unsafe because it can't tell whether the receiver is a class or an object. - # e.g. the false positive was for `Nokogiri::XML::Node#ancestors`. - # - # @example - # # bad - # A.ancestors.include?(B) - # - # # good - # A <= B - # - class AncestorsInclude < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Use `<=` instead of `ancestors.include?`.' - RESTRICT_ON_SEND = %i[include?].freeze - - def_node_matcher :ancestors_include_candidate?, <<~PATTERN - (send (send $_subclass :ancestors) :include? $_superclass) - PATTERN - - def on_send(node) - return unless (subclass, superclass = ancestors_include_candidate?(node)) - return if subclass && !subclass.const_type? - - add_offense(range(node)) do |corrector| - subclass_source = subclass ? subclass.source : 'self' - - corrector.replace(node, "#{subclass_source} <= #{superclass.source}") - end - end - - private - - def range(node) - location_of_ancestors = node.children[0].loc.selector.begin_pos - end_location = node.loc.selector.end_pos - - range_between(location_of_ancestors, end_location) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb deleted file mode 100644 index a81b40f132f148..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb +++ /dev/null @@ -1,79 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where slicing arrays with semi-infinite ranges - # can be replaced by `Array#take` and `Array#drop`. - # This cop was created due to a mistake in microbenchmark and hence is disabled by default. - # Refer https://github.com/rubocop/rubocop-performance/pull/175#issuecomment-731892717 - # - # @safety - # This cop is unsafe for string slices because strings do not have `#take` and `#drop` methods. - # - # @example - # # bad - # array[..2] - # array[...2] - # array[2..] - # array[2...] - # array.slice(..2) - # - # # good - # array.take(3) - # array.take(2) - # array.drop(2) - # array.drop(2) - # array.take(3) - # - class ArraySemiInfiniteRangeSlice < Base - include RangeHelp - extend AutoCorrector - extend TargetRubyVersion - - minimum_target_ruby_version 2.7 - - MSG = 'Use `%s` instead of `%s` with semi-infinite range.' - - SLICE_METHODS = Set[:[], :slice].freeze - RESTRICT_ON_SEND = SLICE_METHODS - - def_node_matcher :endless_range_slice?, <<~PATTERN - (send $_ $%SLICE_METHODS $#endless_range?) - PATTERN - - def_node_matcher :endless_range?, <<~PATTERN - { - ({irange erange} nil? (int positive?)) - ({irange erange} (int positive?) nil?) - } - PATTERN - - def on_send(node) - endless_range_slice?(node) do |receiver, method_name, range_node| - prefer = range_node.begin ? :drop : :take - message = format(MSG, prefer: prefer, current: method_name) - - add_offense(node, message: message) do |corrector| - corrector.replace(node, correction(receiver, range_node)) - end - end - end - - private - - def correction(receiver, range_node) - method_call = if range_node.begin - "drop(#{range_node.begin.value})" - elsif range_node.irange_type? - "take(#{range_node.end.value + 1})" - else - "take(#{range_node.end.value})" - end - - "#{receiver.source}.#{method_call}" - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb deleted file mode 100644 index 1909b6568e9a5b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where numeric argument to BigDecimal should be - # converted to string. Initializing from String is faster - # than from Numeric for BigDecimal. - # - # @example - # # bad - # BigDecimal(1, 2) - # 4.to_d(6) - # BigDecimal(1.2, 3, exception: true) - # 4.5.to_d(6, exception: true) - # - # # good - # BigDecimal('1', 2) - # BigDecimal('4', 6) - # BigDecimal('1.2', 3, exception: true) - # BigDecimal('4.5', 6, exception: true) - # - class BigDecimalWithNumericArgument < Base - extend AutoCorrector - - MSG = 'Convert numeric literal to string and pass it to `BigDecimal`.' - RESTRICT_ON_SEND = %i[BigDecimal to_d].freeze - - def_node_matcher :big_decimal_with_numeric_argument?, <<~PATTERN - (send nil? :BigDecimal $numeric_type? ...) - PATTERN - - def_node_matcher :to_d?, <<~PATTERN - (send [!nil? $numeric_type?] :to_d ...) - PATTERN - - def on_send(node) - if (numeric = big_decimal_with_numeric_argument?(node)) - add_offense(numeric.source_range) do |corrector| - corrector.wrap(numeric, "'", "'") - end - elsif (numeric_to_d = to_d?(node)) - add_offense(numeric_to_d.source_range) do |corrector| - big_decimal_args = node.arguments.map(&:source).unshift("'#{numeric_to_d.source}'").join(', ') - - corrector.replace(node, "BigDecimal(#{big_decimal_args})") - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/bind_call.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/bind_call.rb deleted file mode 100644 index 0937a252af49c2..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/bind_call.rb +++ /dev/null @@ -1,77 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # In Ruby 2.7, `UnboundMethod#bind_call` has been added. - # - # This cop identifies places where `bind(obj).call(args, ...)` - # can be replaced by `bind_call(obj, args, ...)`. - # - # The `bind_call(obj, args, ...)` method is faster than - # `bind(obj).call(args, ...)`. - # - # @example - # # bad - # umethod.bind(obj).call(foo, bar) - # umethod.bind(obj).(foo, bar) - # - # # good - # umethod.bind_call(obj, foo, bar) - # - class BindCall < Base - include RangeHelp - extend AutoCorrector - extend TargetRubyVersion - - minimum_target_ruby_version 2.7 - - MSG = 'Use `bind_call(%s%s%s)` instead of `bind(%s).call(%s)`.' - RESTRICT_ON_SEND = %i[call].freeze - - def_node_matcher :bind_with_call_method?, <<~PATTERN - (send - $(send - _ :bind - $(...)) :call - $...) - PATTERN - - def on_send(node) - return unless (receiver, bind_arg, call_args_node = bind_with_call_method?(node)) - - range = correction_range(receiver, node) - call_args = build_call_args(call_args_node) - message = message(bind_arg.source, call_args) - - add_offense(range, message: message) do |corrector| - call_args = ", #{call_args}" unless call_args.empty? - - replacement_method = "bind_call(#{bind_arg.source}#{call_args})" - - corrector.replace(range, replacement_method) - end - end - - private - - def message(bind_arg, call_args) - comma = call_args.empty? ? '' : ', ' - - format(MSG, bind_arg: bind_arg, comma: comma, call_args: call_args) - end - - def correction_range(receiver, node) - location_of_bind = receiver.loc.selector.begin_pos - location_of_call = node.source_range.end.end_pos - - range_between(location_of_bind, location_of_call) - end - - def build_call_args(call_args_node) - call_args_node.map(&:source).join(', ') - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/block_given_with_explicit_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/block_given_with_explicit_block.rb deleted file mode 100644 index 4c717d27743c25..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/block_given_with_explicit_block.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies unnecessary use of a `block_given?` where explicit check - # of block argument would suffice. - # - # @example - # # bad - # def method(&block) - # do_something if block_given? - # end - # - # # good - # def method(&block) - # do_something if block - # end - # - # # good - block is reassigned - # def method(&block) - # block ||= -> { do_something } - # warn "Using default ..." unless block_given? - # # ... - # end - # - class BlockGivenWithExplicitBlock < Base - extend AutoCorrector - - RESTRICT_ON_SEND = %i[block_given?].freeze - MSG = 'Check block argument explicitly instead of using `block_given?`.' - - def_node_matcher :reassigns_block_arg?, '`(lvasgn %1 ...)' - - def on_send(node) - def_node = node.each_ancestor(:def, :defs).first - return unless def_node - - block_arg = def_node.arguments.find(&:blockarg_type?) - return unless block_arg - return unless (block_arg_name = block_arg.loc.name) - - block_arg_name = block_arg_name.source.to_sym - return if reassigns_block_arg?(def_node, block_arg_name) - - add_offense(node) do |corrector| - corrector.replace(node, block_arg_name) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/caller.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/caller.rb deleted file mode 100644 index bba8758a6b509e..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/caller.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where `caller[n]` can be replaced by `caller(n..n).first`. - # - # @example - # # bad - # caller[1] - # caller.first - # caller_locations[1] - # caller_locations.first - # - # # good - # caller(2..2).first - # caller(1..1).first - # caller_locations(2..2).first - # caller_locations(1..1).first - class Caller < Base - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s`.' - RESTRICT_ON_SEND = %i[first []].freeze - - def_node_matcher :slow_caller?, <<~PATTERN - { - (send nil? {:caller :caller_locations}) - (send nil? {:caller :caller_locations} int) - } - PATTERN - - def_node_matcher :caller_with_scope_method?, <<~PATTERN - { - (send #slow_caller? :first) - (send #slow_caller? :[] int) - } - PATTERN - - def on_send(node) - return unless caller_with_scope_method?(node) - - method_name = node.receiver.method_name - caller_arg = node.receiver.first_argument - n = caller_arg ? int_value(caller_arg) : 1 - if node.method?(:[]) - m = int_value(node.first_argument) - n += m - end - - preferred_method = "#{method_name}(#{n}..#{n}).first" - - message = format(MSG, preferred_method: preferred_method, current_method: node.source) - add_offense(node, message: message) do |corrector| - corrector.replace(node, preferred_method) - end - end - - private - - def int_value(node) - node.children[0] - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/case_when_splat.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/case_when_splat.rb deleted file mode 100644 index 0fc30bd660a2f2..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/case_when_splat.rb +++ /dev/null @@ -1,176 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Reordering `when` conditions with a splat to the end - # of the `when` branches can improve performance. - # - # Ruby has to allocate memory for the splat expansion every time - # that the `case` `when` statement is run. Since Ruby does not support - # fall through inside of `case` `when`, like some other languages do, - # the order of the `when` branches should not matter. By placing any - # splat expansions at the end of the list of `when` branches we will - # reduce the number of times that memory has to be allocated for - # the expansion. The exception to this is if multiple of your `when` - # conditions can be true for any given condition. A likely scenario for - # this defining a higher level when condition to override a condition - # that is inside of the splat expansion. - # - # @safety - # This cop is not unsafe autocorrection because it is not a guaranteed - # performance improvement. If the data being processed by the `case` condition is - # normalized in a manner that favors hitting a condition in the splat expansion, - # it is possible that moving the splat condition to the end will use more memory, - # and run slightly slower. - # See for more details: https://github.com/rubocop/rubocop/pull/6163 - # - # @example - # # bad - # case foo - # when *condition - # bar - # when baz - # foobar - # end - # - # case foo - # when *[1, 2, 3, 4] - # bar - # when 5 - # baz - # end - # - # # good - # case foo - # when baz - # foobar - # when *condition - # bar - # end - # - # case foo - # when 1, 2, 3, 4 - # bar - # when 5 - # baz - # end - class CaseWhenSplat < Base - include Alignment - include RangeHelp - extend AutoCorrector - - MSG = 'Reordering `when` conditions with a splat to the end of the `when` branches can improve performance.' - ARRAY_MSG = 'Pass the contents of array literals directly to `when` conditions.' - - def on_case(case_node) - when_conditions = case_node.when_branches.flat_map(&:conditions) - - splat_offenses(when_conditions).reverse_each do |condition| - next if ignored_node?(condition.parent) - - ignore_node(condition.parent) - variable, = *condition - message = variable.array_type? ? ARRAY_MSG : MSG - add_offense(range(condition), message: message) do |corrector| - autocorrect(corrector, condition.parent) - end - end - end - - private - - def autocorrect(corrector, when_node) - if needs_reorder?(when_node) - reorder_condition(corrector, when_node) - else - inline_fix_branch(corrector, when_node) - end - end - - def range(node) - node.parent.loc.keyword.join(node.source_range) - end - - def replacement(conditions) - reordered = conditions.partition(&:splat_type?).reverse - reordered.flatten.map(&:source).join(', ') - end - - def inline_fix_branch(corrector, when_node) - conditions = when_node.conditions - range = range_between(conditions[0].source_range.begin_pos, conditions[-1].source_range.end_pos) - - corrector.replace(range, replacement(conditions)) - end - - def reorder_condition(corrector, when_node) - when_branches = when_node.parent.when_branches - - return if when_branches.one? - - corrector.remove(when_branch_range(when_node)) - corrector.insert_after(when_branches.last, reordering_correction(when_node)) - end - - def reordering_correction(when_node) - new_condition = replacement(when_node.conditions) - - if same_line?(when_node, when_node.body) - new_condition_with_then(when_node, new_condition) - else - new_branch_without_then(when_node, new_condition) - end - end - - def when_branch_range(when_node) - next_branch = when_node.parent.when_branches[when_node.branch_index + 1] - - range_between(when_node.source_range.begin_pos, next_branch.source_range.begin_pos) - end - - def new_condition_with_then(node, new_condition) - "\n#{indent_for(node)}when #{new_condition} then #{node.body.source}" - end - - def new_branch_without_then(node, new_condition) - "\n#{indent_for(node)}when #{new_condition}\n#{indent_for(node.body)}#{node.body.source}" - end - - def indent_for(node) - ' ' * node.loc.column - end - - def splat_offenses(when_conditions) - found_non_splat = false - - offenses = when_conditions.reverse.map do |condition| - found_non_splat ||= non_splat?(condition) - - next if non_splat?(condition) - - condition if found_non_splat - end - - offenses.compact - end - - def non_splat?(condition) - variable, = *condition - - (condition.splat_type? && variable.array_type?) || !condition.splat_type? - end - - def needs_reorder?(when_node) - following_branches = when_node.parent.when_branches[(when_node.branch_index + 1)..] - - following_branches.any? do |when_branch| - when_branch.conditions.any? do |condition| - non_splat?(condition) - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/casecmp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/casecmp.rb deleted file mode 100644 index 29471c7d59a42b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/casecmp.rb +++ /dev/null @@ -1,103 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where a case-insensitive string comparison - # can better be implemented using `casecmp`. - # - # @safety - # This cop is unsafe because `String#casecmp` and `String#casecmp?` behave - # differently when using Non-ASCII characters. - # - # @example - # # bad - # str.downcase == 'abc' - # str.upcase.eql? 'ABC' - # 'abc' == str.downcase - # 'ABC'.eql? str.upcase - # str.downcase == str.downcase - # - # # good - # str.casecmp('ABC').zero? - # 'abc'.casecmp(str).zero? - class Casecmp < Base - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s`.' - RESTRICT_ON_SEND = %i[== eql? !=].freeze - CASE_METHODS = %i[downcase upcase].freeze - - def_node_matcher :downcase_eq, <<~PATTERN - (send - $(send _ ${:downcase :upcase}) - ${:== :eql? :!=} - ${str (send _ {:downcase :upcase} ...) (begin str)}) - PATTERN - - def_node_matcher :eq_downcase, <<~PATTERN - (send - {str (send _ {:downcase :upcase} ...) (begin str)} - ${:== :eql? :!=} - $(send _ ${:downcase :upcase})) - PATTERN - - def_node_matcher :downcase_downcase, <<~PATTERN - (send - $(send _ ${:downcase :upcase}) - ${:== :eql? :!=} - $(send _ ${:downcase :upcase})) - PATTERN - - def on_send(node) - return unless downcase_eq(node) || eq_downcase(node) - return unless (parts = take_method_apart(node)) - - _receiver, method, arg, variable = parts - good_method = build_good_method(method, arg, variable) - - message = format(MSG, good: good_method, bad: node.source) - add_offense(node, message: message) do |corrector| - autocorrect(corrector, node, good_method) - end - end - - private - - def take_method_apart(node) - if downcase_downcase(node) - receiver, method, rhs = *node - arg, = *rhs - elsif downcase_eq(node) - receiver, method, arg = *node - elsif eq_downcase(node) - arg, method, receiver = *node - else - return - end - - variable, = *receiver - - [receiver, method, arg, variable] - end - - def autocorrect(corrector, node, replacement) - corrector.replace(node, replacement) - end - - def build_good_method(method, arg, variable) - bang = method == :!= ? '!' : '' - - # We want resulting call to be parenthesized - # if arg already includes one or more sets of parens, don't add more - # or if method call already used parens, again, don't add more - if arg.send_type? || !parentheses?(arg) - "#{bang}#{variable.source}.casecmp(#{arg.source}).zero?" - else - "#{bang}#{variable.source}.casecmp#{arg.source}.zero?" - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/chain_array_allocation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/chain_array_allocation.rb deleted file mode 100644 index c19bbc9fe371a3..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/chain_array_allocation.rb +++ /dev/null @@ -1,74 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies usages of `array.compact.flatten.map { |x| x.downcase }`. - # Each of these methods (`compact`, `flatten`, `map`) will generate a new intermediate array - # that is promptly thrown away. Instead it is faster to mutate when we know it's safe. - # - # @example - # # bad - # array = ["a", "b", "c"] - # array.compact.flatten.map { |x| x.downcase } - # - # # good - # array = ["a", "b", "c"] - # array.compact! - # array.flatten! - # array.map! { |x| x.downcase } - # array - class ChainArrayAllocation < Base - include RangeHelp - - # These methods return a new array but only sometimes. They must be - # called with an argument. For example: - # - # [1,2].first # => 1 - # [1,2].first(1) # => [1] - # - RETURN_NEW_ARRAY_WHEN_ARGS = %i[first last pop sample shift].to_set.freeze - - # These methods return a new array only when called without a block. - RETURNS_NEW_ARRAY_WHEN_NO_BLOCK = %i[zip product].to_set.freeze - - # These methods ALWAYS return a new array - # after they're called it's safe to mutate the resulting array - ALWAYS_RETURNS_NEW_ARRAY = %i[* + - collect compact drop - drop_while flatten map reject - reverse rotate select shuffle sort - take take_while transpose uniq - values_at |].to_set.freeze - - # These methods have a mutation alternative. For example :collect - # can be called as :collect! - HAS_MUTATION_ALTERNATIVE = %i[collect compact flatten map reject - reverse rotate select shuffle sort uniq].to_set.freeze - - RETURNS_NEW_ARRAY = (ALWAYS_RETURNS_NEW_ARRAY + RETURNS_NEW_ARRAY_WHEN_NO_BLOCK).freeze - - MSG = 'Use unchained `%s` and `%s!` ' \ - '(followed by `return array` if required) instead of chaining ' \ - '`%s...%s`.' - - def_node_matcher :chain_array_allocation?, <<~PATTERN - (send { - (send _ $%RETURN_NEW_ARRAY_WHEN_ARGS {int lvar ivar cvar gvar send}) - (block (send _ $%ALWAYS_RETURNS_NEW_ARRAY) ...) - (send _ $%RETURNS_NEW_ARRAY ...) - } $%HAS_MUTATION_ALTERNATIVE ...) - PATTERN - - def on_send(node) - chain_array_allocation?(node) do |fm, sm| - return if node.each_descendant(:send).any? { |descendant| descendant.method?(:lazy) } - - range = range_between(node.loc.dot.begin_pos, node.source_range.end_pos) - - add_offense(range, message: format(MSG, method: fm, second_method: sm)) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/collection_literal_in_loop.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/collection_literal_in_loop.rb deleted file mode 100644 index 937c5e9ea94c1e..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/collection_literal_in_loop.rb +++ /dev/null @@ -1,138 +0,0 @@ -# frozen_string_literal: true - -require 'set' - -module RuboCop - module Cop - module Performance - # Identifies places where Array and Hash literals are used within loops. - # It is better to extract them into a local variable or constant - # to avoid unnecessary allocations on each iteration. - # - # You can set the minimum number of elements to consider - # an offense with `MinSize`. - # - # @example - # # bad - # users.select do |user| - # %i[superadmin admin].include?(user.role) - # end - # - # # good - # admin_roles = %i[superadmin admin] - # users.select do |user| - # admin_roles.include?(user.role) - # end - # - # # good - # ADMIN_ROLES = %i[superadmin admin] - # ... - # users.select do |user| - # ADMIN_ROLES.include?(user.role) - # end - # - class CollectionLiteralInLoop < Base - MSG = 'Avoid immutable %s literals in loops. ' \ - 'It is better to extract it into a local variable or a constant.' - - POST_CONDITION_LOOP_TYPES = %i[while_post until_post].freeze - LOOP_TYPES = (POST_CONDITION_LOOP_TYPES + %i[while until for]).freeze - - ENUMERABLE_METHOD_NAMES = (Enumerable.instance_methods + [:each]).to_set.freeze - NONMUTATING_ARRAY_METHODS = %i[& * + - <=> == [] all? any? assoc at - bsearch bsearch_index collect combination - compact count cycle deconstruct difference dig - drop drop_while each each_index empty? eql? - fetch filter find_index first flatten hash - include? index inspect intersection join - last length map max min minmax none? one? pack - permutation product rassoc reject - repeated_combination repeated_permutation reverse - reverse_each rindex rotate sample select shuffle - size slice sort sum take take_while - to_a to_ary to_h to_s transpose union uniq - values_at zip |].freeze - - ARRAY_METHODS = (ENUMERABLE_METHOD_NAMES | NONMUTATING_ARRAY_METHODS).to_set.freeze - - NONMUTATING_HASH_METHODS = %i[< <= == > >= [] any? assoc compact dig - each each_key each_pair each_value empty? - eql? fetch fetch_values filter flatten has_key? - has_value? hash include? inspect invert key key? - keys? length member? merge rassoc rehash reject - select size slice to_a to_h to_hash to_proc to_s - transform_keys transform_values value? values values_at].freeze - - HASH_METHODS = (ENUMERABLE_METHOD_NAMES | NONMUTATING_HASH_METHODS).to_set.freeze - - def_node_matcher :kernel_loop?, <<~PATTERN - (block - (send {nil? (const nil? :Kernel)} :loop) - ...) - PATTERN - - def_node_matcher :enumerable_loop?, <<~PATTERN - (block - (send $_ #enumerable_method? ...) - ...) - PATTERN - - def on_send(node) - receiver, method, = *node.children - return unless check_literal?(receiver, method) && parent_is_loop?(receiver) - - message = format(MSG, literal_class: literal_class(receiver)) - add_offense(receiver, message: message) - end - - private - - def check_literal?(node, method) - !node.nil? && - nonmutable_method_of_array_or_hash?(node, method) && - node.children.size >= min_size && - node.recursive_basic_literal? - end - - def nonmutable_method_of_array_or_hash?(node, method) - (node.array_type? && ARRAY_METHODS.include?(method)) || - (node.hash_type? && HASH_METHODS.include?(method)) - end - - def parent_is_loop?(node) - node.each_ancestor.any? { |ancestor| loop?(ancestor, node) } - end - - def loop?(ancestor, node) - keyword_loop?(ancestor.type) || kernel_loop?(ancestor) || node_within_enumerable_loop?(node, ancestor) - end - - def keyword_loop?(type) - LOOP_TYPES.include?(type) - end - - def node_within_enumerable_loop?(node, ancestor) - enumerable_loop?(ancestor) do |receiver| - receiver != node && !receiver&.descendants&.include?(node) - end - end - - def literal_class(node) - if node.array_type? - 'Array' - elsif node.hash_type? - 'Hash' - end - end - - def enumerable_method?(method_name) - ENUMERABLE_METHOD_NAMES.include?(method_name) - end - - def min_size - Integer(cop_config['MinSize'] || 1) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/compare_with_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/compare_with_block.rb deleted file mode 100644 index cfbbb1de9bea0b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/compare_with_block.rb +++ /dev/null @@ -1,111 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where `sort { |a, b| a.foo <=> b.foo }` - # can be replaced by `sort_by(&:foo)`. - # This cop also checks `max` and `min` methods. - # - # @example - # # bad - # array.sort { |a, b| a.foo <=> b.foo } - # array.max { |a, b| a.foo <=> b.foo } - # array.min { |a, b| a.foo <=> b.foo } - # array.sort { |a, b| a[:foo] <=> b[:foo] } - # - # # good - # array.sort_by(&:foo) - # array.sort_by { |v| v.foo } - # array.sort_by do |var| - # var.foo - # end - # array.max_by(&:foo) - # array.min_by(&:foo) - # array.sort_by { |a| a[:foo] } - class CompareWithBlock < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Use `%s_by%s` instead of ' \ - '`%s { |%s, %s| %s ' \ - '<=> %s }`.' - - def_node_matcher :compare?, <<~PATTERN - (block - $(send _ {:sort :min :max}) - (args (arg $_a) (arg $_b)) - $send) - PATTERN - - def_node_matcher :replaceable_body?, <<~PATTERN - (send - (send (lvar %1) $_method $...) - :<=> - (send (lvar %2) _method $...)) - PATTERN - - def on_block(node) - compare?(node) do |send, var_a, var_b, body| - replaceable_body?(body, var_a, var_b) do |method, args_a, args_b| - return unless slow_compare?(method, args_a, args_b) - - range = compare_range(send, node) - - add_offense(range, message: message(send, method, var_a, var_b, args_a)) do |corrector| - replacement = if method == :[] - "#{send.method_name}_by { |a| a[#{args_a.first.source}] }" - else - "#{send.method_name}_by(&:#{method})" - end - corrector.replace(range, replacement) - end - end - end - end - - private - - def slow_compare?(method, args_a, args_b) - return false unless args_a == args_b - - if method == :[] - return false unless args_a.size == 1 - - key = args_a.first - return false unless %i[sym str int].include?(key.type) - else - return false unless args_a.empty? - end - true - end - - # rubocop:disable Metrics/MethodLength - def message(send, method, var_a, var_b, args) - compare_method = send.method_name - if method == :[] - key = args.first - instead = " { |a| a[#{key.source}] }" - str_a = "#{var_a}[#{key.source}]" - str_b = "#{var_b}[#{key.source}]" - else - instead = "(&:#{method})" - str_a = "#{var_a}.#{method}" - str_b = "#{var_b}.#{method}" - end - format(MSG, compare_method: compare_method, - instead: instead, - var_a: var_a, - var_b: var_b, - str_a: str_a, - str_b: str_b) - end - # rubocop:enable Metrics/MethodLength - - def compare_range(send, node) - range_between(send.loc.selector.begin_pos, node.loc.end.end_pos) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/concurrent_monotonic_time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/concurrent_monotonic_time.rb deleted file mode 100644 index 9756070b91286d..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/concurrent_monotonic_time.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where `Concurrent.monotonic_time` - # can be replaced by `Process.clock_gettime(Process::CLOCK_MONOTONIC)`. - # - # @example - # - # # bad - # Concurrent.monotonic_time - # - # # good - # Process.clock_gettime(Process::CLOCK_MONOTONIC) - # - class ConcurrentMonotonicTime < Base - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s`.' - RESTRICT_ON_SEND = %i[monotonic_time].freeze - - def_node_matcher :concurrent_monotonic_time?, <<~PATTERN - (send - (const {nil? cbase} :Concurrent) :monotonic_time ...) - PATTERN - - def on_send(node) - return unless concurrent_monotonic_time?(node) - - optional_unit_parameter = ", #{node.first_argument.source}" if node.first_argument - prefer = "Process.clock_gettime(Process::CLOCK_MONOTONIC#{optional_unit_parameter})" - message = format(MSG, prefer: prefer, current: node.source) - - add_offense(node, message: message) do |corrector| - corrector.replace(node, prefer) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/constant_regexp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/constant_regexp.rb deleted file mode 100644 index 00be251b0e4ec7..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/constant_regexp.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Finds regular expressions with dynamic components that are all constants. - # - # Ruby allocates a new Regexp object every time it executes a code containing such - # a regular expression. It is more efficient to extract it into a constant, - # memoize it, or add an `/o` option to perform `#{}` interpolation only once and - # reuse that Regexp object. - # - # @example - # - # # bad - # def tokens(pattern) - # pattern.scan(TOKEN).reject { |token| token.match?(/\A#{SEPARATORS}\Z/) } - # end - # - # # good - # ALL_SEPARATORS = /\A#{SEPARATORS}\Z/ - # def tokens(pattern) - # pattern.scan(TOKEN).reject { |token| token.match?(ALL_SEPARATORS) } - # end - # - # # good - # def tokens(pattern) - # pattern.scan(TOKEN).reject { |token| token.match?(/\A#{SEPARATORS}\Z/o) } - # end - # - # # good - # def separators - # @separators ||= /\A#{SEPARATORS}\Z/ - # end - # - class ConstantRegexp < Base - extend AutoCorrector - - MSG = 'Extract this regexp into a constant, memoize it, or append an `/o` option to its options.' - - def on_regexp(node) - return if within_allowed_assignment?(node) || !include_interpolated_const?(node) || node.single_interpolation? - - add_offense(node) do |corrector| - corrector.insert_after(node, 'o') - end - end - - private - - def within_allowed_assignment?(node) - node.each_ancestor(:casgn, :or_asgn).any? - end - - def_node_matcher :regexp_escape?, <<~PATTERN - (send - (const nil? :Regexp) :escape const_type?) - PATTERN - - def include_interpolated_const?(node) - return false unless node.interpolation? - - node.each_child_node(:begin).all? do |begin_node| - inner_node = begin_node.children.first - inner_node && (inner_node.const_type? || regexp_escape?(inner_node)) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/count.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/count.rb deleted file mode 100644 index ff80f8abb3b6a5..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/count.rb +++ /dev/null @@ -1,142 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies usages of `count` on an `Enumerable` that - # follow calls to `select`, `find_all`, `filter` or `reject`. Querying logic can instead be - # passed to the `count` call. - # - # @safety - # This cop is unsafe because it has known compatibility issues with `ActiveRecord` and other - # frameworks. ActiveRecord's `count` ignores the block that is passed to it. - # `ActiveRecord` will ignore the block that is passed to `count`. - # Other methods, such as `select`, will convert the association to an - # array and then run the block on the array. A simple work around to - # make `count` work with a block is to call `to_a.count {...}`. - # - # For example: - # - # [source,ruby] - # ---- - # `Model.where(id: [1, 2, 3]).select { |m| m.method == true }.size` - # ---- - # - # becomes: - # - # [source,ruby] - # ---- - # `Model.where(id: [1, 2, 3]).to_a.count { |m| m.method == true }` - # ---- - # - # @example - # # bad - # [1, 2, 3].select { |e| e > 2 }.size - # [1, 2, 3].reject { |e| e > 2 }.size - # [1, 2, 3].select { |e| e > 2 }.length - # [1, 2, 3].reject { |e| e > 2 }.length - # [1, 2, 3].select { |e| e > 2 }.count { |e| e.odd? } - # [1, 2, 3].reject { |e| e > 2 }.count { |e| e.even? } - # array.select(&:value).count - # - # # good - # [1, 2, 3].count { |e| e > 2 } - # [1, 2, 3].count { |e| e < 2 } - # [1, 2, 3].count { |e| e > 2 && e.odd? } - # [1, 2, 3].count { |e| e < 2 && e.even? } - # Model.select('field AS field_one').count - # Model.select(:value).count - class Count < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Use `count` instead of `%s...%s`.' - RESTRICT_ON_SEND = %i[count length size].freeze - - def_node_matcher :count_candidate?, <<~PATTERN - { - (send (block $(send _ ${:select :filter :find_all :reject}) ...) ${:count :length :size}) - (send $(send _ ${:select :filter :find_all :reject} (:block_pass _)) ${:count :length :size}) - } - PATTERN - - def on_send(node) - count_candidate?(node) do |selector_node, selector, counter| - return unless eligible_node?(node) - - range = source_starting_at(node) do - selector_node.loc.selector.begin_pos - end - - add_offense(range, message: format(MSG, selector: selector, counter: counter)) do |corrector| - autocorrect(corrector, node, selector_node, selector) - end - end - end - - private - - def autocorrect(corrector, node, selector_node, selector) - selector_loc = selector_node.loc.selector - - range = source_starting_at(node) { |n| n.loc.dot.begin_pos } - - corrector.remove(range) - corrector.replace(selector_loc, 'count') - negate_reject(corrector, node) if selector == :reject - end - - def eligible_node?(node) - !(node.parent && node.parent.block_type?) - end - - def source_starting_at(node) - begin_pos = if block_given? - yield node - else - node.source_range.begin_pos - end - - range_between(begin_pos, node.source_range.end_pos) - end - - def negate_reject(corrector, node) - if node.receiver.send_type? - negate_block_pass_reject(corrector, node) - else - negate_block_reject(corrector, node) - end - end - - def negate_block_pass_reject(corrector, node) - corrector.replace( - node.receiver.source_range.with(begin_pos: node.receiver.loc.begin.begin_pos), - negate_block_pass_as_inline_block(node.receiver) - ) - end - - def negate_block_reject(corrector, node) - target = - if node.receiver.body.begin_type? - node.receiver.body.children.last - else - node.receiver.body - end - corrector.replace(target, negate_expression(target)) - end - - def negate_expression(node) - "!(#{node.source})" - end - - def negate_block_pass_as_inline_block(node) - if node.last_argument.children.first.sym_type? - " { |element| !element.#{node.last_argument.children.first.value} }" - else - " { !#{node.last_argument.children.first.source}.call }" - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/delete_prefix.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/delete_prefix.rb deleted file mode 100644 index 4df4f6f120e2ad..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/delete_prefix.rb +++ /dev/null @@ -1,91 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # In Ruby 2.5, `String#delete_prefix` has been added. - # - # This cop identifies places where `gsub(/\Aprefix/, '')` and `sub(/\Aprefix/, '')` - # can be replaced by `delete_prefix('prefix')`. - # - # This cop has `SafeMultiline` configuration option that `true` by default because - # `^prefix` is unsafe as it will behave incompatible with `delete_prefix` - # for receiver is multiline string. - # - # The `delete_prefix('prefix')` method is faster than `gsub(/\Aprefix/, '')`. - # - # @safety - # This cop is unsafe because `Pathname` has `sub` but not `delete_prefix`. - # - # @example - # - # # bad - # str.gsub(/\Aprefix/, '') - # str.gsub!(/\Aprefix/, '') - # - # str.sub(/\Aprefix/, '') - # str.sub!(/\Aprefix/, '') - # - # # good - # str.delete_prefix('prefix') - # str.delete_prefix!('prefix') - # - # @example SafeMultiline: true (default) - # - # # good - # str.gsub(/^prefix/, '') - # str.gsub!(/^prefix/, '') - # str.sub(/^prefix/, '') - # str.sub!(/^prefix/, '') - # - # @example SafeMultiline: false - # - # # bad - # str.gsub(/^prefix/, '') - # str.gsub!(/^prefix/, '') - # str.sub(/^prefix/, '') - # str.sub!(/^prefix/, '') - # - class DeletePrefix < Base - include RegexpMetacharacter - extend AutoCorrector - extend TargetRubyVersion - - minimum_target_ruby_version 2.5 - - MSG = 'Use `%s` instead of `%s`.' - RESTRICT_ON_SEND = %i[gsub gsub! sub sub!].freeze - - PREFERRED_METHODS = { - gsub: :delete_prefix, - gsub!: :delete_prefix!, - sub: :delete_prefix, - sub!: :delete_prefix! - }.freeze - - def_node_matcher :delete_prefix_candidate?, <<~PATTERN - (send $!nil? ${:gsub :gsub! :sub :sub!} (regexp (str $#literal_at_start?) (regopt)) (str $_)) - PATTERN - - def on_send(node) - return unless (receiver, bad_method, regexp_str, replace_string = delete_prefix_candidate?(node)) - return unless replace_string.empty? - - good_method = PREFERRED_METHODS[bad_method] - - message = format(MSG, current: bad_method, prefer: good_method) - - add_offense(node.loc.selector, message: message) do |corrector| - regexp_str = drop_start_metacharacter(regexp_str) - regexp_str = interpret_string_escapes(regexp_str) - string_literal = to_string_literal(regexp_str) - - new_code = "#{receiver.source}.#{good_method}(#{string_literal})" - - corrector.replace(node, new_code) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/delete_suffix.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/delete_suffix.rb deleted file mode 100644 index ae13359db1164e..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/delete_suffix.rb +++ /dev/null @@ -1,91 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # In Ruby 2.5, `String#delete_suffix` has been added. - # - # This cop identifies places where `gsub(/suffix\z/, '')` and `sub(/suffix\z/, '')` - # can be replaced by `delete_suffix('suffix')`. - # - # This cop has `SafeMultiline` configuration option that `true` by default because - # `suffix$` is unsafe as it will behave incompatible with `delete_suffix?` - # for receiver is multiline string. - # - # The `delete_suffix('suffix')` method is faster than `gsub(/suffix\z/, '')`. - # - # @safety - # This cop is unsafe because `Pathname` has `sub` but not `delete_suffix`. - # - # @example - # - # # bad - # str.gsub(/suffix\z/, '') - # str.gsub!(/suffix\z/, '') - # - # str.sub(/suffix\z/, '') - # str.sub!(/suffix\z/, '') - # - # # good - # str.delete_suffix('suffix') - # str.delete_suffix!('suffix') - # - # @example SafeMultiline: true (default) - # - # # good - # str.gsub(/suffix$/, '') - # str.gsub!(/suffix$/, '') - # str.sub(/suffix$/, '') - # str.sub!(/suffix$/, '') - # - # @example SafeMultiline: false - # - # # bad - # str.gsub(/suffix$/, '') - # str.gsub!(/suffix$/, '') - # str.sub(/suffix$/, '') - # str.sub!(/suffix$/, '') - # - class DeleteSuffix < Base - include RegexpMetacharacter - extend AutoCorrector - extend TargetRubyVersion - - minimum_target_ruby_version 2.5 - - MSG = 'Use `%s` instead of `%s`.' - RESTRICT_ON_SEND = %i[gsub gsub! sub sub!].freeze - - PREFERRED_METHODS = { - gsub: :delete_suffix, - gsub!: :delete_suffix!, - sub: :delete_suffix, - sub!: :delete_suffix! - }.freeze - - def_node_matcher :delete_suffix_candidate?, <<~PATTERN - (send $!nil? ${:gsub :gsub! :sub :sub!} (regexp (str $#literal_at_end?) (regopt)) (str $_)) - PATTERN - - def on_send(node) - return unless (receiver, bad_method, regexp_str, replace_string = delete_suffix_candidate?(node)) - return unless replace_string.empty? - - good_method = PREFERRED_METHODS[bad_method] - - message = format(MSG, current: bad_method, prefer: good_method) - - add_offense(node.loc.selector, message: message) do |corrector| - regexp_str = drop_end_metacharacter(regexp_str) - regexp_str = interpret_string_escapes(regexp_str) - string_literal = to_string_literal(regexp_str) - - new_code = "#{receiver.source}.#{good_method}(#{string_literal})" - - corrector.replace(node, new_code) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/detect.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/detect.rb deleted file mode 100644 index 2ef70a5526d335..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/detect.rb +++ /dev/null @@ -1,136 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies usages of `first`, `last`, `[0]` or `[-1]` - # chained to `select`, `find_all` or `filter` and change them to use - # `detect` instead. - # - # @safety - # This cop is unsafe because it assumes that the receiver is an - # `Array` or equivalent, but can't reliably detect it. For example, - # if the receiver is a `Hash`, it may report a false positive. - # - # @example - # # bad - # [].select { |item| true }.first - # [].select { |item| true }.last - # [].find_all { |item| true }.first - # [].find_all { |item| true }.last - # [].filter { |item| true }.first - # [].filter { |item| true }.last - # [].filter { |item| true }[0] - # [].filter { |item| true }[-1] - # - # # good - # [].detect { |item| true } - # [].reverse.detect { |item| true } - # - class Detect < Base - extend AutoCorrector - - CANDIDATE_METHODS = Set[:select, :find_all, :filter].freeze - - MSG = 'Use `%s` instead of `%s.%s`.' - REVERSE_MSG = 'Use `reverse.%s` instead of `%s.%s`.' - INDEX_MSG = 'Use `%s` instead of `%s[%i]`.' - INDEX_REVERSE_MSG = 'Use `reverse.%s` instead of `%s[%i]`.' - RESTRICT_ON_SEND = %i[first last []].freeze - - def_node_matcher :detect_candidate?, <<~PATTERN - { - (send $(block (send _ %CANDIDATE_METHODS) ...) ${:first :last} $...) - (send $(block (send _ %CANDIDATE_METHODS) ...) $:[] (int ${0 -1})) - (send $(send _ %CANDIDATE_METHODS ...) ${:first :last} $...) - (send $(send _ %CANDIDATE_METHODS ...) $:[] (int ${0 -1})) - } - PATTERN - - def on_send(node) - detect_candidate?(node) do |receiver, second_method, args| - if second_method == :[] - index = args - args = {} - end - - return unless args.empty? - return unless receiver - - receiver, _args, body = *receiver if receiver.block_type? - return if accept_first_call?(receiver, body) - - register_offense(node, receiver, second_method, index) - end - end - - private - - def accept_first_call?(receiver, body) - caller, _first_method, args = *receiver - - # check that we have usual block or block pass - return true if body.nil? && (args.nil? || !args.block_pass_type?) - - lazy?(caller) - end - - def register_offense(node, receiver, second_method, index) - _caller, first_method, _args = *receiver - range = receiver.loc.selector.join(node.loc.selector) - - message = message_for_method(second_method, index) - formatted_message = format(message, prefer: preferred_method, - first_method: first_method, - second_method: second_method, - index: index) - - add_offense(range, message: formatted_message) do |corrector| - autocorrect(corrector, node, replacement(second_method, index)) - end - end - - def replacement(method, index) - if method == :last || (method == :[] && index == -1) - "reverse.#{preferred_method}" - else - preferred_method - end - end - - def autocorrect(corrector, node, replacement) - receiver, _first_method = *node - - first_range = receiver.source_range.end.join(node.loc.selector) - - receiver, _args, _body = *receiver if receiver.block_type? - - corrector.remove(first_range) - corrector.replace(receiver.loc.selector, replacement) - end - - def message_for_method(method, index) - case method - when :[] - index == -1 ? INDEX_REVERSE_MSG : INDEX_MSG - when :last - REVERSE_MSG - else - MSG - end - end - - def preferred_method - config.for_cop('Style/CollectionMethods')['PreferredMethods']['detect'] || 'detect' - end - - def lazy?(node) - return false unless node - - receiver, method, _args = *node - method == :lazy && !receiver.nil? - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/double_start_end_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/double_start_end_with.rb deleted file mode 100644 index 8ec3e10cc6e1a1..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/double_start_end_with.rb +++ /dev/null @@ -1,106 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Checks for double `#start_with?` or `#end_with?` calls - # separated by `||`. In some cases such calls can be replaced - # with an single `#start_with?`/`#end_with?` call. - # - # `IncludeActiveSupportAliases` configuration option is used to check for - # `starts_with?` and `ends_with?`. These methods are defined by Active Support. - # - # @example - # # bad - # str.start_with?("a") || str.start_with?(Some::CONST) - # str.start_with?("a", "b") || str.start_with?("c") - # str.end_with?(var1) || str.end_with?(var2) - # - # # good - # str.start_with?("a", Some::CONST) - # str.start_with?("a", "b", "c") - # str.end_with?(var1, var2) - # - # @example IncludeActiveSupportAliases: false (default) - # # good - # str.starts_with?("a", "b") || str.starts_with?("c") - # str.ends_with?(var1) || str.ends_with?(var2) - # - # str.starts_with?("a", "b", "c") - # str.ends_with?(var1, var2) - # - # @example IncludeActiveSupportAliases: true - # # bad - # str.starts_with?("a", "b") || str.starts_with?("c") - # str.ends_with?(var1) || str.ends_with?(var2) - # - # # good - # str.starts_with?("a", "b", "c") - # str.ends_with?(var1, var2) - # - class DoubleStartEndWith < Base - extend AutoCorrector - - MSG = 'Use `%s.%s(%s)` instead of `%s`.' - - def on_or(node) - receiver, method, first_call_args, second_call_args = process_source(node) - - return unless receiver && second_call_args.all?(&:pure?) - - combined_args = combine_args(first_call_args, second_call_args) - - add_offense(node, message: message(node, receiver, method, combined_args)) do |corrector| - autocorrect(corrector, first_call_args, second_call_args, combined_args) - end - end - - private - - def autocorrect(corrector, first_call_args, second_call_args, combined_args) - first_argument = first_call_args.first.source_range - last_argument = second_call_args.last.source_range - range = first_argument.join(last_argument) - - corrector.replace(range, combined_args) - end - - def process_source(node) - if check_for_active_support_aliases? - check_with_active_support_aliases(node) - else - two_start_end_with_calls(node) - end - end - - def message(node, receiver, method, combined_args) - format( - MSG, receiver: receiver.source, method: method, combined_args: combined_args, original_code: node.source - ) - end - - def combine_args(first_call_args, second_call_args) - (first_call_args + second_call_args).map(&:source).join(', ') - end - - def check_for_active_support_aliases? - cop_config['IncludeActiveSupportAliases'] - end - - def_node_matcher :two_start_end_with_calls, <<~PATTERN - (or - (send $_recv [{:start_with? :end_with?} $_method] $...) - (send _recv _method $...)) - PATTERN - - def_node_matcher :check_with_active_support_aliases, <<~PATTERN - (or - (send $_recv - [{:start_with? :starts_with? :end_with? :ends_with?} $_method] - $...) - (send _recv _method $...)) - PATTERN - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/end_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/end_with.rb deleted file mode 100644 index f7022300adb229..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/end_with.rb +++ /dev/null @@ -1,79 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies unnecessary use of a regex where `String#end_with?` would suffice. - # - # This cop has `SafeMultiline` configuration option that `true` by default because - # `end$` is unsafe as it will behave incompatible with `end_with?` - # for receiver is multiline string. - # - # @safety - # This will change to a new method call which isn't guaranteed to be on the - # object. Switching these methods has to be done with knowledge of the types - # of the variables which rubocop doesn't have. - # - # @example - # # bad - # 'abc'.match?(/bc\Z/) - # /bc\Z/.match?('abc') - # 'abc' =~ /bc\Z/ - # /bc\Z/ =~ 'abc' - # 'abc'.match(/bc\Z/) - # /bc\Z/.match('abc') - # - # # good - # 'abc'.end_with?('bc') - # - # @example SafeMultiline: true (default) - # - # # good - # 'abc'.match?(/bc$/) - # /bc$/.match?('abc') - # 'abc' =~ /bc$/ - # /bc$/ =~ 'abc' - # 'abc'.match(/bc$/) - # /bc$/.match('abc') - # - # @example SafeMultiline: false - # - # # bad - # 'abc'.match?(/bc$/) - # /bc$/.match?('abc') - # 'abc' =~ /bc$/ - # /bc$/ =~ 'abc' - # 'abc'.match(/bc$/) - # /bc$/.match('abc') - # - class EndWith < Base - include RegexpMetacharacter - extend AutoCorrector - - MSG = 'Use `String#end_with?` instead of a regex match anchored to the end of the string.' - RESTRICT_ON_SEND = %i[match =~ match?].freeze - - def_node_matcher :redundant_regex?, <<~PATTERN - {(send $!nil? {:match :=~ :match?} (regexp (str $#literal_at_end?) (regopt))) - (send (regexp (str $#literal_at_end?) (regopt)) {:match :match?} $_) - (match-with-lvasgn (regexp (str $#literal_at_end?) (regopt)) $_)} - PATTERN - - def on_send(node) - return unless (receiver, regex_str = redundant_regex?(node)) - - add_offense(node) do |corrector| - receiver, regex_str = regex_str, receiver if receiver.is_a?(String) - regex_str = drop_end_metacharacter(regex_str) - regex_str = interpret_string_escapes(regex_str) - - new_source = "#{receiver.source}.end_with?(#{to_string_literal(regex_str)})" - - corrector.replace(node, new_source) - end - end - alias on_match_with_lvasgn on_send - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/fixed_size.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/fixed_size.rb deleted file mode 100644 index 01959f2130b836..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/fixed_size.rb +++ /dev/null @@ -1,98 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Do not compute the size of statically sized objects. - # - # @example - # # String methods - # # bad - # 'foo'.size - # %q[bar].count - # %(qux).length - # - # # Symbol methods - # # bad - # :fred.size - # :'baz'.length - # - # # Array methods - # # bad - # [1, 2, thud].count - # %W(1, 2, bar).size - # - # # Hash methods - # # bad - # { a: corge, b: grault }.length - # - # # good - # foo.size - # bar.count - # qux.length - # - # # good - # :"#{fred}".size - # CONST = :baz.length - # - # # good - # [1, 2, *thud].count - # garply = [1, 2, 3] - # garply.size - # - # # good - # { a: corge, **grault }.length - # waldo = { a: corge, b: grault } - # waldo.size - # - class FixedSize < Base - MSG = 'Do not compute the size of statically sized objects.' - RESTRICT_ON_SEND = %i[count length size].freeze - - def_node_matcher :counter, <<~MATCHER - (send ${array hash str sym} {:count :length :size} $...) - MATCHER - - def on_send(node) - return if node.ancestors.any? { |ancestor| allowed_parent?(ancestor) } - - counter(node) do |var, arg| - return if allowed_variable?(var) || allowed_argument?(arg) - - add_offense(node) - end - end - - private - - def allowed_variable?(var) - contains_splat?(var) || contains_double_splat?(var) - end - - def allowed_argument?(arg) - arg && non_string_argument?(arg.first) - end - - def allowed_parent?(node) - node && (node.casgn_type? || node.block_type?) - end - - def contains_splat?(node) - return unless node.array_type? - - node.each_child_node(:splat).any? - end - - def contains_double_splat?(node) - return unless node.hash_type? - - node.each_child_node(:kwsplat).any? - end - - def non_string_argument?(node) - node && !node.str_type? - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/flat_map.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/flat_map.rb deleted file mode 100644 index 529bf1387040d7..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/flat_map.rb +++ /dev/null @@ -1,87 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies usages of `map { ... }.flatten` and - # change them to use `flat_map { ... }` instead. - # - # @example - # # bad - # [1, 2, 3, 4].map { |e| [e, e] }.flatten(1) - # [1, 2, 3, 4].collect { |e| [e, e] }.flatten(1) - # - # # good - # [1, 2, 3, 4].flat_map { |e| [e, e] } - # [1, 2, 3, 4].map { |e| [e, e] }.flatten - # [1, 2, 3, 4].collect { |e| [e, e] }.flatten - class FlatMap < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Use `flat_map` instead of `%s...%s`.' - RESTRICT_ON_SEND = %i[flatten flatten!].freeze - FLATTEN_MULTIPLE_LEVELS = ' Beware, `flat_map` only flattens 1 level ' \ - 'and `flatten` can be used to flatten ' \ - 'multiple levels.' - - def_node_matcher :flat_map_candidate?, <<~PATTERN - (send - { - $(block (send _ ${:collect :map}) ...) - $(send _ ${:collect :map} (block_pass _)) - } - ${:flatten :flatten!} - $... - ) - PATTERN - - def on_send(node) - flat_map_candidate?(node) do |map_node, first_method, flatten, params| - flatten_level, = *params.first - if cop_config['EnabledForFlattenWithoutParams'] && !flatten_level - offense_for_levels(node, map_node, first_method, flatten) - elsif flatten_level == 1 - offense_for_method(node, map_node, first_method, flatten) - end - end - end - - private - - def offense_for_levels(node, map_node, first_method, flatten) - message = MSG + FLATTEN_MULTIPLE_LEVELS - - register_offense(node, map_node, first_method, flatten, message) - end - - def offense_for_method(node, map_node, first_method, flatten) - register_offense(node, map_node, first_method, flatten, MSG) - end - - def register_offense(node, map_node, first_method, flatten, message) - map_send_node = map_node.block_type? ? map_node.send_node : map_node - range = range_between(map_send_node.loc.selector.begin_pos, node.source_range.end_pos) - message = format(message, method: first_method, flatten: flatten) - - add_offense(range, message: message) do |corrector| - autocorrect(corrector, node) - end - end - - def autocorrect(corrector, node) - map_node, _first_method, _flatten, params = flat_map_candidate?(node) - flatten_level, = *params.first - - return unless flatten_level - - map_send_node = map_node.block_type? ? map_node.send_node : map_node - range = range_between(map_node.source_range.end_pos, node.source_range.end_pos) - - corrector.remove(range) - corrector.replace(map_send_node.loc.selector, 'flat_map') - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/inefficient_hash_search.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/inefficient_hash_search.rb deleted file mode 100644 index 16a10d235cfe88..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/inefficient_hash_search.rb +++ /dev/null @@ -1,99 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Checks for inefficient searching of keys and values within - # hashes. - # - # `Hash#keys.include?` is less efficient than `Hash#key?` because - # the former allocates a new array and then performs an O(n) search - # through that array, while `Hash#key?` does not allocate any array and - # performs a faster O(1) search for the key. - # - # `Hash#values.include?` is less efficient than `Hash#value?`. While they - # both perform an O(n) search through all of the values, calling `values` - # allocates a new array while using `value?` does not. - # - # @safety - # This cop is unsafe because it can't tell whether the receiver is a hash object. - # - # @example - # # bad - # { a: 1, b: 2 }.keys.include?(:a) - # { a: 1, b: 2 }.keys.include?(:z) - # h = { a: 1, b: 2 }; h.keys.include?(100) - # - # # good - # { a: 1, b: 2 }.key?(:a) - # { a: 1, b: 2 }.has_key?(:z) - # h = { a: 1, b: 2 }; h.key?(100) - # - # # bad - # { a: 1, b: 2 }.values.include?(2) - # { a: 1, b: 2 }.values.include?('garbage') - # h = { a: 1, b: 2 }; h.values.include?(nil) - # - # # good - # { a: 1, b: 2 }.value?(2) - # { a: 1, b: 2 }.has_value?('garbage') - # h = { a: 1, b: 2 }; h.value?(nil) - # - class InefficientHashSearch < Base - extend AutoCorrector - - RESTRICT_ON_SEND = %i[include?].freeze - - def_node_matcher :inefficient_include?, <<~PATTERN - (send (send $_ {:keys :values}) :include? _) - PATTERN - - def on_send(node) - inefficient_include?(node) do |receiver| - return if receiver.nil? - - message = message(node) - add_offense(node, message: message) do |corrector| - # Replace `keys.include?` or `values.include?` with the appropriate - # `key?`/`value?` method. - corrector.replace( - node, - "#{autocorrect_hash_expression(node)}.#{autocorrect_method(node)}(#{autocorrect_argument(node)})" - ) - end - end - end - - private - - def message(node) - "Use `##{autocorrect_method(node)}` instead of `##{current_method(node)}.include?`." - end - - def autocorrect_method(node) - case current_method(node) - when :keys then use_long_method ? 'has_key?' : 'key?' - when :values then use_long_method ? 'has_value?' : 'value?' - end - end - - def current_method(node) - node.receiver.method_name - end - - def use_long_method - preferred_config = config.for_all_cops['Style/PreferredHashMethods'] - preferred_config && preferred_config['EnforcedStyle'] == 'long' && preferred_config['Enabled'] - end - - def autocorrect_argument(node) - node.arguments.first.source - end - - def autocorrect_hash_expression(node) - node.receiver.receiver.source - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/io_readlines.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/io_readlines.rb deleted file mode 100644 index adc26bf6e8c5fc..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/io_readlines.rb +++ /dev/null @@ -1,112 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where inefficient `readlines` method - # can be replaced by `each_line` to avoid fully loading file content into memory. - # - # @example - # - # # bad - # File.readlines('testfile').each { |l| puts l } - # IO.readlines('testfile', chomp: true).each { |l| puts l } - # - # conn.readlines(10).map { |l| l.size } - # file.readlines.find { |l| l.start_with?('#') } - # file.readlines.each { |l| puts l } - # - # # good - # File.open('testfile', 'r').each_line { |l| puts l } - # IO.open('testfile').each_line(chomp: true) { |l| puts l } - # - # conn.each_line(10).map { |l| l.size } - # file.each_line.find { |l| l.start_with?('#') } - # file.each_line { |l| puts l } - # - class IoReadlines < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s`.' - RESTRICT_ON_SEND = (Enumerable.instance_methods + [:each]).freeze - - def_node_matcher :readlines_on_class?, <<~PATTERN - $(send $(send (const nil? {:IO :File}) :readlines ...) _) - PATTERN - - def_node_matcher :readlines_on_instance?, <<~PATTERN - $(send $(send ${nil? !const_type?} :readlines ...) _ ...) - PATTERN - - def on_send(node) - return unless (captured_values = readlines_on_class?(node) || readlines_on_instance?(node)) - - enumerable_call, readlines_call, receiver = *captured_values - - range = offense_range(enumerable_call, readlines_call) - good_method = build_good_method(enumerable_call) - bad_method = build_bad_method(enumerable_call) - - add_offense(range, message: format(MSG, good: good_method, bad: bad_method)) do |corrector| - autocorrect(corrector, enumerable_call, readlines_call, receiver) - end - end - - private - - def autocorrect(corrector, enumerable_call, readlines_call, receiver) - # We cannot safely correct `.readlines` method called on IO/File classes - # due to its signature and we are not sure with implicit receiver - # if it is called in the context of some instance or mentioned class. - return if receiver.nil? - - range = correction_range(enumerable_call, readlines_call) - - if readlines_call.arguments? - call_args = build_call_args(readlines_call.arguments) - replacement = "each_line(#{call_args})" - else - replacement = 'each_line' - end - - corrector.replace(range, replacement) - end - - def offense_range(enumerable_call, readlines_call) - readlines_pos = readlines_call.loc.selector.begin_pos - enumerable_pos = enumerable_call.loc.selector.end_pos - range_between(readlines_pos, enumerable_pos) - end - - def build_good_method(enumerable_call) - if enumerable_call.method?(:each) - 'each_line' - else - "each_line.#{enumerable_call.method_name}" - end - end - - def build_bad_method(enumerable_call) - "readlines.#{enumerable_call.method_name}" - end - - def correction_range(enumerable_call, readlines_call) - begin_pos = readlines_call.loc.selector.begin_pos - - end_pos = if enumerable_call.method?(:each) - enumerable_call.source_range.end_pos - else - enumerable_call.loc.dot.begin_pos - end - - range_between(begin_pos, end_pos) - end - - def build_call_args(call_args_node) - call_args_node.map(&:source).join(', ') - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/map_compact.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/map_compact.rb deleted file mode 100644 index 014bb47c1a70be..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/map_compact.rb +++ /dev/null @@ -1,99 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # In Ruby 2.7, `Enumerable#filter_map` has been added. - # - # This cop identifies places where `map { ... }.compact` can be replaced by `filter_map`. - # - # @safety - # This cop's autocorrection is unsafe because `map { ... }.compact` that is not - # compatible with `filter_map`. - # - # [source,ruby] - # ---- - # [true, false, nil].compact #=> [true, false] - # [true, false, nil].filter_map(&:itself) #=> [true] - # ---- - # - # @example - # # bad - # ary.map(&:foo).compact - # ary.collect(&:foo).compact - # - # # good - # ary.filter_map(&:foo) - # ary.map(&:foo).compact! - # ary.compact.map(&:foo) - # - class MapCompact < Base - include RangeHelp - extend AutoCorrector - extend TargetRubyVersion - - MSG = 'Use `filter_map` instead.' - RESTRICT_ON_SEND = %i[compact].freeze - - minimum_target_ruby_version 2.7 - - def_node_matcher :map_compact, <<~PATTERN - { - (send - $(send _ {:map :collect} - (block_pass - (sym _))) _) - (send - (block - $(send _ {:map :collect}) - (args ...) _) _) - } - PATTERN - - def on_send(node) - return unless (map_node = map_compact(node)) - - compact_loc = node.loc - range = range_between(map_node.loc.selector.begin_pos, compact_loc.selector.end_pos) - - add_offense(range) do |corrector| - corrector.replace(map_node.loc.selector, 'filter_map') - remove_compact_method(corrector, map_node, node, node.parent) - end - end - - private - - def remove_compact_method(corrector, map_node, compact_node, chained_method) - compact_method_range = compact_node.loc.selector - - if compact_node.multiline? && chained_method&.loc.respond_to?(:selector) && use_dot?(chained_method) && - !map_method_and_compact_method_on_same_line?(map_node, compact_node) && - !invoke_method_after_map_compact_on_same_line?(compact_node, chained_method) - compact_method_range = compact_method_with_final_newline_range(compact_method_range) - else - corrector.remove(compact_node.loc.dot) - end - - corrector.remove(compact_method_range) - end - - def use_dot?(node) - node.respond_to?(:dot?) && node.dot? - end - - def map_method_and_compact_method_on_same_line?(map_node, compact_node) - compact_node.loc.selector.line == map_node.loc.selector.line - end - - def invoke_method_after_map_compact_on_same_line?(compact_node, chained_method) - compact_node.loc.selector.line == chained_method.loc.last_line - end - - def compact_method_with_final_newline_range(compact_method_range) - range_by_whole_lines(compact_method_range, include_final_newline: true) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/method_object_as_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/method_object_as_block.rb deleted file mode 100644 index 8e342165a72aa9..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/method_object_as_block.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where methods are converted to blocks, with the - # use of `&method`, and passed as arguments to method calls. - # It is faster to replace those with explicit blocks, calling those methods inside. - # - # @example - # # bad - # array.map(&method(:do_something)) - # [1, 2, 3].each(&out.method(:puts)) - # - # # good - # array.map { |x| do_something(x) } - # [1, 2, 3].each { |x| out.puts(x) } - # - class MethodObjectAsBlock < Base - MSG = 'Use block explicitly instead of block-passing a method object.' - - def_node_matcher :method_object_as_argument?, <<~PATTERN - (^send (send _ :method sym)) - PATTERN - - def on_block_pass(node) - add_offense(node) if method_object_as_argument?(node) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/open_struct.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/open_struct.rb deleted file mode 100644 index f5ef6942f814fd..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/open_struct.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Checks for `OpenStruct.new` calls. - # Instantiation of an `OpenStruct` invalidates - # Ruby global method cache as it causes dynamic method - # definition during program runtime. - # This could have an effect on performance, - # especially in case of single-threaded - # applications with multiple `OpenStruct` instantiations. - # - # @safety - # This cop is unsafe because `OpenStruct.new` and `Struct.new` - # are not equivalent. - # - # @example - # # bad - # class MyClass - # def my_method - # OpenStruct.new(my_key1: 'my_value1', my_key2: 'my_value2') - # end - # end - # - # # good - # class MyClass - # MyStruct = Struct.new(:my_key1, :my_key2) - # def my_method - # MyStruct.new('my_value1', 'my_value2') - # end - # end - # - class OpenStruct < Base - MSG = 'Consider using `Struct` over `OpenStruct` to optimize the performance.' - RESTRICT_ON_SEND = %i[new].freeze - - def_node_matcher :open_struct, <<~PATTERN - (send (const {nil? cbase} :OpenStruct) :new ...) - PATTERN - - def on_send(node) - open_struct(node) do - add_offense(node.loc.selector) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/range_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/range_include.rb deleted file mode 100644 index 1187bb3b4fb863..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/range_include.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies uses of `Range#include?` and `Range#member?`, which iterates over each - # item in a `Range` to see if a specified item is there. In contrast, - # `Range#cover?` simply compares the target item with the beginning and - # end points of the `Range`. In a great majority of cases, this is what - # is wanted. - # - # @safety - # This cop is unsafe because `Range#include?` (or `Range#member?`) and `Range#cover?` - # are not equivalent behavior. - # - # @example - # # bad - # ('a'..'z').include?('b') # => true - # ('a'..'z').member?('b') # => true - # - # # good - # ('a'..'z').cover?('b') # => true - # - # # Example of a case where `Range#cover?` may not provide - # # the desired result: - # - # ('a'..'z').cover?('yellow') # => true - class RangeInclude < Base - extend AutoCorrector - - MSG = 'Use `Range#cover?` instead of `Range#%s`.' - RESTRICT_ON_SEND = %i[include? member?].freeze - - # TODO: If we traced out assignments of variables to their uses, we - # might pick up on a few more instances of this issue - # Right now, we only detect direct calls on a Range literal - # (We don't even catch it if the Range is in double parens) - - def_node_matcher :range_include, <<~PATTERN - (send {irange erange (begin {irange erange})} ${:include? :member?} ...) - PATTERN - - def on_send(node) - range_include(node) do |bad_method| - message = format(MSG, bad_method: bad_method) - - add_offense(node.loc.selector, message: message) do |corrector| - corrector.replace(node.loc.selector, 'cover?') - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_block_call.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_block_call.rb deleted file mode 100644 index 01bae4e163efb4..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_block_call.rb +++ /dev/null @@ -1,105 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies the use of a `&block` parameter and `block.call` - # where `yield` would do just as well. - # - # @example - # # bad - # def method(&block) - # block.call - # end - # def another(&func) - # func.call 1, 2, 3 - # end - # - # # good - # def method - # yield - # end - # def another - # yield 1, 2, 3 - # end - class RedundantBlockCall < Base - extend AutoCorrector - - MSG = 'Use `yield` instead of `%s.call`.' - YIELD = 'yield' - OPEN_PAREN = '(' - CLOSE_PAREN = ')' - SPACE = ' ' - - def_node_matcher :blockarg_def, <<~PATTERN - {(def _ (args ... (blockarg $_)) $_) - (defs _ _ (args ... (blockarg $_)) $_)} - PATTERN - - def_node_search :blockarg_calls, <<~PATTERN - (send (lvar %1) :call ...) - PATTERN - - def_node_search :blockarg_assigned?, <<~PATTERN - (lvasgn %1 ...) - PATTERN - - def on_def(node) - blockarg_def(node) do |argname, body| - next unless body - - calls_to_report(argname, body).each do |blockcall| - add_offense(blockcall, message: format(MSG, argname: argname)) do |corrector| - autocorrect(corrector, blockcall) - end - end - end - end - alias on_defs on_def - - private - - # offenses are registered on the `block.call` nodes - def autocorrect(corrector, node) - _receiver, _method, *args = *node - new_source = String.new(YIELD) - unless args.empty? - new_source += if parentheses?(node) - OPEN_PAREN - else - SPACE - end - - new_source << args.map(&:source).join(', ') - end - - new_source << CLOSE_PAREN if parentheses?(node) && !args.empty? - - corrector.replace(node, new_source) - end - - def calls_to_report(argname, body) - return [] if blockarg_assigned?(body, argname) || shadowed_block_argument?(body, argname) - - blockarg_calls(body, argname).map do |call| - return [] if args_include_block_pass?(call) - - call - end - end - - def shadowed_block_argument?(body, block_argument_of_method_signature) - return false unless body.block_type? - - body.arguments.map(&:source).include?(block_argument_of_method_signature.to_s) - end - - def args_include_block_pass?(blockcall) - _receiver, _call, *args = *blockcall - - args.any?(&:block_pass_type?) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb deleted file mode 100644 index 2600f5c969f399..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb +++ /dev/null @@ -1,137 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Checks for uses `Enumerable#all?`, `Enumerable#any?`, `Enumerable#one?`, - # and `Enumerable#none?` are compared with `===` or similar methods in block. - # - # By default, `Object#===` behaves the same as `Object#==`, but this - # behavior is appropriately overridden in subclass. For example, - # `Range#===` returns `true` when argument is within the range. - # - # This cop has `AllowRegexpMatch` option and it is true by default because - # `regexp.match?('string')` often used in block changes to the opposite result: - # - # [source,ruby] - # ---- - # [/pattern/].all? { |regexp| regexp.match?('pattern') } # => true - # [/pattern/].all? { |regexp| regexp =~ 'pattern' } # => true - # [/pattern/].all?('pattern') # => false - # ---- - # - # @safety - # This cop is unsafe because `===` and `==` do not always behave the same. - # - # @example - # # bad - # items.all? { |item| pattern === item } - # items.all? { |item| item == other } - # items.all? { |item| item.is_a?(Klass) } - # items.all? { |item| item.kind_of?(Klass) } - # - # # good - # items.all?(pattern) - # items.all?(Klass) - # - # @example AllowRegexpMatch: true (default) - # - # # good - # items.all? { |item| item =~ pattern } - # items.all? { |item| item.match?(pattern) } - # - # @example AllowRegexpMatch: false - # - # # bad - # items.all? { |item| item =~ pattern } - # items.all? { |item| item.match?(pattern) } - # - class RedundantEqualityComparisonBlock < Base - extend AutoCorrector - extend TargetRubyVersion - - minimum_target_ruby_version 2.5 - - MSG = 'Use `%s` instead of block.' - - TARGET_METHODS = %i[all? any? one? none?].freeze - COMPARISON_METHODS = %i[== === is_a? kind_of?].freeze - REGEXP_METHODS = %i[=~ match?].freeze - IS_A_METHODS = %i[is_a? kind_of?].freeze - - def on_block(node) - return unless TARGET_METHODS.include?(node.method_name) - return unless one_block_argument?(node.arguments) - - block_argument = node.arguments.first - block_body = node.body - return unless use_equality_comparison_block?(block_body) - return if same_block_argument_and_is_a_argument?(block_body, block_argument) - return unless (new_argument = new_argument(block_argument, block_body)) - - range = offense_range(node) - prefer = "#{node.method_name}(#{new_argument})" - - add_offense(range, message: format(MSG, prefer: prefer)) do |corrector| - corrector.replace(range, prefer) - end - end - - private - - def one_block_argument?(block_arguments) - block_arguments.one? && !block_arguments.source.include?(',') - end - - def use_equality_comparison_block?(block_body) - return false unless block_body.send_type? - - method_name = block_body.method_name - - COMPARISON_METHODS.include?(method_name) || (!allow_regexp_match? && REGEXP_METHODS.include?(method_name)) - end - - def same_block_argument_and_is_a_argument?(block_body, block_argument) - if block_body.method?(:===) - block_argument.source != block_body.children[2].source - elsif IS_A_METHODS.include?(block_body.method_name) - block_argument.source == block_body.first_argument.source - else - false - end - end - - def new_argument(block_argument, block_body) - if block_argument.source == block_body.receiver.source - rhs = block_body.first_argument - return if use_block_argument_in_method_argument_of_operand?(block_argument, rhs) - - rhs.source - elsif block_argument.source == block_body.first_argument.source - lhs = block_body.receiver - return if use_block_argument_in_method_argument_of_operand?(block_argument, lhs) - - lhs.source - end - end - - def use_block_argument_in_method_argument_of_operand?(block_argument, operand) - return false unless operand.send_type? - - arguments = operand.arguments - arguments.inject(arguments.map(&:source)) do |operand_sources, argument| - operand_sources + argument.each_descendant(:lvar).map(&:source) - end.any?(block_argument.source) - end - - def offense_range(node) - node.send_node.loc.selector.join(node.source_range.end) - end - - def allow_regexp_match? - cop_config.fetch('AllowRegexpMatch', true) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_match.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_match.rb deleted file mode 100644 index ef7a1a8eef1ed4..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_match.rb +++ /dev/null @@ -1,63 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies the use of `Regexp#match` or `String#match`, which - # returns `#`/`nil`. The return value of `=~` is an integral - # index/`nil` and is more performant. - # - # @example - # # bad - # do_something if str.match(/regex/) - # while regex.match('str') - # do_something - # end - # - # # good - # method(str =~ /regex/) - # return value unless regex =~ 'str' - class RedundantMatch < Base - extend AutoCorrector - - MSG = 'Use `=~` in places where the `MatchData` returned by `#match` will not be used.' - RESTRICT_ON_SEND = %i[match].freeze - - # 'match' is a fairly generic name, so we don't flag it unless we see - # a string or regexp literal on one side or the other - def_node_matcher :match_call?, <<~PATTERN - {(send {str regexp} :match _) - (send !nil? :match {str regexp})} - PATTERN - - def_node_matcher :only_truthiness_matters?, <<~PATTERN - ^({if while until case while_post until_post} equal?(%0) ...) - PATTERN - - def on_send(node) - return unless match_call?(node) && - (!node.value_used? || only_truthiness_matters?(node)) && - !(node.parent && node.parent.block_type?) - - add_offense(node) do |corrector| - autocorrect(corrector, node) if autocorrectable?(node) - end - end - - private - - def autocorrect(corrector, node) - new_source = "#{node.receiver.source} =~ #{node.first_argument.source}" - - corrector.replace(node, new_source) - end - - def autocorrectable?(node) - # Regexp#match can take a second argument, but this cop doesn't - # register an offense in that case - node.receiver.regexp_type? || node.first_argument.regexp_type? - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_merge.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_merge.rb deleted file mode 100644 index 80fd3921089097..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_merge.rb +++ /dev/null @@ -1,195 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where `Hash#merge!` can be replaced by `Hash#[]=`. - # You can set the maximum number of key-value pairs to consider - # an offense with `MaxKeyValuePairs`. - # - # @safety - # This cop is unsafe because RuboCop cannot determine if the - # receiver of `merge!` is actually a hash or not. - # - # @example - # # bad - # hash.merge!(a: 1) - # hash.merge!({'key' => 'value'}) - # - # # good - # hash[:a] = 1 - # hash['key'] = 'value' - # - # @example MaxKeyValuePairs: 2 (default) - # # bad - # hash.merge!(a: 1, b: 2) - # - # # good - # hash[:a] = 1 - # hash[:b] = 2 - class RedundantMerge < Base - include Alignment - extend AutoCorrector - - AREF_ASGN = '%s[%s] = %s' - MSG = 'Use `%s` instead of `%s`.' - RESTRICT_ON_SEND = %i[merge!].freeze - - WITH_MODIFIER_CORRECTION = <<~RUBY - %s %s - %s%s%s - %send - RUBY - - def_node_matcher :redundant_merge_candidate, <<~PATTERN - (send $!nil? :merge! [(hash $...) !kwsplat_type?]) - PATTERN - - def_node_matcher :modifier_flow_control?, <<~PATTERN - [{if while until} modifier_form?] - PATTERN - - def on_send(node) - each_redundant_merge(node) do |redundant_merge_node| - message = message(node) - add_offense(redundant_merge_node, message: message) do |corrector| - redundant_merge_candidate(node) do |receiver, pairs| - new_source = to_assignments(receiver, pairs).join("\n") - - if node.parent && pairs.size > 1 - correct_multiple_elements(corrector, node, node.parent, new_source) - else - correct_single_element(corrector, node, new_source) - end - end - end - end - end - - private - - def message(node) - redundant_merge_candidate(node) do |receiver, pairs| - assignments = to_assignments(receiver, pairs).join('; ') - - format(MSG, prefer: assignments, current: node.source) - end - end - - def each_redundant_merge(node) - redundant_merge_candidate(node) do |receiver, pairs| - next if non_redundant_merge?(node, receiver, pairs) - - yield node - end - end - - def non_redundant_merge?(node, receiver, pairs) - pairs.empty? || - non_redundant_pairs?(receiver, pairs) || - kwsplat_used?(pairs) || - non_redundant_value_used?(receiver, node) - end - - def non_redundant_pairs?(receiver, pairs) - (pairs.size > 1 && !receiver.pure?) || pairs.size > max_key_value_pairs - end - - def kwsplat_used?(pairs) - pairs.any?(&:kwsplat_type?) - end - - def non_redundant_value_used?(receiver, node) - node.value_used? && !EachWithObjectInspector.new(node, receiver).value_used? - end - - def correct_multiple_elements(corrector, node, parent, new_source) - if modifier_flow_control?(parent) - new_source = rewrite_with_modifier(node, parent, new_source) - node = parent - else - padding = "\n#{leading_spaces(node)}" - new_source.gsub!(/\n/, padding) - end - - corrector.replace(node, new_source) - end - - def correct_single_element(corrector, node, new_source) - corrector.replace(node, new_source) - end - - def to_assignments(receiver, pairs) - pairs.map do |pair| - key, value = *pair - - key = key.sym_type? && pair.colon? ? ":#{key.source}" : key.source - - format(AREF_ASGN, receiver: receiver.source, key: key, value: value.source) - end - end - - def rewrite_with_modifier(node, parent, new_source) - indent = ' ' * configured_indentation_width - padding = "\n#{indent + leading_spaces(node)}" - new_source.gsub!(/\n/, padding) - - format(WITH_MODIFIER_CORRECTION, keyword: parent.loc.keyword.source, - condition: parent.condition.source, - leading_space: leading_spaces(node), - indent: indent, - body: new_source).chomp - end - - def leading_spaces(node) - node.source_range.source_line[/\A\s*/] - end - - def max_key_value_pairs - Integer(cop_config['MaxKeyValuePairs'] || 2) - end - - # A utility class for checking the use of values within an - # `each_with_object` call. - class EachWithObjectInspector - extend NodePattern::Macros - - def initialize(node, receiver) - @node = node - @receiver = unwind(receiver) - end - - def value_used? - return false unless eligible_receiver? && second_argument - - receiver.loc.name.source == second_argument.loc.name.source - end - - private - - attr_reader :node, :receiver - - def eligible_receiver? - receiver.respond_to?(:lvar_type?) && receiver.lvar_type? - end - - def second_argument - parent = node.parent - parent = parent.parent if parent.begin_type? - - @second_argument ||= each_with_object_node(parent) - end - - def unwind(receiver) - receiver, = *receiver while receiver.respond_to?(:send_type?) && receiver.send_type? - receiver - end - - def_node_matcher :each_with_object_node, <<~PATTERN - (block (send _ :each_with_object _) (args _ $_) ...) - PATTERN - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_sort_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_sort_block.rb deleted file mode 100644 index ca5481039de9f0..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_sort_block.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where `sort { |a, b| a <=> b }` can be replaced with `sort`. - # - # @example - # # bad - # array.sort { |a, b| a <=> b } - # - # # good - # array.sort - # - class RedundantSortBlock < Base - include SortBlock - extend AutoCorrector - - MSG = 'Use `sort` without block.' - - def on_block(node) - return unless (send, var_a, var_b, body = sort_with_block?(node)) - - replaceable_body?(body, var_a, var_b) do - register_offense(send, node) - end - end - - def on_numblock(node) - return unless (send, arg_count, body = sort_with_numblock?(node)) - return unless arg_count == 2 - - replaceable_body?(body, :_1, :_2) do - register_offense(send, node) - end - end - - private - - def register_offense(send, node) - range = sort_range(send, node) - - add_offense(range) do |corrector| - corrector.replace(range, 'sort') - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb deleted file mode 100644 index 77a0b95c649dbd..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb +++ /dev/null @@ -1,64 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where `split` argument can be replaced from - # a deterministic regexp to a string. - # - # @example - # # bad - # 'a,b,c'.split(/,/) - # - # # good - # 'a,b,c'.split(',') - class RedundantSplitRegexpArgument < Base - extend AutoCorrector - - MSG = 'Use string as argument instead of regexp.' - RESTRICT_ON_SEND = %i[split].freeze - DETERMINISTIC_REGEX = /\A(?:#{LITERAL_REGEX})+\Z/.freeze - STR_SPECIAL_CHARS = %w[\n \" \' \\\\ \t \b \f \r].freeze - - def_node_matcher :split_call_with_regexp?, <<~PATTERN - {(send !nil? :split $regexp)} - PATTERN - - def on_send(node) - return unless (regexp_node = split_call_with_regexp?(node)) - return if regexp_node.ignore_case? || regexp_node.content == ' ' - return unless determinist_regexp?(regexp_node) - - add_offense(regexp_node) do |corrector| - new_argument = replacement(regexp_node) - - corrector.replace(regexp_node, "\"#{new_argument}\"") - end - end - - private - - def determinist_regexp?(regexp_node) - DETERMINISTIC_REGEX.match?(regexp_node.source) - end - - def replacement(regexp_node) - regexp_content = regexp_node.content - stack = [] - chars = regexp_content.chars.each_with_object([]) do |char, strings| - if stack.empty? && char == '\\' - stack.push(char) - else - strings << "#{stack.pop}#{char}" - end - end - chars.map do |char| - char = char.dup - char.delete!('\\') unless STR_SPECIAL_CHARS.include?(char) - char - end.join - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_string_chars.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_string_chars.rb deleted file mode 100644 index 4fd4b0422a089a..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_string_chars.rb +++ /dev/null @@ -1,131 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Checks for redundant `String#chars`. - # - # @example - # # bad - # str.chars[0..2] - # str.chars.slice(0..2) - # str.chars.last - # - # # good - # str[0..2].chars - # - # # bad - # str.chars.first - # str.chars.first(2) - # - # # good - # str[0] - # str[0...2].chars - # str[-1] - # - # # bad - # str.chars.take(2) - # str.chars.length - # str.chars.size - # str.chars.empty? - # - # # good - # str[0...2].chars - # str.length - # str.size - # str.empty? - # - # # For example, if the receiver is an empty string, it will be incompatible. - # # If a negative value is specified for the receiver, `nil` is returned. - # str.chars.last(2) # Incompatible with `str[-2..-1].chars`. - # str.chars.drop(2) # Incompatible with `str[2..-1].chars`. - # - class RedundantStringChars < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s`.' - RESTRICT_ON_SEND = %i[[] slice first last take length size empty?].freeze - - def_node_matcher :redundant_chars_call?, <<~PATTERN - (send $(send _ :chars) $_ $...) - PATTERN - - def on_send(node) - return unless (receiver, method, args = redundant_chars_call?(node)) - return if method == :last && !args.empty? - - range = offense_range(receiver, node) - message = build_message(method, args) - - add_offense(range, message: message) do |corrector| - range = correction_range(receiver, node) - replacement = build_good_method(method, args) - - corrector.replace(range, replacement) - end - end - - private - - def offense_range(receiver, node) - range_between(receiver.loc.selector.begin_pos, node.source_range.end_pos) - end - - def correction_range(receiver, node) - range_between(receiver.loc.dot.begin_pos, node.source_range.end_pos) - end - - def build_message(method, args) - good_method = build_good_method(method, args) - bad_method = build_bad_method(method, args) - format(MSG, good_method: good_method, bad_method: bad_method) - end - - def build_good_method(method, args) - case method - when :slice - "[#{build_call_args(args)}].chars" - when :[], :first - build_good_method_for_brackets_or_first_method(method, args) - when :last - '[-1]' - when :take - "[0...#{args.first.source}].chars" - else - ".#{method}" - end - end - - def build_good_method_for_brackets_or_first_method(method, args) - first_arg = args.first - - if first_arg&.range_type? - "[#{build_call_args(args)}].chars" - elsif method == :first && args.any? - "[0...#{args.first.source}].chars" - else - first_arg ? "[#{first_arg.source}]" : '[0]' - end - end - - def build_bad_method(method, args) - case method - when :[] - "chars[#{build_call_args(args)}]" - else - if args.any? - "chars.#{method}(#{build_call_args(args)})" - else - "chars.#{method}" - end - end - end - - def build_call_args(call_args_node) - call_args_node.map(&:source).join(', ') - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/regexp_match.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/regexp_match.rb deleted file mode 100644 index 0fbd6fc6272349..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/regexp_match.rb +++ /dev/null @@ -1,280 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # In Ruby 2.4, `String#match?`, `Regexp#match?`, and `Symbol#match?` - # have been added. The methods are faster than `match`. - # Because the methods avoid creating a `MatchData` object or saving - # backref. - # So, when `MatchData` is not used, use `match?` instead of `match`. - # - # @example - # # bad - # def foo - # if x =~ /re/ - # do_something - # end - # end - # - # # bad - # def foo - # if x !~ /re/ - # do_something - # end - # end - # - # # bad - # def foo - # if x.match(/re/) - # do_something - # end - # end - # - # # bad - # def foo - # if /re/ === x - # do_something - # end - # end - # - # # good - # def foo - # if x.match?(/re/) - # do_something - # end - # end - # - # # good - # def foo - # if !x.match?(/re/) - # do_something - # end - # end - # - # # good - # def foo - # if x =~ /re/ - # do_something(Regexp.last_match) - # end - # end - # - # # good - # def foo - # if x.match(/re/) - # do_something($~) - # end - # end - # - # # good - # def foo - # if /re/ === x - # do_something($~) - # end - # end - class RegexpMatch < Base - extend AutoCorrector - extend TargetRubyVersion - - minimum_target_ruby_version 2.4 - - # Constants are included in this list because it is unlikely that - # someone will store `nil` as a constant and then use it for comparison - TYPES_IMPLEMENTING_MATCH = %i[const regexp str sym].freeze - MSG = 'Use `match?` instead of `%s` when `MatchData` is not used.' - - def_node_matcher :match_method?, <<~PATTERN - { - (send _recv :match {regexp str sym}) - (send {regexp str sym} :match _) - } - PATTERN - - def_node_matcher :match_with_int_arg_method?, <<~PATTERN - (send _recv :match _ (int ...)) - PATTERN - - def_node_matcher :match_operator?, <<~PATTERN - (send !nil? {:=~ :!~} !nil?) - PATTERN - - def_node_matcher :match_threequals?, <<~PATTERN - (send (regexp (str _) {(regopt) (regopt _)}) :=== !nil?) - PATTERN - - def match_with_lvasgn?(node) - return false unless node.match_with_lvasgn_type? - - regexp, _rhs = *node - regexp.to_regexp.named_captures.empty? - end - - MATCH_NODE_PATTERN = <<~PATTERN - { - #match_method? - #match_with_int_arg_method? - #match_operator? - #match_threequals? - #match_with_lvasgn? - } - PATTERN - - def_node_matcher :match_node?, MATCH_NODE_PATTERN - def_node_search :search_match_nodes, MATCH_NODE_PATTERN - - def_node_search :last_matches, <<~PATTERN - { - (send (const {nil? cbase} :Regexp) :last_match) - (send (const {nil? cbase} :Regexp) :last_match _) - ({back_ref nth_ref} _) - (gvar #match_gvar?) - } - PATTERN - - def on_if(node) - check_condition(node.condition) - end - - def on_case(node) - return if node.condition - - node.each_when do |when_node| - when_node.each_condition do |condition| - check_condition(condition) - end - end - end - - private - - def check_condition(cond) - match_node?(cond) do - return if last_match_used?(cond) - - message = message(cond) - add_offense(cond, message: message) do |corrector| - autocorrect(corrector, cond) - end - end - end - - def autocorrect(corrector, node) - if match_method?(node) || match_with_int_arg_method?(node) - corrector.replace(node.loc.selector, 'match?') - elsif match_operator?(node) || match_threequals?(node) - recv, oper, arg = *node - correct_operator(corrector, recv, arg, oper) - elsif match_with_lvasgn?(node) - recv, arg = *node - correct_operator(corrector, recv, arg) - end - end - - def message(node) - format(MSG, current: node.loc.selector.source) - end - - def last_match_used?(match_node) - scope_root = scope_root(match_node) - body = scope_root ? scope_body(scope_root) : match_node.ancestors.last - - range = range_to_search_for_last_matches(match_node, body, scope_root) - - find_last_match(body, range, scope_root) - end - - def range_to_search_for_last_matches(match_node, body, scope_root) - expression = if modifier_form?(match_node) - match_node.parent.if_branch.source_range - else - match_node.source_range - end - - match_node_pos = expression.begin_pos - next_match_pos = next_match_pos(body, match_node_pos, scope_root) - - match_node_pos..next_match_pos - end - - def next_match_pos(body, match_node_pos, scope_root) - node = search_match_nodes(body).find do |match| - begin_pos = if modifier_form?(match) - match.parent.if_branch.source_range.begin_pos - else - match.source_range.begin_pos - end - - begin_pos > match_node_pos && scope_root(match) == scope_root - end - - node ? node.source_range.begin_pos : Float::INFINITY - end - - def modifier_form?(match_node) - match_node.parent.if_type? && match_node.parent.modifier_form? - end - - def find_last_match(body, range, scope_root) - last_matches(body).find do |ref| - ref_pos = ref.source_range.begin_pos - range.cover?(ref_pos) && scope_root(ref) == scope_root - end - end - - def scope_body(node) - children = node.children - case node.type - when :module - children[1] - when :defs - children[3] - else - children[2] - end - end - - def scope_root(node) - node.each_ancestor.find do |ancestor| - ancestor.def_type? || ancestor.defs_type? || ancestor.class_type? || ancestor.module_type? - end - end - - def match_gvar?(sym) - %i[$~ $MATCH $PREMATCH $POSTMATCH $LAST_PAREN_MATCH $LAST_MATCH_INFO].include?(sym) - end - - def correct_operator(corrector, recv, arg, oper = nil) - op_range = correction_range(recv, arg) - - replace_with_match_predicate_method(corrector, recv, arg, op_range) - - corrector.insert_after(arg, ')') unless op_range.source.end_with?('(') - corrector.insert_before(recv, '!') if oper == :!~ - end - - def replace_with_match_predicate_method(corrector, recv, arg, op_range) - if TYPES_IMPLEMENTING_MATCH.include?(recv.type) - corrector.replace(op_range, '.match?(') - elsif TYPES_IMPLEMENTING_MATCH.include?(arg.type) - corrector.replace(op_range, '.match?(') - swap_receiver_and_arg(corrector, recv, arg) - else - corrector.replace(op_range, '&.match?(') - end - end - - def swap_receiver_and_arg(corrector, recv, arg) - corrector.replace(recv, arg.source) - corrector.replace(arg, recv.source) - end - - def correction_range(recv, arg) - buffer = processed_source.buffer - op_begin_pos = recv.source_range.end_pos - op_end_pos = arg.source_range.begin_pos - Parser::Source::Range.new(buffer, op_begin_pos, op_end_pos) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_each.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_each.rb deleted file mode 100644 index 4be4fb7b039c2d..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_each.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies usages of `reverse.each` and change them to use `reverse_each` instead. - # - # If the return value is used, it will not be detected because the result will be different. - # - # [source,ruby] - # ---- - # [1, 2, 3].reverse.each {} #=> [3, 2, 1] - # [1, 2, 3].reverse_each {} #=> [1, 2, 3] - # ---- - # - # @example - # # bad - # items.reverse.each - # - # # good - # items.reverse_each - class ReverseEach < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Use `reverse_each` instead of `reverse.each`.' - RESTRICT_ON_SEND = %i[each].freeze - - def_node_matcher :reverse_each?, <<~MATCHER - (send (send _ :reverse) :each) - MATCHER - - def on_send(node) - return if use_return_value?(node) - - reverse_each?(node) do - range = offense_range(node) - - add_offense(range) do |corrector| - corrector.replace(range, 'reverse_each') - end - end - end - - private - - def use_return_value?(node) - !!node.ancestors.detect do |ancestor| - ancestor.assignment? || ancestor.send_type? || ancestor.return_type? - end - end - - def offense_range(node) - range_between(node.children.first.loc.selector.begin_pos, node.loc.selector.end_pos) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_first.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_first.rb deleted file mode 100644 index 3775fad7643e0e..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_first.rb +++ /dev/null @@ -1,73 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where `reverse.first(n)` and `reverse.first` - # can be replaced by `last(n).reverse` and `last`. - # - # @example - # - # # bad - # array.reverse.first(5) - # array.reverse.first - # - # # good - # array.last(5).reverse - # array.last - # - class ReverseFirst < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s`.' - RESTRICT_ON_SEND = %i[first].freeze - - def_node_matcher :reverse_first_candidate?, <<~PATTERN - (send $(send _ :reverse) :first (int _)?) - PATTERN - - def on_send(node) - reverse_first_candidate?(node) do |receiver| - range = correction_range(receiver, node) - message = build_message(node) - - add_offense(range, message: message) do |corrector| - replacement = build_good_method(node) - - corrector.replace(range, replacement) - end - end - end - - private - - def correction_range(receiver, node) - range_between(receiver.loc.selector.begin_pos, node.source_range.end_pos) - end - - def build_message(node) - good_method = build_good_method(node) - bad_method = build_bad_method(node) - format(MSG, good_method: good_method, bad_method: bad_method) - end - - def build_good_method(node) - if node.arguments? - "last(#{node.arguments.first.source}).reverse" - else - 'last' - end - end - - def build_bad_method(node) - if node.arguments? - "reverse.first(#{node.arguments.first.source})" - else - 'reverse.first' - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/select_map.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/select_map.rb deleted file mode 100644 index a0676e9d097715..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/select_map.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # In Ruby 2.7, `Enumerable#filter_map` has been added. - # - # This cop identifies places where `select.map` can be replaced by `filter_map`. - # - # @example - # # bad - # ary.select(&:foo).map(&:bar) - # ary.filter(&:foo).map(&:bar) - # - # # good - # ary.filter_map { |o| o.bar if o.foo } - # - class SelectMap < Base - include RangeHelp - extend TargetRubyVersion - - minimum_target_ruby_version 2.7 - - MSG = 'Use `filter_map` instead of `%s.map`.' - RESTRICT_ON_SEND = %i[select filter].freeze - - def_node_matcher :bad_method?, <<~PATTERN - (send nil? :bad_method ...) - PATTERN - - def on_send(node) - return if (first_argument = node.first_argument) && !first_argument.block_pass_type? - return unless (send_node = map_method_candidate(node)) - return unless send_node.method?(:map) - - map_method = send_node.parent&.block_type? ? send_node.parent : send_node - - range = offense_range(node, map_method) - add_offense(range, message: format(MSG, method_name: node.method_name)) - end - - private - - def map_method_candidate(node) - return unless (parent = node.parent) - - if parent.block_type? && parent.parent&.send_type? - parent.parent - elsif parent.send_type? - parent - end - end - - def offense_range(node, map_method) - range_between(node.loc.selector.begin_pos, map_method.source_range.end_pos) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/size.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/size.rb deleted file mode 100644 index b107949a7801d1..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/size.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies usages of `count` on an `Array` and `Hash` and change them to `size`. - # - # @example - # # bad - # [1, 2, 3].count - # (1..3).to_a.count - # Array[*1..3].count - # Array(1..3).count - # - # # bad - # {a: 1, b: 2, c: 3}.count - # [[:foo, :bar], [1, 2]].to_h.count - # Hash[*('a'..'z')].count - # Hash(key: :value).count - # - # # good - # [1, 2, 3].size - # (1..3).to_a.size - # Array[*1..3].size - # Array(1..3).size - # - # # good - # {a: 1, b: 2, c: 3}.size - # [[:foo, :bar], [1, 2]].to_h.size - # Hash[*('a'..'z')].size - # Hash(key: :value).size - # - # # good - # [1, 2, 3].count { |e| e > 2 } - # TODO: Add advanced detection of variables that could - # have been assigned to an array or a hash. - class Size < Base - extend AutoCorrector - - MSG = 'Use `size` instead of `count`.' - RESTRICT_ON_SEND = %i[count].freeze - - def_node_matcher :array?, <<~PATTERN - { - [!nil? array_type?] - (send _ :to_a) - (send (const nil? :Array) :[] _) - (send nil? :Array _) - } - PATTERN - - def_node_matcher :hash?, <<~PATTERN - { - [!nil? hash_type?] - (send _ :to_h) - (send (const nil? :Hash) :[] _) - (send nil? :Hash _) - } - PATTERN - - def_node_matcher :count?, <<~PATTERN - (send {#array? #hash?} :count) - PATTERN - - def on_send(node) - return if node.parent&.block_type? || !count?(node) - - add_offense(node.loc.selector) do |corrector| - corrector.replace(node.loc.selector, 'size') - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sort_reverse.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sort_reverse.rb deleted file mode 100644 index 524e03b23dc6a4..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sort_reverse.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where `sort { |a, b| b <=> a }` - # can be replaced by a faster `sort.reverse`. - # - # @example - # # bad - # array.sort { |a, b| b <=> a } - # - # # good - # array.sort.reverse - # - class SortReverse < Base - include SortBlock - extend AutoCorrector - - MSG = 'Use `sort.reverse` instead.' - - def on_block(node) - sort_with_block?(node) do |send, var_a, var_b, body| - replaceable_body?(body, var_b, var_a) do - register_offense(send, node) - end - end - end - - def on_numblock(node) - sort_with_numblock?(node) do |send, arg_count, body| - next unless arg_count == 2 - - replaceable_body?(body, :_2, :_1) do - register_offense(send, node) - end - end - end - - private - - def register_offense(send, node) - range = sort_range(send, node) - - add_offense(range) do |corrector| - replacement = 'sort.reverse' - - corrector.replace(range, replacement) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/squeeze.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/squeeze.rb deleted file mode 100644 index 13040ad721719b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/squeeze.rb +++ /dev/null @@ -1,64 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where `gsub(/a+/, 'a')` and `gsub!(/a+/, 'a')` - # can be replaced by `squeeze('a')` and `squeeze!('a')`. - # - # The `squeeze('a')` method is faster than `gsub(/a+/, 'a')`. - # - # @example - # - # # bad - # str.gsub(/a+/, 'a') - # str.gsub!(/a+/, 'a') - # - # # good - # str.squeeze('a') - # str.squeeze!('a') - # - class Squeeze < Base - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s`.' - RESTRICT_ON_SEND = %i[gsub gsub!].freeze - - PREFERRED_METHODS = { gsub: :squeeze, gsub!: :squeeze! }.freeze - - def_node_matcher :squeeze_candidate?, <<~PATTERN - (send - $!nil? ${:gsub :gsub!} - (regexp - (str $#repeating_literal?) - (regopt)) - (str $_)) - PATTERN - - def on_send(node) - squeeze_candidate?(node) do |receiver, bad_method, regexp_str, replace_str| - regexp_str = regexp_str[0..-2] # delete '+' from the end - regexp_str = interpret_string_escapes(regexp_str) - return unless replace_str == regexp_str - - good_method = PREFERRED_METHODS[bad_method] - message = format(MSG, current: bad_method, prefer: good_method) - - add_offense(node.loc.selector, message: message) do |corrector| - string_literal = to_string_literal(replace_str) - new_code = "#{receiver.source}.#{good_method}(#{string_literal})" - - corrector.replace(node, new_code) - end - end - end - - private - - def repeating_literal?(regex_str) - regex_str.match?(/\A(?:#{Util::LITERAL_REGEX})\+\z/o) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/start_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/start_with.rb deleted file mode 100644 index ebb2a31d616703..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/start_with.rb +++ /dev/null @@ -1,79 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies unnecessary use of a regex where `String#start_with?` would suffice. - # - # This cop has `SafeMultiline` configuration option that `true` by default because - # `^start` is unsafe as it will behave incompatible with `start_with?` - # for receiver is multiline string. - # - # @safety - # This will change to a new method call which isn't guaranteed to be on the - # object. Switching these methods has to be done with knowledge of the types - # of the variables which rubocop doesn't have. - # - # @example - # # bad - # 'abc'.match?(/\Aab/) - # /\Aab/.match?('abc') - # 'abc' =~ /\Aab/ - # /\Aab/ =~ 'abc' - # 'abc'.match(/\Aab/) - # /\Aab/.match('abc') - # - # # good - # 'abc'.start_with?('ab') - # - # @example SafeMultiline: true (default) - # - # # good - # 'abc'.match?(/^ab/) - # /^ab/.match?('abc') - # 'abc' =~ /^ab/ - # /^ab/ =~ 'abc' - # 'abc'.match(/^ab/) - # /^ab/.match('abc') - # - # @example SafeMultiline: false - # - # # bad - # 'abc'.match?(/^ab/) - # /^ab/.match?('abc') - # 'abc' =~ /^ab/ - # /^ab/ =~ 'abc' - # 'abc'.match(/^ab/) - # /^ab/.match('abc') - # - class StartWith < Base - include RegexpMetacharacter - extend AutoCorrector - - MSG = 'Use `String#start_with?` instead of a regex match anchored to the beginning of the string.' - RESTRICT_ON_SEND = %i[match =~ match?].freeze - - def_node_matcher :redundant_regex?, <<~PATTERN - {(send $!nil? {:match :=~ :match?} (regexp (str $#literal_at_start?) (regopt))) - (send (regexp (str $#literal_at_start?) (regopt)) {:match :match?} $_) - (match-with-lvasgn (regexp (str $#literal_at_start?) (regopt)) $_)} - PATTERN - - def on_send(node) - return unless (receiver, regex_str = redundant_regex?(node)) - - add_offense(node) do |corrector| - receiver, regex_str = regex_str, receiver if receiver.is_a?(String) - regex_str = drop_start_metacharacter(regex_str) - regex_str = interpret_string_escapes(regex_str) - - new_source = "#{receiver.source}.start_with?(#{to_string_literal(regex_str)})" - - corrector.replace(node, new_source) - end - end - alias on_match_with_lvasgn on_send - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_identifier_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_identifier_argument.rb deleted file mode 100644 index 3d3abb9640cb4d..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_identifier_argument.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where string identifier argument can be replaced - # by symbol identifier argument. - # It prevents the redundancy of the internal string-to-symbol conversion. - # - # This cop targets methods that take identifier (e.g. method name) argument - # and the following examples are parts of it. - # - # @example - # - # # bad - # send('do_something') - # attr_accessor 'do_something' - # instance_variable_get('@ivar') - # - # # good - # send(:do_something) - # attr_accessor :do_something - # instance_variable_get(:@ivar) - # - class StringIdentifierArgument < Base - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s`.' - - COMMAND_METHODS = %i[ - alias_method attr_accessor attr_reader attr_writer autoload autoload? private private_constant - protected public public_constant module_function - ].freeze - - # NOTE: `attr` method is not included in this list as it can cause false positives in Nokogiri API. - # And `attr` may not be used because `Style/Attr` registers an offense. - # https://github.com/rubocop/rubocop-performance/issues/278 - RESTRICT_ON_SEND = (%i[ - class_variable_defined? const_defined? const_get const_set const_source_location - define_method instance_method method_defined? private_class_method? private_method_defined? - protected_method_defined? public_class_method public_instance_method public_method_defined? - remove_class_variable remove_method undef_method class_variable_get class_variable_set - deprecate_constant remove_const ruby2_keywords define_singleton_method instance_variable_defined? - instance_variable_get instance_variable_set method public_method public_send remove_instance_variable - respond_to? send singleton_method __send__ - ] + COMMAND_METHODS).freeze - - def on_send(node) - return if COMMAND_METHODS.include?(node.method_name) && node.receiver - return unless (first_argument = node.first_argument) - return unless first_argument.str_type? - - first_argument_value = first_argument.value - return if first_argument_value.include?(' ') || first_argument_value.include?('::') - - replacement = first_argument_value.to_sym.inspect - - message = format(MSG, symbol_arg: replacement, string_arg: first_argument.source) - - add_offense(first_argument, message: message) do |corrector| - corrector.replace(first_argument, replacement) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_include.rb deleted file mode 100644 index b3502c1bdcf481..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_include.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies unnecessary use of a regex where `String#include?` would suffice. - # - # @safety - # This cop's offenses are not safe to autocorrect if a receiver is nil or a Symbol. - # - # @example - # # bad - # str.match?(/ab/) - # /ab/.match?(str) - # str =~ /ab/ - # /ab/ =~ str - # str.match(/ab/) - # /ab/.match(str) - # - # # good - # str.include?('ab') - class StringInclude < Base - extend AutoCorrector - - MSG = 'Use `%sString#include?` instead of a regex match with literal-only pattern.' - RESTRICT_ON_SEND = %i[match =~ !~ match?].freeze - - def_node_matcher :redundant_regex?, <<~PATTERN - {(send $!nil? {:match :=~ :!~ :match?} (regexp (str $#literal?) (regopt))) - (send (regexp (str $#literal?) (regopt)) {:match :match?} $_) - (match-with-lvasgn (regexp (str $#literal?) (regopt)) $_)} - PATTERN - - def on_send(node) - return unless (receiver, regex_str = redundant_regex?(node)) - - negation = node.send_type? && node.method?(:!~) - message = format(MSG, negation: ('!' if negation)) - - add_offense(node, message: message) do |corrector| - receiver, regex_str = regex_str, receiver if receiver.is_a?(String) - regex_str = interpret_string_escapes(regex_str) - - new_source = "#{'!' if negation}#{receiver.source}.include?(#{to_string_literal(regex_str)})" - - corrector.replace(node, new_source) - end - end - alias on_match_with_lvasgn on_send - - private - - def literal?(regex_str) - regex_str.match?(/\A#{Util::LITERAL_REGEX}+\z/o) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_replacement.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_replacement.rb deleted file mode 100644 index 80c06ddb6243a9..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_replacement.rb +++ /dev/null @@ -1,160 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where `gsub` can be replaced by `tr` or `delete`. - # - # @example - # # bad - # 'abc'.gsub('b', 'd') - # 'abc'.gsub('a', '') - # 'abc'.gsub(/a/, 'd') - # 'abc'.gsub!('a', 'd') - # - # # good - # 'abc'.gsub(/.*/, 'a') - # 'abc'.gsub(/a+/, 'd') - # 'abc'.tr('b', 'd') - # 'a b c'.delete(' ') - class StringReplacement < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s`.' - RESTRICT_ON_SEND = %i[gsub gsub!].freeze - DETERMINISTIC_REGEX = /\A(?:#{LITERAL_REGEX})+\Z/.freeze - DELETE = 'delete' - TR = 'tr' - BANG = '!' - - def_node_matcher :string_replacement?, <<~PATTERN - (send _ {:gsub :gsub!} - ${regexp str (send (const nil? :Regexp) {:new :compile} _)} - $str) - PATTERN - - def on_send(node) - string_replacement?(node) do |first_param, second_param| - return if accept_second_param?(second_param) - return if accept_first_param?(first_param) - - offense(node, first_param, second_param) - end - end - - private - - def offense(node, first_param, second_param) - first_source, = first_source(first_param) - first_source = interpret_string_escapes(first_source) unless first_param.str_type? - second_source, = *second_param - message = message(node, first_source, second_source) - - add_offense(range(node), message: message) do |corrector| - autocorrect(corrector, node) - end - end - - def autocorrect(corrector, node) - _string, _method, first_param, second_param = *node - first_source, = first_source(first_param) - second_source, = *second_param - - first_source = interpret_string_escapes(first_source) unless first_param.str_type? - - replace_method(corrector, node, first_source, second_source, first_param) - end - - def replace_method(corrector, node, first_source, second_source, first_param) - replacement_method = replacement_method(node, first_source, second_source) - - corrector.replace(node.loc.selector, replacement_method) - corrector.replace(first_param, to_string_literal(first_source)) unless first_param.str_type? - - remove_second_param(corrector, node, first_param) if second_source.empty? && first_source.length == 1 - end - - def accept_second_param?(second_param) - second_source, = *second_param - second_source.length > 1 - end - - def accept_first_param?(first_param) - first_source, options = first_source(first_param) - return true if first_source.nil? - - unless first_param.str_type? - return true if options - return true unless first_source.is_a?(String) && first_source =~ DETERMINISTIC_REGEX - - # This must be done after checking DETERMINISTIC_REGEX - # Otherwise things like \s will trip us up - first_source = interpret_string_escapes(first_source) - end - - first_source.length != 1 - end - - def first_source(first_param) - case first_param.type - when :regexp - source_from_regex_literal(first_param) - when :send - source_from_regex_constructor(first_param) - when :str - first_param.children.first - end - end - - def source_from_regex_literal(node) - regex, options = *node - source, = *regex - options, = *options - [source, options] - end - - def source_from_regex_constructor(node) - _const, _init, regex = *node - case regex.type - when :regexp - source_from_regex_literal(regex) - when :str - source, = *regex - source - end - end - - def range(node) - range_between(node.loc.selector.begin_pos, node.source_range.end_pos) - end - - def replacement_method(node, first_source, second_source) - replacement = if second_source.empty? && first_source.length == 1 - DELETE - else - TR - end - - "#{replacement}#{BANG if node.bang_method?}" - end - - def message(node, first_source, second_source) - replacement_method = replacement_method(node, first_source, second_source) - - format(MSG, prefer: replacement_method, current: node.method_name) - end - - def method_suffix(node) - node.loc.end ? node.loc.end.source : '' - end - - def remove_second_param(corrector, node, first_param) - end_range = range_between(first_param.source_range.end_pos, node.source_range.end_pos) - - corrector.replace(end_range, method_suffix(node)) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sum.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sum.rb deleted file mode 100644 index a9cc9ab17ea41b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sum.rb +++ /dev/null @@ -1,269 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where custom code finding the sum of elements - # in some Enumerable object can be replaced by `Enumerable#sum` method. - # - # @safety - # Autocorrections are unproblematic wherever an initial value is provided explicitly: - # - # [source,ruby] - # ---- - # [1, 2, 3].reduce(4, :+) # => 10 - # [1, 2, 3].sum(4) # => 10 - # - # [].reduce(4, :+) # => 4 - # [].sum(4) # => 4 - # ---- - # - # This also holds true for non-numeric types which implement a `:+` method: - # - # [source,ruby] - # ---- - # ['l', 'o'].reduce('Hel', :+) # => "Hello" - # ['l', 'o'].sum('Hel') # => "Hello" - # ---- - # - # When no initial value is provided though, `Enumerable#reduce` will pick the first enumerated value - # as initial value and successively add all following values to it, whereas - # `Enumerable#sum` will set an initial value of `0` (`Integer`) which can lead to a `TypeError`: - # - # [source,ruby] - # ---- - # [].reduce(:+) # => nil - # [1, 2, 3].reduce(:+) # => 6 - # ['H', 'e', 'l', 'l', 'o'].reduce(:+) # => "Hello" - # - # [].sum # => 0 - # [1, 2, 3].sum # => 6 - # ['H', 'e', 'l', 'l', 'o'].sum # => in `+': String can't be coerced into Integer (TypeError) - # ---- - # - # @example OnlySumOrWithInitialValue: false (default) - # # bad - # [1, 2, 3].inject(:+) # Autocorrections for cases without initial value are unsafe - # [1, 2, 3].inject(&:+) # and will only be performed when using the `-A` option. - # [1, 2, 3].reduce { |acc, elem| acc + elem } # They can be prohibited completely using `SafeAutoCorrect: true`. - # [1, 2, 3].reduce(10, :+) - # [1, 2, 3].map { |elem| elem ** 2 }.sum - # [1, 2, 3].collect(&:count).sum(10) - # - # # good - # [1, 2, 3].sum - # [1, 2, 3].sum(10) - # [1, 2, 3].sum { |elem| elem ** 2 } - # [1, 2, 3].sum(10, &:count) - # - # @example OnlySumOrWithInitialValue: true - # # bad - # [1, 2, 3].reduce(10, :+) - # [1, 2, 3].map { |elem| elem ** 2 }.sum - # [1, 2, 3].collect(&:count).sum(10) - # - # # good - # [1, 2, 3].sum(10) - # [1, 2, 3].sum { |elem| elem ** 2 } - # [1, 2, 3].sum(10, &:count) - # - class Sum < Base - include RangeHelp - extend AutoCorrector - extend TargetRubyVersion - - minimum_target_ruby_version 2.4 - - MSG = 'Use `%s` instead of `%s`.' - MSG_IF_NO_INIT_VALUE = - 'Use `%s` instead of `%s`, unless calling `%s` on an empty array.' - RESTRICT_ON_SEND = %i[inject reduce sum].freeze - - def_node_matcher :sum_candidate?, <<~PATTERN - (send _ ${:inject :reduce} $_init ? ${(sym :+) (block_pass (sym :+))}) - PATTERN - - def_node_matcher :sum_map_candidate?, <<~PATTERN - (send - { - (block $(send _ {:map :collect}) ...) - $(send _ {:map :collect} (block_pass _)) - } - :sum $_init ?) - PATTERN - - def_node_matcher :sum_with_block_candidate?, <<~PATTERN - (block - $(send _ {:inject :reduce} $_init ?) - (args (arg $_acc) (arg $_elem)) - $send) - PATTERN - - def_node_matcher :acc_plus_elem?, <<~PATTERN - (send (lvar %1) :+ (lvar %2)) - PATTERN - alias elem_plus_acc? acc_plus_elem? - - def on_send(node) - return if empty_array_literal?(node) - - handle_sum_candidate(node) - handle_sum_map_candidate(node) - end - - def on_block(node) - sum_with_block_candidate?(node) do |send, init, var_acc, var_elem, body| - if acc_plus_elem?(body, var_acc, var_elem) || elem_plus_acc?(body, var_elem, var_acc) - range = sum_block_range(send, node) - message = build_block_message(send, init, var_acc, var_elem, body) - - add_offense(range, message: message) do |corrector| - autocorrect(corrector, init, range) - end - end - end - end - - private - - def handle_sum_candidate(node) - sum_candidate?(node) do |method, init, operation| - next if cop_config['OnlySumOrWithInitialValue'] && init.empty? - - range = sum_method_range(node) - message = build_method_message(node, method, init, operation) - - add_offense(range, message: message) do |corrector| - autocorrect(corrector, init, range) - end - end - end - - def handle_sum_map_candidate(node) - sum_map_candidate?(node) do |map, init| - next if node.block_literal? || node.block_argument? - - message = build_sum_map_message(map.method_name, init) - - add_offense(sum_map_range(map, node), message: message) do |corrector| - autocorrect_sum_map(corrector, node, map, init) - end - end - end - - def empty_array_literal?(node) - receiver = node.children.first - array_literal?(node) && receiver && receiver.children.empty? - end - - def array_literal?(node) - receiver = node.children.first - receiver&.literal? && receiver&.array_type? - end - - def autocorrect(corrector, init, range) - return if init.empty? && safe_autocorrect? - - replacement = build_good_method(init) - - corrector.replace(range, replacement) - end - - def autocorrect_sum_map(corrector, sum, map, init) - sum_range = method_call_with_args_range(sum) - map_range = method_call_with_args_range(map) - - block_pass = map.last_argument if map.last_argument&.block_pass_type? - replacement = build_good_method(init, block_pass) - - corrector.remove(sum_range) - - dot = '.' if map.receiver - corrector.replace(map_range, "#{dot}#{replacement}") - end - - def sum_method_range(node) - range_between(node.loc.selector.begin_pos, node.source_range.end_pos) - end - - def sum_map_range(map, sum) - range_between(map.loc.selector.begin_pos, sum.source_range.end.end_pos) - end - - def sum_block_range(send, node) - range_between(send.loc.selector.begin_pos, node.loc.end.end_pos) - end - - def build_method_message(node, method, init, operation) - good_method = build_good_method(init) - bad_method = build_method_bad_method(init, method, operation) - msg = if init.empty? && !array_literal?(node) - MSG_IF_NO_INIT_VALUE - else - MSG - end - format(msg, good_method: good_method, bad_method: bad_method) - end - - def build_sum_map_message(method, init) - sum_method = build_good_method(init) - good_method = "#{sum_method} { ... }" - bad_method = "#{method} { ... }.#{sum_method}" - format(MSG, good_method: good_method, bad_method: bad_method) - end - - def build_block_message(send, init, var_acc, var_elem, body) - good_method = build_good_method(init) - bad_method = build_block_bad_method(send.method_name, init, var_acc, var_elem, body) - format(MSG, good_method: good_method, bad_method: bad_method) - end - - def build_good_method(init, block_pass = nil) - good_method = 'sum' - - args = [] - unless init.empty? - init = init.first - args << init.source unless init.int_type? && init.value.zero? - end - args << block_pass.source if block_pass - good_method += "(#{args.join(', ')})" unless args.empty? - good_method - end - - def build_method_bad_method(init, method, operation) - bad_method = "#{method}(" - unless init.empty? - init = init.first - bad_method += "#{init.source}, " - end - bad_method += if operation.block_pass_type? - '&:+)' - else - ':+)' - end - bad_method - end - - def build_block_bad_method(method, init, var_acc, var_elem, body) - bad_method = method.to_s - - unless init.empty? - init = init.first - bad_method += "(#{init.source})" - end - bad_method += " { |#{var_acc}, #{var_elem}| #{body.source} }" - bad_method - end - - def method_call_with_args_range(node) - if (receiver = node.receiver) - receiver.source_range.end.join(node.source_range.end) - else - node.source_range - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/times_map.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/times_map.rb deleted file mode 100644 index 58e76cbe623922..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/times_map.rb +++ /dev/null @@ -1,76 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Checks for .times.map calls. - # In most cases such calls can be replaced - # with an explicit array creation. - # - # @safety - # This cop's autocorrection is unsafe because `Integer#times` does nothing if receiver is 0 - # or less. However, `Array.new` raises an error if argument is less than 0. - # - # For example: - # - # [source,ruby] - # ---- - # -1.times{} # does nothing - # Array.new(-1) # ArgumentError: negative array size - # ---- - # - # @example - # # bad - # 9.times.map do |i| - # i.to_s - # end - # - # # good - # Array.new(9) do |i| - # i.to_s - # end - class TimesMap < Base - extend AutoCorrector - - MESSAGE = 'Use `Array.new(%s)` with a block instead of `.times.%s`' - MESSAGE_ONLY_IF = 'only if `%s` is always 0 or more' - RESTRICT_ON_SEND = %i[map collect].freeze - - def on_send(node) - check(node) - end - - def on_block(node) - check(node) - end - alias on_numblock on_block - - private - - def check(node) - times_map_call(node) do |map_or_collect, count| - add_offense(node, message: message(map_or_collect, count)) do |corrector| - replacement = "Array.new(#{count.source}#{map_or_collect.arguments.map { |arg| ", #{arg.source}" }.join})" - - corrector.replace(map_or_collect, replacement) - end - end - end - - def message(map_or_collect, count) - template = if count.literal? - "#{MESSAGE}." - else - "#{MESSAGE} #{MESSAGE_ONLY_IF}." - end - format(template, count: count.source, map_or_collect: map_or_collect.method_name) - end - - def_node_matcher :times_map_call, <<~PATTERN - {({block numblock} $(send (send $!nil? :times) {:map :collect}) ...) - $(send (send $!nil? :times) {:map :collect} (block_pass ...))} - PATTERN - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/unfreeze_string.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/unfreeze_string.rb deleted file mode 100644 index 7860c269c7590d..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/unfreeze_string.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # In Ruby 2.3 or later, use unary plus operator to unfreeze a string - # literal instead of `String#dup` and `String.new`. - # Unary plus operator is faster than `String#dup`. - # - # @safety - # This cop's autocorrection is unsafe because `String.new` (without operator) is not - # exactly the same as `+''`. These differ in encoding. `String.new.encoding` is always - # `ASCII-8BIT`. However, `(+'').encoding` is the same as script encoding(e.g. `UTF-8`). - # if you expect `ASCII-8BIT` encoding, disable this cop. - # - # @example - # # bad - # ''.dup - # "something".dup - # String.new - # String.new('') - # String.new('something') - # - # # good - # +'something' - # +'' - class UnfreezeString < Base - extend AutoCorrector - - MSG = 'Use unary plus to get an unfrozen string literal.' - RESTRICT_ON_SEND = %i[dup new].freeze - - def_node_matcher :dup_string?, <<~PATTERN - (send {str dstr} :dup) - PATTERN - - def_node_matcher :string_new?, <<~PATTERN - { - (send (const nil? :String) :new {str dstr}) - (send (const nil? :String) :new) - } - PATTERN - - def on_send(node) - return unless dup_string?(node) || string_new?(node) - - add_offense(node) do |corrector| - string_value = "+#{string_value(node)}" - string_value = "(#{string_value})" if node.parent&.send_type? - - corrector.replace(node, string_value) - end - end - - private - - def string_value(node) - if node.receiver.source == 'String' && node.method?(:new) - node.arguments.empty? ? "''" : node.first_argument.source - else - node.receiver.source - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/uri_default_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/uri_default_parser.rb deleted file mode 100644 index 4ce34da0b24485..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/uri_default_parser.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # Identifies places where `URI::Parser.new` can be replaced by `URI::DEFAULT_PARSER`. - # - # @example - # # bad - # URI::Parser.new - # - # # good - # URI::DEFAULT_PARSER - # - class UriDefaultParser < Base - extend AutoCorrector - - MSG = 'Use `%sURI::DEFAULT_PARSER` instead of `%sURI::Parser.new`.' - RESTRICT_ON_SEND = %i[new].freeze - - def_node_matcher :uri_parser_new?, <<~PATTERN - (send - (const - (const ${nil? cbase} :URI) :Parser) :new) - PATTERN - - def on_send(node) - return unless uri_parser_new?(node) do |captured_value| - double_colon = captured_value ? '::' : '' - message = format(MSG, double_colon: double_colon) - - add_offense(node, message: message) do |corrector| - corrector.replace(node, "#{double_colon}URI::DEFAULT_PARSER") - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance_cops.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance_cops.rb deleted file mode 100644 index 02a64a6300fb8b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance_cops.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -require_relative 'mixin/regexp_metacharacter' -require_relative 'mixin/sort_block' - -require_relative 'performance/ancestors_include' -require_relative 'performance/array_semi_infinite_range_slice' -require_relative 'performance/big_decimal_with_numeric_argument' -require_relative 'performance/bind_call' -require_relative 'performance/block_given_with_explicit_block' -require_relative 'performance/caller' -require_relative 'performance/case_when_splat' -require_relative 'performance/casecmp' -require_relative 'performance/collection_literal_in_loop' -require_relative 'performance/compare_with_block' -require_relative 'performance/concurrent_monotonic_time' -require_relative 'performance/constant_regexp' -require_relative 'performance/count' -require_relative 'performance/delete_prefix' -require_relative 'performance/delete_suffix' -require_relative 'performance/detect' -require_relative 'performance/double_start_end_with' -require_relative 'performance/end_with' -require_relative 'performance/fixed_size' -require_relative 'performance/flat_map' -require_relative 'performance/inefficient_hash_search' -require_relative 'performance/map_compact' -require_relative 'performance/method_object_as_block' -require_relative 'performance/open_struct' -require_relative 'performance/range_include' -require_relative 'performance/io_readlines' -require_relative 'performance/redundant_block_call' -require_relative 'performance/redundant_equality_comparison_block' -require_relative 'performance/redundant_match' -require_relative 'performance/redundant_merge' -require_relative 'performance/redundant_sort_block' -require_relative 'performance/redundant_split_regexp_argument' -require_relative 'performance/redundant_string_chars' -require_relative 'performance/regexp_match' -require_relative 'performance/reverse_each' -require_relative 'performance/reverse_first' -require_relative 'performance/select_map' -require_relative 'performance/size' -require_relative 'performance/sort_reverse' -require_relative 'performance/squeeze' -require_relative 'performance/start_with' -require_relative 'performance/string_identifier_argument' -require_relative 'performance/string_include' -require_relative 'performance/string_replacement' -require_relative 'performance/sum' -require_relative 'performance/times_map' -require_relative 'performance/unfreeze_string' -require_relative 'performance/uri_default_parser' -require_relative 'performance/chain_array_allocation' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance.rb deleted file mode 100644 index 4ed61a2fa07943..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - # RuboCop Performance project namespace - module Performance - PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze - CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze - CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze - - private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT) - - ::RuboCop::ConfigObsoletion.files << PROJECT_ROOT.join('config', 'obsoletion.yml') - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/inject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/inject.rb deleted file mode 100644 index e255a881a4df36..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/inject.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Performance - # Because RuboCop doesn't yet support plugins, we have to monkey patch in a - # bit of our configuration. - module Inject - def self.defaults! - path = CONFIG_DEFAULT.to_s - hash = ConfigLoader.send(:load_yaml_configuration, path) - config = Config.new(hash, path).tap(&:make_excludes_absolute) - puts "configuration from #{path}" if ConfigLoader.debug? - config = ConfigLoader.merge_with_default(config, path) - ConfigLoader.instance_variable_set(:@default_configuration, config) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/version.rb deleted file mode 100644 index f854256ef66734..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/version.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Performance - # This module holds the RuboCop Performance version information. - module Version - STRING = '1.17.1' - - def self.document_version - STRING.match('\d+\.\d+').to_s - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/config/default.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/config/default.yml deleted file mode 100644 index 477bcd7c1d2a77..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/config/default.yml +++ /dev/null @@ -1,1160 +0,0 @@ -# Common configuration. - -inherit_mode: - merge: - - Exclude - -AllCops: - Exclude: - - bin/* - # Exclude db/schema.rb and db/[CONFIGURATION_NAMESPACE]_schema.rb by default. - # See: https://guides.rubyonrails.org/active_record_multiple_databases.html#setting-up-your-application - - db/*schema.rb - - log/**/* - - public/**/* - - storage/**/* - # Enable checking Active Support extensions. - # See: https://docs.rubocop.org/rubocop/configuration.html#enable-checking-active-support-extensions - ActiveSupportExtensionsEnabled: true - # What version of Rails is the inspected code using? If a value is specified - # for TargetRailsVersion then it is used. Acceptable values are specified - # as a float (i.e. 5.1); the patch version of Rails should not be included. - # If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or - # gems.locked file to find the version of Rails that has been bound to the - # application. If neither of those files exist, RuboCop will use Rails 5.0 - # as the default. - TargetRailsVersion: ~ - -Lint/NumberConversion: - # Add Rails' duration methods to the ignore list for `Lint/NumberConversion` - # so that calling `to_i` on one of these does not register an offense. - # See: https://github.com/rubocop/rubocop/issues/8950 - AllowedMethods: - - ago - - from_now - - second - - seconds - - minute - - minutes - - hour - - hours - - day - - days - - week - - weeks - - fortnight - - fortnights - - in_milliseconds - AllowedPatterns: [] - -Rails: - Enabled: true - DocumentationBaseURL: https://docs.rubocop.org/rubocop-rails - -Rails/ActionControllerFlashBeforeRender: - Description: 'Use `flash.now` instead of `flash` before `render`.' - Enabled: 'pending' - SafeAutoCorrect: false - VersionAdded: '2.16' - -Rails/ActionControllerTestCase: - Description: 'Use `ActionDispatch::IntegrationTest` instead of `ActionController::TestCase`.' - StyleGuide: 'https://rails.rubystyle.guide/#integration-testing' - Reference: 'https://api.rubyonrails.org/classes/ActionController/TestCase.html' - Enabled: 'pending' - SafeAutoCorrect: false - VersionAdded: '2.14' - Include: - - '**/test/**/*.rb' - -Rails/ActionFilter: - Description: 'Enforces consistent use of action filter methods.' - Enabled: true - VersionAdded: '0.19' - EnforcedStyle: action - SupportedStyles: - - action - - filter - Include: - - app/controllers/**/*.rb - - app/mailers/**/*.rb - -Rails/ActionOrder: - Description: 'Enforce consistent ordering of controller actions.' - Enabled: pending - VersionAdded: '2.17' - ExpectedOrder: - - index - - show - - new - - edit - - create - - update - - destroy - Include: - - app/controllers/**/*.rb - -Rails/ActiveRecordAliases: - Description: >- - Avoid Active Record aliases: - Use `update` instead of `update_attributes`. - Use `update!` instead of `update_attributes!`. - Enabled: true - VersionAdded: '0.53' - SafeAutoCorrect: false - -Rails/ActiveRecordCallbacksOrder: - Description: 'Order callback declarations in the order in which they will be executed.' - StyleGuide: 'https://rails.rubystyle.guide/#callbacks-order' - Enabled: 'pending' - VersionAdded: '2.7' - Include: - - app/models/**/*.rb - -Rails/ActiveRecordOverride: - Description: >- - Check for overriding Active Record methods instead of using - callbacks. - Enabled: true - Severity: warning - VersionAdded: '0.67' - VersionChanged: '2.18' - Include: - - app/models/**/*.rb - -Rails/ActiveSupportAliases: - Description: >- - Avoid ActiveSupport aliases of standard ruby methods: - `String#starts_with?`, `String#ends_with?`, - `Array#append`, `Array#prepend`. - Enabled: true - VersionAdded: '0.48' - -Rails/ActiveSupportOnLoad: - Description: 'Use `ActiveSupport.on_load(...)` to patch Rails framework classes.' - Enabled: 'pending' - Reference: - - 'https://api.rubyonrails.org/classes/ActiveSupport/LazyLoadHooks.html' - - 'https://guides.rubyonrails.org/engines.html#available-load-hooks' - SafeAutoCorrect: false - VersionAdded: '2.16' - -Rails/AddColumnIndex: - Description: >- - Rails migrations don't make use of a given `index` key, but also - doesn't given an error when it's used, so it makes it seem like an - index might be used. - Enabled: pending - VersionAdded: '2.11' - Include: - - db/migrate/*.rb - -Rails/AfterCommitOverride: - Description: >- - Enforces that there is only one call to `after_commit` - (and its aliases - `after_create_commit`, `after_update_commit`, - and `after_destroy_commit`) with the same callback name per model. - Enabled: 'pending' - VersionAdded: '2.8' - -Rails/ApplicationController: - Description: 'Check that controllers subclass ApplicationController.' - Enabled: true - SafeAutoCorrect: false - VersionAdded: '2.4' - VersionChanged: '2.5' - -Rails/ApplicationJob: - Description: 'Check that jobs subclass ApplicationJob.' - Enabled: true - SafeAutoCorrect: false - VersionAdded: '0.49' - VersionChanged: '2.5' - -Rails/ApplicationMailer: - Description: 'Check that mailers subclass ApplicationMailer.' - Enabled: true - SafeAutoCorrect: false - VersionAdded: '2.4' - VersionChanged: '2.5' - -Rails/ApplicationRecord: - Description: 'Check that models subclass ApplicationRecord.' - Enabled: true - SafeAutoCorrect: false - VersionAdded: '0.49' - VersionChanged: '2.5' - -Rails/ArelStar: - Description: 'Enforces `Arel.star` instead of `"*"` for expanded columns.' - Enabled: true - SafeAutoCorrect: false - VersionAdded: '2.9' - -Rails/AssertNot: - Description: 'Use `assert_not` instead of `assert !`.' - Enabled: true - VersionAdded: '0.56' - Include: - - '**/test/**/*' - -Rails/AttributeDefaultBlockValue: - Description: 'Pass method call in block for attribute option `default`.' - Enabled: pending - VersionAdded: '2.9' - Include: - - 'app/models/**/*' - -Rails/BelongsTo: - Description: >- - Use `optional: true` instead of `required: false` for - `belongs_to` relations. - Reference: - - https://guides.rubyonrails.org/5_0_release_notes.html - - https://github.com/rails/rails/pull/18937 - Enabled: true - VersionAdded: '0.62' - -Rails/Blank: - Description: 'Enforces use of `blank?`.' - Enabled: true - SafeAutoCorrect: false - VersionAdded: '0.48' - VersionChanged: '2.10' - # Convert usages of `nil? || empty?` to `blank?` - NilOrEmpty: true - # Convert usages of `!present?` to `blank?` - NotPresent: true - # Convert usages of `unless present?` to `if blank?` - UnlessPresent: true - -Rails/BulkChangeTable: - Description: 'Check whether alter queries are combinable.' - Reference: - - https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-change_table - - https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/Table.html - Enabled: true - VersionAdded: '0.57' - Database: null - SupportedDatabases: - - mysql - - postgresql - Include: - - db/migrate/*.rb - -Rails/CompactBlank: - Description: 'Checks if collection can be blank-compacted with `compact_blank`.' - Enabled: pending - Safe: false - VersionAdded: '2.13' - -Rails/ContentTag: - Description: 'Use `tag.something` instead of `tag(:something)`.' - Reference: - - 'https://github.com/rubocop/rubocop-rails/issues/260' - - 'https://github.com/rails/rails/issues/25195' - - 'https://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag' - Enabled: true - VersionAdded: '2.6' - VersionChanged: '2.12' - # This `Exclude` config prevents false positives for `tag` calls to `has_one: tag` and Puma configuration: - # https://puma.io/puma/Puma/DSL.html#tag-instance_method - # No helpers are used in normal models and configs. - Exclude: - - app/models/**/*.rb - - config/**/*.rb - -Rails/CreateTableWithTimestamps: - Description: >- - Checks the migration for which timestamps are not included - when creating a new table. - Enabled: true - VersionAdded: '0.52' - Include: - - db/migrate/*.rb - Exclude: - # Respect the `active_storage_variant_records` table of `*_create_active_storage_tables.active_storage.rb` - # auto-generated by `bin/rails active_storage:install` even if `created_at` is not specified. - - db/migrate/*_create_active_storage_tables.active_storage.rb - -Rails/Date: - Description: >- - Checks the correct usage of date aware methods, - such as Date.today, Date.current etc. - Enabled: true - VersionAdded: '0.30' - VersionChanged: '2.11' - # The value `strict` disallows usage of `Date.today`, `Date.current`, - # `Date#to_time` etc. - # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc - # (but not `Date.today`) which are overridden by ActiveSupport to handle current - # time zone. - EnforcedStyle: flexible - SupportedStyles: - - strict - - flexible - AllowToTime: true - -Rails/DefaultScope: - Description: 'Avoid use of `default_scope`.' - StyleGuide: 'https://rails.rubystyle.guide#avoid-default-scope' - Enabled: false - VersionAdded: '2.7' - -Rails/Delegate: - Description: 'Prefer delegate method for delegations.' - Enabled: true - VersionAdded: '0.21' - VersionChanged: '0.50' - # When set to true, using the target object as a prefix of the - # method name without using the `delegate` method will be a - # violation. When set to false, this case is legal. - EnforceForPrefixed: true - -Rails/DelegateAllowBlank: - Description: 'Do not use allow_blank as an option to delegate.' - Enabled: true - VersionAdded: '0.44' - -Rails/DeprecatedActiveModelErrorsMethods: - Description: 'Avoid manipulating ActiveModel errors hash directly.' - Enabled: pending - Severity: warning - Safe: false - VersionAdded: '2.14' - VersionChanged: '2.18' - -Rails/DotSeparatedKeys: - Description: 'Enforces the use of dot-separated keys instead of `:scope` options in `I18n` translation methods.' - StyleGuide: 'https://rails.rubystyle.guide/#dot-separated-keys' - Enabled: pending - VersionAdded: '2.15' - -Rails/DuplicateAssociation: - Description: "Don't repeat associations in a model." - Enabled: pending - Severity: warning - VersionAdded: '2.14' - VersionChanged: '2.18' - -Rails/DuplicateScope: - Description: 'Multiple scopes share this same where clause.' - Enabled: pending - Severity: warning - VersionAdded: '2.14' - VersionChanged: '2.18' - -Rails/DurationArithmetic: - Description: 'Do not use duration as arithmetic operand with `Time.current`.' - StyleGuide: 'https://rails.rubystyle.guide#duration-arithmetic' - Enabled: pending - VersionAdded: '2.13' - -Rails/DynamicFindBy: - Description: 'Use `find_by` instead of dynamic `find_by_*`.' - StyleGuide: 'https://rails.rubystyle.guide#find_by' - Enabled: true - Safe: false - VersionAdded: '0.44' - VersionChanged: '2.10' - # The `Whitelist` has been deprecated, Please use `AllowedMethods` instead. - Whitelist: - - find_by_sql - - find_by_token_for - AllowedMethods: - - find_by_sql - - find_by_token_for - AllowedReceivers: - - Gem::Specification - - page # Prevents a warning for `page.find_by_id`. See: https://github.com/rubocop/rubocop-rails/issues/778 - -Rails/EagerEvaluationLogMessage: - Description: 'Checks that blocks are used for interpolated strings passed to `Rails.logger.debug`.' - Reference: 'https://guides.rubyonrails.org/debugging_rails_applications.html#impact-of-logs-on-performance' - Enabled: pending - VersionAdded: '2.11' - -Rails/EnumHash: - Description: 'Prefer hash syntax over array syntax when defining enums.' - StyleGuide: 'https://rails.rubystyle.guide#enums' - Enabled: true - VersionAdded: '2.3' - Include: - - app/models/**/*.rb - -Rails/EnumUniqueness: - Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.' - Enabled: true - VersionAdded: '0.46' - Include: - - app/models/**/*.rb - -Rails/EnvironmentComparison: - Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`." - Enabled: true - VersionAdded: '0.52' - -Rails/EnvironmentVariableAccess: - Description: 'Do not access `ENV` directly after initialization.' - # TODO: Set to `pending` status in RuboCop Rails 2 series when migration doc will be written. - Enabled: false - VersionAdded: '2.10' - VersionChanged: '2.11' - Include: - - app/**/*.rb - - lib/**/*.rb - Exclude: - - lib/**/*.rake - AllowReads: false - AllowWrites: false - -Rails/Exit: - Description: >- - Favor `fail`, `break`, `return`, etc. over `exit` in - application or library code outside of Rake files to avoid - exits during unit testing or running in production. - Enabled: true - VersionAdded: '0.41' - Include: - - app/**/*.rb - - config/**/*.rb - - lib/**/*.rb - Exclude: - - lib/**/*.rake - -Rails/ExpandedDateRange: - Description: 'Checks for expanded date range.' - StyleGuide: 'https://rails.rubystyle.guide/#date-time-range' - Enabled: pending - VersionAdded: '2.11' - -Rails/FilePath: - Description: 'Use `Rails.root.join` for file path joining.' - Enabled: true - VersionAdded: '0.47' - VersionChanged: '2.4' - EnforcedStyle: slashes - SupportedStyles: - - slashes - - arguments - -Rails/FindBy: - Description: 'Prefer find_by over where.first.' - StyleGuide: 'https://rails.rubystyle.guide#find_by' - Enabled: true - VersionAdded: '0.30' - VersionChanged: '2.11' - IgnoreWhereFirst: true - Include: - - app/models/**/*.rb - -Rails/FindById: - Description: >- - Favor the use of `find` over `where.take!`, `find_by!`, and `find_by_id!` when you - need to retrieve a single record by primary key when you expect it to be found. - StyleGuide: 'https://rails.rubystyle.guide/#find' - Enabled: 'pending' - VersionAdded: '2.7' - -Rails/FindEach: - Description: 'Prefer all.find_each over all.each.' - StyleGuide: 'https://rails.rubystyle.guide#find-each' - Enabled: true - Safe: false - VersionAdded: '0.30' - VersionChanged: '2.19' - Include: - - app/models/**/*.rb - AllowedMethods: - # Methods that don't work well with `find_each`. - - order - - limit - - select - - lock - AllowedPatterns: [] - -Rails/FreezeTime: - Description: 'Prefer `freeze_time` over `travel_to` with an argument of the current time.' - StyleGuide: 'https://rails.rubystyle.guide/#freeze-time' - Enabled: pending - VersionAdded: '2.16' - SafeAutoCorrect: false - -Rails/HasAndBelongsToMany: - Description: 'Prefer has_many :through to has_and_belongs_to_many.' - StyleGuide: 'https://rails.rubystyle.guide#has-many-through' - Enabled: true - VersionAdded: '0.12' - Include: - - app/models/**/*.rb - -Rails/HasManyOrHasOneDependent: - Description: 'Define the dependent option to the has_many and has_one associations.' - StyleGuide: 'https://rails.rubystyle.guide#has_many-has_one-dependent-option' - Enabled: true - VersionAdded: '0.50' - Include: - - app/models/**/*.rb - -Rails/HelperInstanceVariable: - Description: 'Do not use instance variables in helpers.' - Enabled: true - VersionAdded: '2.0' - Include: - - app/helpers/**/*.rb - -Rails/HttpPositionalArguments: - Description: 'Use keyword arguments instead of positional arguments in http method calls.' - Enabled: true - VersionAdded: '0.44' - Include: - - 'spec/**/*' - - 'test/**/*' - -Rails/HttpStatus: - Description: 'Enforces use of symbolic or numeric value to define HTTP status.' - Enabled: true - VersionAdded: '0.54' - VersionChanged: '2.11' - EnforcedStyle: symbolic - SupportedStyles: - - numeric - - symbolic - -Rails/I18nLazyLookup: - Description: 'Checks for places where I18n "lazy" lookup can be used.' - StyleGuide: 'https://rails.rubystyle.guide/#lazy-lookup' - Reference: 'https://guides.rubyonrails.org/i18n.html#lazy-lookup' - Enabled: pending - VersionAdded: '2.14' - Include: - - 'app/controllers/**/*.rb' - -Rails/I18nLocaleAssignment: - Description: 'Prefer the usage of `I18n.with_locale` instead of manually updating `I18n.locale` value.' - Enabled: 'pending' - VersionAdded: '2.11' - Include: - - spec/**/*.rb - - test/**/*.rb - -Rails/I18nLocaleTexts: - Description: 'Enforces use of I18n and locale files instead of locale specific strings.' - StyleGuide: 'https://rails.rubystyle.guide/#locale-texts' - Enabled: pending - VersionAdded: '2.14' - -Rails/IgnoredColumnsAssignment: - Description: 'Looks for assignments of `ignored_columns` that override previous assignments.' - StyleGuide: 'https://rails.rubystyle.guide/#append-ignored-columns' - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '2.17' - -Rails/IgnoredSkipActionFilterOption: - Description: 'Checks that `if` and `only` (or `except`) are not used together as options of `skip_*` action filter.' - Reference: 'https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options' - Enabled: true - VersionAdded: '0.63' - Include: - - app/controllers/**/*.rb - - app/mailers/**/*.rb - -Rails/IndexBy: - Description: 'Prefer `index_by` over `each_with_object`, `to_h`, or `map`.' - Enabled: true - VersionAdded: '2.5' - VersionChanged: '2.8' - -Rails/IndexWith: - Description: 'Prefer `index_with` over `each_with_object`, `to_h`, or `map`.' - Enabled: true - VersionAdded: '2.5' - VersionChanged: '2.8' - -Rails/Inquiry: - Description: "Prefer Ruby's comparison operators over Active Support's `Array#inquiry` and `String#inquiry`." - StyleGuide: 'https://rails.rubystyle.guide/#inquiry' - Enabled: 'pending' - VersionAdded: '2.7' - -Rails/InverseOf: - Description: 'Checks for associations where the inverse cannot be determined automatically.' - Reference: - - https://guides.rubyonrails.org/association_basics.html#bi-directional-associations - - https://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#module-ActiveRecord::Associations::ClassMethods-label-Setting+Inverses - Enabled: true - VersionAdded: '0.52' - IgnoreScopes: false - Include: - - app/models/**/*.rb - -Rails/LexicallyScopedActionFilter: - Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the class." - StyleGuide: 'https://rails.rubystyle.guide#lexically-scoped-action-filter' - Enabled: true - Safe: false - VersionAdded: '0.52' - Include: - - app/controllers/**/*.rb - - app/mailers/**/*.rb - -Rails/LinkToBlank: - Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` option passed to them.' - Reference: - - https://mathiasbynens.github.io/rel-noopener/ - - https://html.spec.whatwg.org/multipage/links.html#link-type-noopener - - https://html.spec.whatwg.org/multipage/links.html#link-type-noreferrer - Enabled: true - VersionAdded: '0.62' - -Rails/MailerName: - Description: 'Mailer should end with `Mailer` suffix.' - StyleGuide: 'https://rails.rubystyle.guide/#mailer-name' - Enabled: 'pending' - SafeAutoCorrect: false - VersionAdded: '2.7' - Include: - - app/mailers/**/*.rb - -Rails/MatchRoute: - Description: >- - Don't use `match` to define any routes unless there is a need to map multiple request types - among [:get, :post, :patch, :put, :delete] to a single action using the `:via` option. - StyleGuide: 'https://rails.rubystyle.guide/#no-match-routes' - Enabled: 'pending' - VersionAdded: '2.7' - Include: - - config/routes.rb - - config/routes/**/*.rb - -Rails/MigrationClassName: - Description: 'The class name of the migration should match its file name.' - Enabled: pending - VersionAdded: '2.14' - Include: - - db/migrate/*.rb - -Rails/NegateInclude: - Description: 'Prefer `collection.exclude?(obj)` over `!collection.include?(obj)`.' - StyleGuide: 'https://rails.rubystyle.guide#exclude' - Enabled: 'pending' - Safe: false - VersionAdded: '2.7' - VersionChanged: '2.9' - -Rails/NotNullColumn: - Description: 'Do not add a NOT NULL column without a default value.' - Enabled: true - VersionAdded: '0.43' - Include: - - db/migrate/*.rb - -Rails/OrderById: - Description: >- - Do not use the `id` column for ordering. - Use a timestamp column to order chronologically. - StyleGuide: 'https://rails.rubystyle.guide/#order-by-id' - Enabled: false - VersionAdded: '2.8' - -Rails/Output: - Description: 'Checks for calls to puts, print, etc.' - Enabled: true - SafeAutoCorrect: false - VersionAdded: '0.15' - VersionChanged: '0.19' - Include: - - app/**/*.rb - - config/**/*.rb - - db/**/*.rb - - lib/**/*.rb - -Rails/OutputSafety: - Description: 'The use of `html_safe` or `raw` may be a security risk.' - Enabled: true - VersionAdded: '0.41' - -Rails/Pick: - Description: 'Prefer `pick` over `pluck(...).first`.' - StyleGuide: 'https://rails.rubystyle.guide#pick' - Enabled: true - Safe: false - VersionAdded: '2.6' - -Rails/Pluck: - Description: 'Prefer `pluck` over `map { ... }`.' - StyleGuide: 'https://rails.rubystyle.guide#pluck' - Enabled: 'pending' - Safe: false - VersionAdded: '2.7' - VersionChanged: '2.18' - -Rails/PluckId: - Description: 'Use `ids` instead of `pluck(:id)` or `pluck(primary_key)`.' - StyleGuide: 'https://rails.rubystyle.guide/#ids' - Enabled: false - Safe: false - VersionAdded: '2.7' - -Rails/PluckInWhere: - Description: 'Use `select` instead of `pluck` in `where` query methods.' - Enabled: 'pending' - Safe: false - VersionAdded: '2.7' - VersionChanged: '2.8' - EnforcedStyle: conservative - SupportedStyles: - - conservative - - aggressive - -Rails/PluralizationGrammar: - Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.' - Enabled: true - VersionAdded: '0.35' - -Rails/Presence: - Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.' - Enabled: true - VersionAdded: '0.52' - -Rails/Present: - Description: 'Enforces use of `present?`.' - Enabled: true - VersionAdded: '0.48' - VersionChanged: '0.67' - # Convert usages of `!nil? && !empty?` to `present?` - NotNilAndNotEmpty: true - # Convert usages of `!blank?` to `present?` - NotBlank: true - # Convert usages of `unless blank?` to `if present?` - UnlessBlank: true - -Rails/RakeEnvironment: - Description: 'Include `:environment` as a dependency for all Rake tasks.' - Enabled: true - Safe: false - VersionAdded: '2.4' - VersionChanged: '2.6' - Include: - - '**/Rakefile' - - '**/*.rake' - Exclude: - - 'lib/capistrano/tasks/**/*.rake' - -Rails/ReadWriteAttribute: - Description: >- - Checks for read_attribute(:attr) and - write_attribute(:attr, val). - StyleGuide: 'https://rails.rubystyle.guide#read-attribute' - Enabled: true - VersionAdded: '0.20' - VersionChanged: '0.29' - Include: - - app/models/**/*.rb - -Rails/RedundantAllowNil: - Description: >- - Finds redundant use of `allow_nil` when `allow_blank` is set to - certain values in model validations. - Enabled: true - VersionAdded: '0.67' - Include: - - app/models/**/*.rb - -Rails/RedundantForeignKey: - Description: 'Checks for associations where the `:foreign_key` option is redundant.' - Enabled: true - VersionAdded: '2.6' - -Rails/RedundantPresenceValidationOnBelongsTo: - Description: 'Checks for redundant presence validation on belongs_to association.' - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '2.13' - -Rails/RedundantReceiverInWithOptions: - Description: 'Checks for redundant receiver in `with_options`.' - Enabled: true - VersionAdded: '0.52' - -Rails/RedundantTravelBack: - Description: Checks for redundant `travel_back` calls. - Enabled: pending - VersionAdded: '2.12' - Include: - - spec/**/*.rb - - test/**/*.rb - -Rails/ReflectionClassName: - Description: 'Use a string for `class_name` option value in the definition of a reflection.' - Enabled: true - Safe: false - VersionAdded: '0.64' - VersionChanged: '2.10' - -Rails/RefuteMethods: - Description: 'Use `assert_not` methods instead of `refute` methods.' - Enabled: true - VersionAdded: '0.56' - EnforcedStyle: assert_not - SupportedStyles: - - assert_not - - refute - Include: - - '**/test/**/*' - -Rails/RelativeDateConstant: - Description: 'Do not assign relative date to constants.' - Enabled: true - SafeAutoCorrect: false - VersionAdded: '0.48' - VersionChanged: '2.13' - -Rails/RenderInline: - Description: 'Prefer using a template over inline rendering.' - StyleGuide: 'https://rails.rubystyle.guide/#inline-rendering' - Enabled: 'pending' - VersionAdded: '2.7' - -Rails/RenderPlainText: - Description: 'Prefer `render plain:` over `render text:`.' - StyleGuide: 'https://rails.rubystyle.guide/#plain-text-rendering' - Enabled: 'pending' - VersionAdded: '2.7' - # Convert only when `content_type` is explicitly set to `text/plain`. - ContentTypeCompatibility: true - -Rails/RequestReferer: - Description: 'Use consistent syntax for request.referer.' - Enabled: true - VersionAdded: '0.41' - EnforcedStyle: referer - SupportedStyles: - - referer - - referrer - -Rails/RequireDependency: - Description: 'Do not use `require_dependency` when running in Zeitwerk mode. `require_dependency` is for autoloading in classic mode.' - Reference: 'https://guides.rubyonrails.org/autoloading_and_reloading_constants.html' - Enabled: false - VersionAdded: '2.10' - -Rails/ResponseParsedBody: - Description: Prefer `response.parsed_body` to `JSON.parse(response.body)`. - Enabled: pending - Safe: false - VersionAdded: '2.18' - VersionChanged: '2.19' - Include: - - spec/controllers/**/*.rb - - spec/requests/**/*.rb - - test/controllers/**/*.rb - - test/integration/**/*.rb - -Rails/ReversibleMigration: - Description: 'Checks whether the change method of the migration file is reversible.' - StyleGuide: 'https://rails.rubystyle.guide#reversible-migration' - Reference: 'https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html' - Enabled: true - VersionAdded: '0.47' - VersionChanged: '2.13' - Include: - - db/**/*.rb - -Rails/ReversibleMigrationMethodDefinition: - Description: 'Checks whether the migration implements either a `change` method or both an `up` and a `down` method.' - Enabled: false - VersionAdded: '2.10' - VersionChanged: '2.13' - Include: - - db/**/*.rb - -Rails/RootJoinChain: - Description: 'Use a single `#join` instead of chaining on `Rails.root` or `Rails.public_path`.' - Enabled: pending - VersionAdded: '2.13' - -Rails/RootPathnameMethods: - Description: 'Use `Rails.root` IO methods instead of passing it to `File`.' - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '2.16' - -Rails/RootPublicPath: - Description: "Favor `Rails.public_path` over `Rails.root` with `'public'`." - Enabled: pending - VersionAdded: '2.15' - -Rails/SafeNavigation: - Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`." - Enabled: true - VersionAdded: '0.43' - # This will convert usages of `try` to use safe navigation as well as `try!`. - # `try` and `try!` work slightly differently. `try!` and safe navigation will - # both raise a `NoMethodError` if the receiver of the method call does not - # implement the intended method. `try` will not raise an exception for this. - ConvertTry: false - -Rails/SafeNavigationWithBlank: - Description: 'Avoid `foo&.blank?` in conditionals.' - Enabled: true - VersionAdded: '2.4' - # While the safe navigation operator is generally a good idea, when - # checking `foo&.blank?` in a conditional, `foo` being `nil` will actually - # do the opposite of what the author intends. - # - # foo&.blank? #=> nil - # foo.blank? #=> true - SafeAutoCorrect: false - -Rails/SaveBang: - Description: 'Identifies possible cases where Active Record save! or related should be used.' - StyleGuide: 'https://rails.rubystyle.guide#save-bang' - Enabled: false - VersionAdded: '0.42' - VersionChanged: '0.59' - AllowImplicitReturn: true - AllowedReceivers: [] - SafeAutoCorrect: false - -Rails/SchemaComment: - Description: >- - Enforces the use of the `comment` option when adding a new table or column - to the database during a migration. - Enabled: false - VersionAdded: '2.13' - -Rails/ScopeArgs: - Description: 'Checks the arguments of ActiveRecord scopes.' - Enabled: true - VersionAdded: '0.19' - VersionChanged: '2.12' - Include: - - app/models/**/*.rb - -Rails/ShortI18n: - Description: 'Use the short form of the I18n methods: `t` instead of `translate` and `l` instead of `localize`.' - StyleGuide: 'https://rails.rubystyle.guide/#short-i18n' - Enabled: 'pending' - VersionAdded: '2.7' - EnforcedStyle: conservative - SupportedStyles: - - conservative - - aggressive - -Rails/SkipsModelValidations: - Description: >- - Use methods that skips model validations with caution. - See reference for more information. - Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations' - Enabled: true - VersionAdded: '0.47' - VersionChanged: '2.7' - ForbiddenMethods: - - decrement! - - decrement_counter - - increment! - - increment_counter - - insert - - insert! - - insert_all - - insert_all! - - toggle! - - touch - - touch_all - - update_all - - update_attribute - - update_column - - update_columns - - update_counters - - upsert - - upsert_all - AllowedMethods: [] - -Rails/SquishedSQLHeredocs: - Description: 'Checks SQL heredocs to use `.squish`.' - StyleGuide: 'https://rails.rubystyle.guide/#squished-heredocs' - Enabled: 'pending' - VersionAdded: '2.8' - VersionChanged: '2.9' - # Some SQL syntax (e.g. PostgreSQL comments and functions) requires newlines - # to be preserved in order to work, thus autocorrection is not safe. - SafeAutoCorrect: false - -Rails/StripHeredoc: - Description: 'Enforces the use of squiggly heredoc over `strip_heredoc`.' - StyleGuide: 'https://rails.rubystyle.guide/#prefer-squiggly-heredoc' - Enabled: pending - VersionAdded: '2.15' - -Rails/TableNameAssignment: - Description: >- - Do not use `self.table_name =`. Use Inflections or `table_name_prefix` instead. - StyleGuide: 'https://rails.rubystyle.guide/#keep-ar-defaults' - Enabled: false - VersionAdded: '2.14' - Include: - - app/models/**/*.rb - -Rails/ThreeStateBooleanColumn: - Description: 'Add a default value and a `NOT NULL` constraint to boolean columns.' - StyleGuide: 'https://rails.rubystyle.guide/#three-state-boolean' - Enabled: pending - VersionAdded: '2.19' - Include: - - db/**/*.rb - -Rails/TimeZone: - Description: 'Checks the correct usage of time zone aware methods.' - StyleGuide: 'https://rails.rubystyle.guide#time' - Reference: 'http://danilenko.org/2012/7/6/rails_timezones' - Enabled: true - SafeAutoCorrect: false - VersionAdded: '0.30' - VersionChanged: '2.13' - # The value `strict` means that `Time` should be used with `zone`. - # The value `flexible` allows usage of `in_time_zone` instead of `zone`. - EnforcedStyle: flexible - SupportedStyles: - - strict - - flexible - Exclude: - - '**/*.gemspec' - -Rails/TimeZoneAssignment: - Description: 'Prefer the usage of `Time.use_zone` instead of manually updating `Time.zone` value.' - Reference: 'https://thoughtbot.com/blog/its-about-time-zones' - Enabled: 'pending' - VersionAdded: '2.10' - Include: - - spec/**/*.rb - - test/**/*.rb - -Rails/ToFormattedS: - Description: 'Checks for consistent uses of `to_fs` or `to_formatted_s`.' - StyleGuide: 'https://rails.rubystyle.guide/#prefer-to-fs' - Enabled: pending - EnforcedStyle: to_fs - SupportedStyles: - - to_fs - - to_formatted_s - VersionAdded: '2.15' - -Rails/ToSWithArgument: - Description: 'Identifies passing any argument to `#to_s`.' - Enabled: pending - Safe: false - VersionAdded: '2.16' - -Rails/TopLevelHashWithIndifferentAccess: - Description: 'Identifies top-level `HashWithIndifferentAccess`.' - Reference: 'https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#top-level-hashwithindifferentaccess-is-soft-deprecated' - Enabled: pending - Severity: warning - VersionAdded: '2.16' - VersionChanged: '2.18' - -Rails/TransactionExitStatement: - Description: 'Avoid the usage of `return`, `break` and `throw` in transaction blocks.' - Reference: - - https://github.com/rails/rails/commit/15aa4200e083 - Enabled: pending - VersionAdded: '2.14' - -Rails/UniqBeforePluck: - Description: 'Prefer the use of uniq or distinct before pluck.' - Enabled: true - VersionAdded: '0.40' - VersionChanged: '2.13' - EnforcedStyle: conservative - SupportedStyles: - - conservative - - aggressive - SafeAutoCorrect: false - -Rails/UniqueValidationWithoutIndex: - Description: 'Uniqueness validation should have a unique index on the database column.' - Enabled: true - VersionAdded: '2.5' - Include: - - app/models/**/*.rb - -Rails/UnknownEnv: - Description: 'Use correct environment name.' - Enabled: true - Severity: warning - VersionAdded: '0.51' - VersionChanged: '2.18' - Environments: - - development - - test - - production - -Rails/UnusedIgnoredColumns: - Description: 'Remove a column that does not exist from `ignored_columns`.' - Enabled: pending - VersionAdded: '2.11' - Include: - - app/models/**/*.rb - -Rails/Validation: - Description: 'Use validates :attribute, hash of validations.' - Enabled: true - VersionAdded: '0.9' - VersionChanged: '0.41' - Include: - - app/models/**/*.rb - -Rails/WhereEquals: - Description: 'Pass conditions to `where` as a hash instead of manually constructing SQL.' - StyleGuide: 'https://rails.rubystyle.guide/#hash-conditions' - Enabled: 'pending' - SafeAutoCorrect: false - VersionAdded: '2.9' - VersionChanged: '2.10' - -Rails/WhereExists: - Description: 'Prefer `exists?(...)` over `where(...).exists?`.' - Enabled: 'pending' - SafeAutoCorrect: false - EnforcedStyle: exists - SupportedStyles: - - exists - - where - VersionAdded: '2.7' - VersionChanged: '2.10' - -Rails/WhereMissing: - Description: 'Use `where.missing(...)` to find missing relationship records.' - StyleGuide: 'https://rails.rubystyle.guide/#finding-missing-relationship-records' - Enabled: pending - VersionAdded: '2.16' - -Rails/WhereNot: - Description: 'Use `where.not(...)` instead of manually constructing negated SQL in `where`.' - StyleGuide: 'https://rails.rubystyle.guide/#hash-conditions' - Enabled: 'pending' - VersionAdded: '2.8' - -Rails/WhereNotWithMultipleConditions: - Description: 'Do not use `where.not(...)` with multiple conditions.' - StyleGuide: 'https://rails.rubystyle.guide/#where-not-with-multiple-attributes' - Enabled: 'pending' - Severity: warning - VersionAdded: '2.17' - VersionChanged: '2.18' - -# Accept `redirect_to(...) and return` and similar cases. -Style/AndOr: - EnforcedStyle: conditionals - -Style/FormatStringToken: - AllowedMethods: - - redirect - -Style/SymbolProc: - AllowedMethods: - - define_method - - mail - - respond_to diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/config/obsoletion.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/config/obsoletion.yml deleted file mode 100644 index b304073aa667e8..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/config/obsoletion.yml +++ /dev/null @@ -1,17 +0,0 @@ -# -# Configuration for obsoletion. -# -# See: https://docs.rubocop.org/rubocop/extensions.html#config-obsoletions -# -extracted: - Rails/*: ~ - -# Cop parameters that have been changed -# Can be treated as a warning instead of a failure with `severity: warning` -changed_parameters: - - cops: Rails/FindEach - parameters: IgnoredMethods - alternatives: - - AllowedMethods - - AllowedPatterns - severity: warning diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop-rails.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop-rails.rb deleted file mode 100644 index bda8121ed737d4..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop-rails.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -require 'rubocop' -require 'rack/utils' -require 'active_support/inflector' -require 'active_support/core_ext/object/blank' - -require_relative 'rubocop/rails' -require_relative 'rubocop/rails/version' -require_relative 'rubocop/rails/inject' -require_relative 'rubocop/rails/schema_loader' -require_relative 'rubocop/rails/schema_loader/schema' - -RuboCop::Rails::Inject.defaults! - -require_relative 'rubocop/cop/rails_cops' - -RuboCop::Cop::Style::HashExcept.minimum_target_ruby_version(2.0) - -RuboCop::Cop::Style::MethodCallWithArgsParentheses.singleton_class.prepend( - Module.new do - def autocorrect_incompatible_with - super.push(RuboCop::Cop::Rails::EagerEvaluationLogMessage) - end - end -) - -RuboCop::Cop::Style::RedundantSelf.singleton_class.prepend( - Module.new do - def autocorrect_incompatible_with - super.push(RuboCop::Cop::Rails::SafeNavigation) - end - end -) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/active_record_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/active_record_helper.rb deleted file mode 100644 index ca5cfd6ab4c7b0..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/active_record_helper.rb +++ /dev/null @@ -1,106 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - # A mixin to extend cops for Active Record features - module ActiveRecordHelper - extend NodePattern::Macros - - WHERE_METHODS = %i[where rewhere].freeze - - def_node_matcher :active_record?, <<~PATTERN - { - (const {nil? cbase} :ApplicationRecord) - (const (const {nil? cbase} :ActiveRecord) :Base) - } - PATTERN - - def_node_search :find_set_table_name, <<~PATTERN - (send self :table_name= {str sym}) - PATTERN - - def_node_search :find_belongs_to, <<~PATTERN - (send nil? :belongs_to {str sym} ...) - PATTERN - - def inherit_active_record_base?(node) - node.each_ancestor(:class).any? { |class_node| active_record?(class_node.parent_class) } - end - - def external_dependency_checksum - return @external_dependency_checksum if defined?(@external_dependency_checksum) - - schema_path = RuboCop::Rails::SchemaLoader.db_schema_path - return nil if schema_path.nil? - - schema_code = File.read(schema_path) - - @external_dependency_checksum ||= Digest::SHA1.hexdigest(schema_code) - end - - def schema - RuboCop::Rails::SchemaLoader.load(target_ruby_version) - end - - def table_name(class_node) - table_name = find_set_table_name(class_node).to_a.last&.first_argument - return table_name.value.to_s if table_name - - class_nodes = class_node.defined_module.each_node - namespaces = class_node.each_ancestor(:class, :module).map(&:identifier) - [*class_nodes, *namespaces].reverse.map { |node| node.children[1] }.join('_').tableize - end - - # Resolve relation into column name. - # It just returns column_name if the column exists. - # Or it tries to resolve column_name as a relation. - # Returns an array of column names if the relation is polymorphic. - # It returns `nil` if it can't resolve. - # - # @param name [String] - # @param class_node [RuboCop::AST::Node] - # @param table [RuboCop::Rails::SchemaLoader::Table] - # @return [Array, String, nil] - def resolve_relation_into_column(name:, class_node:, table:) - return unless table - return name if table.with_column?(name: name) - - find_belongs_to(class_node) do |belongs_to| - next unless belongs_to.first_argument.value.to_s == name - - fk = foreign_key_of(belongs_to) || "#{name}_id" - next unless table.with_column?(name: fk) - - return polymorphic?(belongs_to) ? [fk, "#{name}_type"] : fk - end - nil - end - - def foreign_key_of(belongs_to) - options = belongs_to.last_argument - return unless options.hash_type? - - options.each_pair.find do |pair| - next unless pair.key.sym_type? && pair.key.value == :foreign_key - next unless pair.value.sym_type? || pair.value.str_type? - - break pair.value.value.to_s - end - end - - def polymorphic?(belongs_to) - options = belongs_to.last_argument - return false unless options.hash_type? - - options.each_pair.any? do |pair| - pair.key.sym_type? && pair.key.value == :polymorphic && pair.value.true_type? - end - end - - def in_where?(node) - send_node = node.each_ancestor(:send).first - send_node && WHERE_METHODS.include?(send_node.method_name) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/active_record_migrations_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/active_record_migrations_helper.rb deleted file mode 100644 index 0364f2b99d78c8..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/active_record_migrations_helper.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - # A mixin to extend cops for Active Record features - module ActiveRecordMigrationsHelper - extend NodePattern::Macros - - RAILS_ABSTRACT_SCHEMA_DEFINITIONS = %i[ - bigint binary boolean date datetime decimal float integer json string - text time timestamp virtual - ].freeze - RAILS_ABSTRACT_SCHEMA_DEFINITIONS_HELPERS = %i[column references belongs_to primary_key numeric].freeze - POSTGRES_SCHEMA_DEFINITIONS = %i[ - bigserial bit bit_varying cidr citext daterange hstore inet interval - int4range int8range jsonb ltree macaddr money numrange oid point line - lseg box path polygon circle serial tsrange tstzrange tsvector uuid xml - ].freeze - MYSQL_SCHEMA_DEFINITIONS = %i[ - blob tinyblob mediumblob longblob tinytext mediumtext longtext - unsigned_integer unsigned_bigint unsigned_float unsigned_decimal - ].freeze - - def_node_matcher :create_table_with_block?, <<~PATTERN - (block - (send nil? :create_table ...) - (args (arg _var)) - _) - PATTERN - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/class_send_node_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/class_send_node_helper.rb deleted file mode 100644 index e68737d47fe7b7..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/class_send_node_helper.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - # A mixin to return all of the class send nodes. - module ClassSendNodeHelper - def class_send_nodes(class_node) - class_def = class_node.body - - return [] unless class_def - - if class_def.send_type? - [class_def] - else - class_def.each_child_node(:send) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/enforce_superclass.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/enforce_superclass.rb deleted file mode 100644 index 59f9763a60d228..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/enforce_superclass.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - # Common functionality for enforcing a specific superclass. - module EnforceSuperclass - def self.included(base) - base.def_node_matcher :class_definition, <<~PATTERN - (class (const _ !:#{base::SUPERCLASS}) #{base::BASE_PATTERN} ...) - PATTERN - - base.def_node_matcher :class_new_definition, <<~PATTERN - [!^(casgn {nil? cbase} :#{base::SUPERCLASS} ...) - !^^(casgn {nil? cbase} :#{base::SUPERCLASS} (block ...)) - (send (const {nil? cbase} :Class) :new #{base::BASE_PATTERN})] - PATTERN - end - - def on_class(node) - class_definition(node) do - register_offense(node.children[1]) - end - end - - def on_send(node) - class_new_definition(node) do - register_offense(node.children.last) - end - end - - private - - def register_offense(offense_node) - add_offense(offense_node) do |corrector| - corrector.replace(offense_node, self.class::SUPERCLASS) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/index_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/index_method.rb deleted file mode 100644 index 23ba0daae521cc..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/index_method.rb +++ /dev/null @@ -1,165 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - # Common functionality for Rails/IndexBy and Rails/IndexWith - module IndexMethod # rubocop:disable Metrics/ModuleLength - RESTRICT_ON_SEND = %i[each_with_object to_h map collect []].freeze - - def on_block(node) # rubocop:todo InternalAffairs/NumblockHandler - on_bad_each_with_object(node) do |*match| - handle_possible_offense(node, match, 'each_with_object') - end - - return if target_ruby_version < 2.6 - - on_bad_to_h(node) do |*match| - handle_possible_offense(node, match, 'to_h { ... }') - end - end - - def on_send(node) - on_bad_map_to_h(node) do |*match| - handle_possible_offense(node, match, 'map { ... }.to_h') - end - - on_bad_hash_brackets_map(node) do |*match| - handle_possible_offense(node, match, 'Hash[map { ... }]') - end - end - - def on_csend(node) - on_bad_map_to_h(node) do |*match| - handle_possible_offense(node, match, 'map { ... }.to_h') - end - end - - private - - # @abstract Implemented with `def_node_matcher` - def on_bad_each_with_object(_node) - raise NotImplementedError - end - - # @abstract Implemented with `def_node_matcher` - def on_bad_to_h(_node) - raise NotImplementedError - end - - # @abstract Implemented with `def_node_matcher` - def on_bad_map_to_h(_node) - raise NotImplementedError - end - - # @abstract Implemented with `def_node_matcher` - def on_bad_hash_brackets_map(_node) - raise NotImplementedError - end - - def handle_possible_offense(node, match, match_desc) - captures = extract_captures(match) - - return if captures.noop_transformation? - - add_offense( - node, message: "Prefer `#{new_method_name}` over `#{match_desc}`." - ) do |corrector| - correction = prepare_correction(node) - execute_correction(corrector, node, correction) - end - end - - def extract_captures(match) - argname, body_expr = *match - Captures.new(argname, body_expr) - end - - def new_method_name - raise NotImplementedError - end - - def prepare_correction(node) - if (match = on_bad_each_with_object(node)) - Autocorrection.from_each_with_object(node, match) - elsif (match = on_bad_to_h(node)) - Autocorrection.from_to_h(node, match) - elsif (match = on_bad_map_to_h(node)) - Autocorrection.from_map_to_h(node, match) - elsif (match = on_bad_hash_brackets_map(node)) - Autocorrection.from_hash_brackets_map(node, match) - else - raise 'unreachable' - end - end - - def execute_correction(corrector, node, correction) - correction.strip_prefix_and_suffix(node, corrector) - correction.set_new_method_name(new_method_name, corrector) - - captures = extract_captures(correction.match) - correction.set_new_arg_name(captures.transformed_argname, corrector) - correction.set_new_body_expression(captures.transforming_body_expr, corrector) - end - - # Internal helper class to hold match data - Captures = Struct.new( - :transformed_argname, - :transforming_body_expr - ) do - def noop_transformation? - transforming_body_expr.lvar_type? && transforming_body_expr.children == [transformed_argname] - end - end - - # Internal helper class to hold autocorrect data - Autocorrection = Struct.new(:match, :block_node, :leading, :trailing) do - def self.from_each_with_object(node, match) - new(match, node, 0, 0) - end - - def self.from_to_h(node, match) - new(match, node, 0, 0) - end - - def self.from_map_to_h(node, match) - strip_trailing_chars = 0 - - unless node.parent&.block_type? - map_range = node.children.first.source_range - node_range = node.source_range - strip_trailing_chars = node_range.end_pos - map_range.end_pos - end - - new(match, node.children.first, 0, strip_trailing_chars) - end - - def self.from_hash_brackets_map(node, match) - new(match, node.children.last, "#{node.receiver.source}[".length, ']'.length) - end - - def strip_prefix_and_suffix(node, corrector) - expression = node.source_range - corrector.remove_leading(expression, leading) - corrector.remove_trailing(expression, trailing) - end - - def set_new_method_name(new_method_name, corrector) - range = block_node.send_node.loc.selector - if (send_end = block_node.send_node.loc.end) - # If there are arguments (only true in the `each_with_object` case) - range = range.begin.join(send_end) - end - corrector.replace(range, new_method_name) - end - - def set_new_arg_name(transformed_argname, corrector) - corrector.replace(block_node.arguments, "|#{transformed_argname}|") - end - - def set_new_body_expression(transforming_body_expr, corrector) - corrector.replace(block_node.body, transforming_body_expr.source) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/migrations_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/migrations_helper.rb deleted file mode 100644 index 76dedda41f917f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/migrations_helper.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - # Common functionality for cops working with migrations - module MigrationsHelper - extend NodePattern::Macros - - def_node_matcher :migration_class?, <<~PATTERN - (class - (const {nil? cbase} _) - (send - (const (const {nil? cbase} :ActiveRecord) :Migration) - :[] - (float _)) - _) - PATTERN - - def in_migration?(node) - node.each_ancestor(:class).any? do |class_node| - migration_class?(class_node) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/target_rails_version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/target_rails_version.rb deleted file mode 100644 index 6f9021407fddfd..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/mixin/target_rails_version.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - # Common functionality for checking target rails version. - module TargetRailsVersion - def minimum_target_rails_version(version) - @minimum_target_rails_version = version - end - - def support_target_rails_version?(version) - @minimum_target_rails_version <= version - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/action_controller_flash_before_render.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/action_controller_flash_before_render.rb deleted file mode 100644 index 589d33795d0cc4..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/action_controller_flash_before_render.rb +++ /dev/null @@ -1,112 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Using `flash` assignment before `render` in Rails controllers will persist the message for too long. - # Check https://guides.rubyonrails.org/action_controller_overview.html#flash-now - # - # @safety - # This cop's autocorrection is unsafe because it replaces `flash` by `flash.now`. - # Even though it is usually a mistake, it might be used intentionally. - # - # @example - # - # # bad - # class HomeController < ApplicationController - # def create - # flash[:alert] = "msg" - # render :index - # end - # end - # - # # good - # class HomeController < ApplicationController - # def create - # flash.now[:alert] = "msg" - # render :index - # end - # end - # - class ActionControllerFlashBeforeRender < Base - extend AutoCorrector - - MSG = 'Use `flash.now` before `render`.' - - def_node_search :flash_assignment?, <<~PATTERN - ^(send (send nil? :flash) :[]= ...) - PATTERN - - def_node_search :render?, <<~PATTERN - (send nil? :render ...) - PATTERN - - def_node_search :action_controller?, <<~PATTERN - { - (const {nil? cbase} :ApplicationController) - (const (const {nil? cbase} :ActionController) :Base) - } - PATTERN - - RESTRICT_ON_SEND = [:flash].freeze - - def on_send(flash_node) - return unless flash_assignment?(flash_node) - - return unless followed_by_render?(flash_node) - - return unless instance_method_or_block?(flash_node) - - return unless inherit_action_controller_base?(flash_node) - - add_offense(flash_node) do |corrector| - corrector.replace(flash_node, 'flash.now') - end - end - - private - - def followed_by_render?(flash_node) - flash_assignment_node = find_ancestor(flash_node, type: :send) - context = flash_assignment_node - if (node = context.each_ancestor(:if, :rescue).first) - return false if use_redirect_to?(context) - - context = node - elsif context.right_siblings.empty? - return true - end - context = context.right_siblings - - context.compact.any? do |render_candidate| - render?(render_candidate) - end - end - - def inherit_action_controller_base?(node) - class_node = find_ancestor(node, type: :class) - return unless class_node - - action_controller?(class_node) - end - - def instance_method_or_block?(node) - def_node = find_ancestor(node, type: :def) - block_node = find_ancestor(node, type: :block) - - def_node || block_node - end - - def use_redirect_to?(context) - context.right_siblings.compact.any? do |sibling| - sibling.send_type? && sibling.method?(:redirect_to) - end - end - - def find_ancestor(node, type:) - node.each_ancestor(type).first - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/action_controller_test_case.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/action_controller_test_case.rb deleted file mode 100644 index a78d1d12f4ff50..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/action_controller_test_case.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Using `ActionController::TestCase`` is discouraged and should be replaced by - # `ActionDispatch::IntegrationTest``. Controller tests are too close to the - # internals of a controller whereas integration tests mimic the browser/user. - # - # @safety - # This cop's autocorrection is unsafe because the API of each test case class is different. - # Make sure to update each test of your controller test cases after changing the superclass. - # - # @example - # # bad - # class MyControllerTest < ActionController::TestCase - # end - # - # # good - # class MyControllerTest < ActionDispatch::IntegrationTest - # end - # - class ActionControllerTestCase < Base - extend AutoCorrector - extend TargetRailsVersion - - MSG = 'Use `ActionDispatch::IntegrationTest` instead.' - - minimum_target_rails_version 5.0 - - def_node_matcher :action_controller_test_case?, <<~PATTERN - (class - (const _ _) - (const (const {nil? cbase} :ActionController) :TestCase) _) - PATTERN - - def on_class(node) - return unless action_controller_test_case?(node) - - add_offense(node.parent_class) do |corrector| - corrector.replace(node.parent_class, 'ActionDispatch::IntegrationTest') - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/action_filter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/action_filter.rb deleted file mode 100644 index e144568e8a205c..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/action_filter.rb +++ /dev/null @@ -1,107 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces the consistent use of action filter methods. - # - # The cop is configurable and can enforce the use of the older - # something_filter methods or the newer something_action methods. - # - # @example EnforcedStyle: action (default) - # # bad - # after_filter :do_stuff - # append_around_filter :do_stuff - # skip_after_filter :do_stuff - # - # # good - # after_action :do_stuff - # append_around_action :do_stuff - # skip_after_action :do_stuff - # - # @example EnforcedStyle: filter - # # bad - # after_action :do_stuff - # append_around_action :do_stuff - # skip_after_action :do_stuff - # - # # good - # after_filter :do_stuff - # append_around_filter :do_stuff - # skip_after_filter :do_stuff - class ActionFilter < Base - include ConfigurableEnforcedStyle - extend AutoCorrector - - MSG = 'Prefer `%s` over `%s`.' - - FILTER_METHODS = %i[ - after_filter - append_after_filter - append_around_filter - append_before_filter - around_filter - before_filter - prepend_after_filter - prepend_around_filter - prepend_before_filter - skip_after_filter - skip_around_filter - skip_before_filter - skip_filter - ].freeze - - ACTION_METHODS = %i[ - after_action - append_after_action - append_around_action - append_before_action - around_action - before_action - prepend_after_action - prepend_around_action - prepend_before_action - skip_after_action - skip_around_action - skip_before_action - skip_action_callback - ].freeze - - RESTRICT_ON_SEND = FILTER_METHODS + ACTION_METHODS - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - check_method_node(node.send_node) - end - - def on_send(node) - check_method_node(node) unless node.receiver - end - - private - - def check_method_node(node) - method_name = node.method_name - return unless bad_methods.include?(method_name) - - message = format(MSG, prefer: preferred_method(method_name), current: method_name) - - add_offense(node.loc.selector, message: message) do |corrector| - corrector.replace(node.loc.selector, preferred_method(node.loc.selector.source)) - end - end - - def bad_methods - style == :action ? FILTER_METHODS : ACTION_METHODS - end - - def good_methods - style == :action ? ACTION_METHODS : FILTER_METHODS - end - - def preferred_method(method) - good_methods[bad_methods.index(method.to_sym)] - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/action_order.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/action_order.rb deleted file mode 100644 index a2bcd3b46234b9..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/action_order.rb +++ /dev/null @@ -1,116 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces consistent ordering of the standard Rails RESTful controller actions. - # - # The cop is configurable and can enforce any ordering of the standard actions. - # All other methods are ignored. So, the actions specified in `ExpectedOrder` should be - # defined before actions not specified. - # - # [source,yaml] - # ---- - # Rails/ActionOrder: - # ExpectedOrder: - # - index - # - show - # - new - # - edit - # - create - # - update - # - destroy - # ---- - # - # @example - # # bad - # def index; end - # def destroy; end - # def show; end - # - # # good - # def index; end - # def show; end - # def destroy; end - class ActionOrder < Base - extend AutoCorrector - include VisibilityHelp - include DefNode - include RangeHelp - - MSG = 'Action `%s` should appear before `%s`.' - - def_node_search :action_declarations, '(def {%1} ...)' - - def on_class(node) - action_declarations(node, actions).each_cons(2) do |previous, current| - next if node_visibility(current) != :public || non_public?(current) - next if find_index(current) >= find_index(previous) - - register_offense(previous, current) - end - end - - private - - def expected_order - cop_config['ExpectedOrder'].map(&:to_sym) - end - - def actions - @actions ||= Set.new(expected_order) - end - - def find_index(node) - expected_order.find_index(node.method_name) - end - - def register_offense(previous, current) - message = format( - MSG, - expected_order: expected_order.join(', '), - previous: previous.method_name, - current: current.method_name - ) - add_offense(current, message: message) do |corrector| - current = correction_target(current) - previous = correction_target(previous) - - swap_range(corrector, current, previous) - end - end - - def correction_target(def_node) - range_with_comments_and_lines(def_node.each_ancestor(:if).first || def_node) - end - - def add_range(range1, range2) - range1.with( - begin_pos: [range1.begin_pos, range2.begin_pos].min, - end_pos: [range1.end_pos, range2.end_pos].max - ) - end - - def range_with_comments(node) - # rubocop:todo InternalAffairs/LocationExpression - # Using `RuboCop::Ext::Comment#source_range` requires RuboCop > 1.46, - # which introduces https://github.com/rubocop/rubocop/pull/11630. - ranges = [node, *processed_source.ast_with_comments[node]].map { |comment| comment.loc.expression } - # rubocop:enable InternalAffairs/LocationExpression - ranges.reduce do |result, range| - add_range(result, range) - end - end - - def range_with_comments_and_lines(node) - range_by_whole_lines(range_with_comments(node), include_final_newline: true) - end - - def swap_range(corrector, range1, range2) - corrector.insert_before(range2, range1.source) - corrector.remove(range1) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_record_aliases.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_record_aliases.rb deleted file mode 100644 index 8d0e802fa38b86..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_record_aliases.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks that ActiveRecord aliases are not used. The direct method names - # are more clear and easier to read. - # - # @safety - # This cop is unsafe because custom `update_attributes` method call was changed to - # `update` but the method name remained same in the method definition. - # - # @example - # #bad - # book.update_attributes!(author: 'Alice') - # - # #good - # book.update!(author: 'Alice') - class ActiveRecordAliases < Base - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s`.' - - ALIASES = { update_attributes: :update, update_attributes!: :update! }.freeze - - RESTRICT_ON_SEND = ALIASES.keys.freeze - - def on_send(node) - return if node.arguments.empty? - - method_name = node.method_name - alias_method = ALIASES[method_name] - - add_offense( - node.loc.selector, - message: format(MSG, prefer: alias_method, current: method_name), - severity: :warning - ) do |corrector| - corrector.replace(node.loc.selector, alias_method) - end - end - - alias on_csend on_send - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_record_callbacks_order.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_record_callbacks_order.rb deleted file mode 100644 index 8742e763384e2c..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_record_callbacks_order.rb +++ /dev/null @@ -1,143 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks that Active Record callbacks are declared - # in the order in which they will be executed. - # - # @example - # # bad - # class Person < ApplicationRecord - # after_commit :after_commit_callback - # before_validation :before_validation_callback - # end - # - # # good - # class Person < ApplicationRecord - # before_validation :before_validation_callback - # after_commit :after_commit_callback - # end - # - class ActiveRecordCallbacksOrder < Base - extend AutoCorrector - - MSG = '`%s` is supposed to appear before `%s`.' - - CALLBACKS_IN_ORDER = %i[ - after_initialize - before_validation - after_validation - before_save - around_save - before_create - around_create - after_create - before_update - around_update - after_update - before_destroy - around_destroy - after_destroy - after_save - after_commit - after_rollback - after_find - after_touch - ].freeze - - CALLBACKS_ORDER_MAP = CALLBACKS_IN_ORDER.each_with_index.to_h.freeze - - def on_class(class_node) - previous_index = -1 - previous_callback = nil - - defined_callbacks(class_node).each do |node| - callback = node.method_name - index = CALLBACKS_ORDER_MAP[callback] - - if index < previous_index - message = format(MSG, current: callback, previous: previous_callback) - add_offense(node, message: message) do |corrector| - autocorrect(corrector, node) - end - end - previous_index = index - previous_callback = callback - end - end - - private - - # Autocorrect by swapping between two nodes autocorrecting them - def autocorrect(corrector, node) - previous = node.left_siblings.reverse_each.find do |sibling| - callback?(sibling) - end - - current_range = source_range_with_comment(node) - previous_range = source_range_with_comment(previous) - - corrector.insert_before(previous_range, current_range.source) - corrector.remove(current_range) - end - - def defined_callbacks(class_node) - class_def = class_node.body - - if class_def - class_def.each_child_node.select { |c| callback?(c) } - else - [] - end - end - - def callback?(node) - node.send_type? && CALLBACKS_ORDER_MAP.key?(node.method_name) - end - - def source_range_with_comment(node) - begin_pos = begin_pos_with_comment(node) - end_pos = end_position_for(node) - - Parser::Source::Range.new(buffer, begin_pos, end_pos) - end - - def end_position_for(node) - end_line = buffer.line_for_position(node.source_range.end_pos) - buffer.line_range(end_line).end_pos - end - - def begin_pos_with_comment(node) - annotation_line = node.first_line - 1 - first_comment = nil - - processed_source.each_comment_in_lines(0..annotation_line).reverse_each do |comment| - if comment.location.line == annotation_line && !inline_comment?(comment) - first_comment = comment - annotation_line -= 1 - end - end - - start_line_position(first_comment || node) - end - - def inline_comment?(comment) - # rubocop:todo InternalAffairs/LocationExpression - # Using `RuboCop::Ext::Comment#source_range` requires RuboCop > 1.46, - # which introduces https://github.com/rubocop/rubocop/pull/11630. - !comment_line?(comment.loc.expression.source_line) - # rubocop:enable InternalAffairs/LocationExpression - end - - def start_line_position(node) - buffer.line_range(node.loc.line).begin_pos - 1 - end - - def buffer - processed_source.buffer - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_record_override.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_record_override.rb deleted file mode 100644 index 695643fb57f304..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_record_override.rb +++ /dev/null @@ -1,79 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for overriding built-in Active Record methods instead of using - # callbacks. - # - # @example - # # bad - # class Book < ApplicationRecord - # def save - # self.title = title.upcase! - # super - # end - # end - # - # # good - # class Book < ApplicationRecord - # before_save :upcase_title - # - # def upcase_title - # self.title = title.upcase! - # end - # end - # - class ActiveRecordOverride < Base - MSG = 'Use %s callbacks instead of overriding the Active Record method `%s`.' - BAD_METHODS = %i[create destroy save update].freeze - ACTIVE_RECORD_CLASSES = %w[ApplicationRecord ActiveModel::Base ActiveRecord::Base].freeze - - def on_def(node) - return unless BAD_METHODS.include?(node.method_name) - - parent_class_name = find_parent_class_name(node) - return unless active_model?(parent_class_name) - - return unless node.descendants.any?(&:zsuper_type?) - - add_offense(node, message: message(node.method_name)) - end - - private - - def active_model?(parent_class_name) - ACTIVE_RECORD_CLASSES.include?(parent_class_name) - end - - def callback_names(method_name) - names = %w[before_ around_ after_].map do |prefix| - "`#{prefix}#{method_name}`" - end - - names[-1] = "or #{names.last}" - - names.join(', ') - end - - def message(method_name) - format(MSG, prefer: callback_names(method_name), bad: method_name) - end - - def find_parent_class_name(node) - return nil unless node - - if node.class_type? - parent_class_name = node.node_parts[1] - - return nil if parent_class_name.nil? - - return parent_class_name.source - end - - find_parent_class_name(node.parent) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_support_aliases.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_support_aliases.rb deleted file mode 100644 index 312490da4b38ab..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_support_aliases.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks that ActiveSupport aliases to core ruby methods - # are not used. - # - # @example - # # good - # 'some_string'.start_with?('prefix') - # 'some_string'.end_with?('suffix') - # [1, 2, 'a'] << 'b' - # [1, 2, 'a'].unshift('b') - # - # # bad - # 'some_string'.starts_with?('prefix') - # 'some_string'.ends_with?('suffix') - # [1, 2, 'a'].append('b') - # [1, 2, 'a'].prepend('b') - # - class ActiveSupportAliases < Base - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s`.' - RESTRICT_ON_SEND = %i[starts_with? ends_with? append prepend].freeze - - ALIASES = { - starts_with?: { - original: :start_with?, matcher: '(send str :starts_with? _)' - }, - ends_with?: { - original: :end_with?, matcher: '(send str :ends_with? _)' - }, - append: { original: :<<, matcher: '(send array :append _)' }, - prepend: { original: :unshift, matcher: '(send array :prepend _)' } - }.freeze - - ALIASES.each do |aliased_method, options| - def_node_matcher aliased_method, options[:matcher] - end - - def on_send(node) - ALIASES.each_key do |aliased_method| - next unless public_send(aliased_method, node) - - preferred_method = ALIASES[aliased_method][:original] - message = format(MSG, prefer: preferred_method, current: aliased_method) - - add_offense(node, message: message) do |corrector| - next if append(node) - - corrector.replace(node.loc.selector, preferred_method) - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_support_on_load.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_support_on_load.rb deleted file mode 100644 index 1bb9f50d2b483b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/active_support_on_load.rb +++ /dev/null @@ -1,70 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for Rails framework classes that are patched directly instead of using Active Support load hooks. Direct - # patching forcibly loads the framework referenced, using hooks defers loading until it's actually needed. - # - # @safety - # While using lazy load hooks is recommended, it changes the order in which is code is loaded and may reveal - # load order dependency bugs. - # - # @example - # - # # bad - # ActiveRecord::Base.include(MyClass) - # - # # good - # ActiveSupport.on_load(:active_record) { include MyClass } - class ActiveSupportOnLoad < Base - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s`.' - RESTRICT_ON_SEND = %i[prepend include extend].freeze - LOAD_HOOKS = { - 'ActionCable' => 'action_cable', - 'ActionCable::Channel::Base' => 'action_cable_channel', - 'ActionCable::Connection::Base' => 'action_cable_connection', - 'ActionCable::Connection::TestCase' => 'action_cable_connection_test_case', - 'ActionController::API' => 'action_controller', - 'ActionController::Base' => 'action_controller', - 'ActionController::TestCase' => 'action_controller_test_case', - 'ActionDispatch::IntegrationTest' => 'action_dispatch_integration_test', - 'ActionDispatch::Request' => 'action_dispatch_request', - 'ActionDispatch::Response' => 'action_dispatch_response', - 'ActionDispatch::SystemTestCase' => 'action_dispatch_system_test_case', - 'ActionMailbox::Base' => 'action_mailbox', - 'ActionMailbox::InboundEmail' => 'action_mailbox_inbound_email', - 'ActionMailbox::Record' => 'action_mailbox_record', - 'ActionMailbox::TestCase' => 'action_mailbox_test_case', - 'ActionMailer::Base' => 'action_mailer', - 'ActionMailer::TestCase' => 'action_mailer_test_case', - 'ActionText::Content' => 'action_text_content', - 'ActionText::Record' => 'action_text_record', - 'ActionText::RichText' => 'action_text_rich_text', - 'ActionView::Base' => 'action_view', - 'ActionView::TestCase' => 'action_view_test_case', - 'ActiveJob::Base' => 'active_job', - 'ActiveJob::TestCase' => 'active_job_test_case', - 'ActiveRecord::Base' => 'active_record', - 'ActiveStorage::Attachment' => 'active_storage_attachment', - 'ActiveStorage::Blob' => 'active_storage_blob', - 'ActiveStorage::Record' => 'active_storage_record', - 'ActiveStorage::VariantRecord' => 'active_storage_variant_record', - 'ActiveSupport::TestCase' => 'active_support_test_case' - }.freeze - - def on_send(node) - receiver, method, arguments = *node # rubocop:disable InternalAffairs/NodeDestructuring - return unless receiver && (hook = LOAD_HOOKS[receiver.const_name]) - - preferred = "ActiveSupport.on_load(:#{hook}) { #{method} #{arguments.source} }" - add_offense(node, message: format(MSG, prefer: preferred, current: node.source)) do |corrector| - corrector.replace(node, preferred) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/add_column_index.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/add_column_index.rb deleted file mode 100644 index 6f58055695621c..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/add_column_index.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for migrations using `add_column` that have an `index` - # key. `add_column` does not accept `index`, but also does not raise an - # error for extra keys, so it is possible to mistakenly add the key without - # realizing it will not actually add an index. - # - # @example - # # bad (will not add an index) - # add_column :table, :column, :integer, index: true - # - # # good - # add_column :table, :column, :integer - # add_index :table, :column - # - class AddColumnIndex < Base - extend AutoCorrector - include RangeHelp - - MSG = '`add_column` does not accept an `index` key, use `add_index` instead.' - RESTRICT_ON_SEND = %i[add_column].freeze - - # @!method add_column_with_index(node) - def_node_matcher :add_column_with_index, <<~PATTERN - ( - send nil? :add_column $_table $_column - <(hash <$(pair {(sym :index) (str "index")} $_) ...>) ...> - ) - PATTERN - - def on_send(node) - table, column, pair, value = add_column_with_index(node) - return unless pair - - add_offense(pair) do |corrector| - corrector.remove(index_range(pair)) - - add_index = "add_index #{table.source}, #{column.source}" - add_index_opts = '' - - if value.hash_type? - hash = value.source_range.adjust(begin_pos: 1, end_pos: -1).source.strip - add_index_opts = ", #{hash}" - end - - corrector.insert_after(node, "\n#{add_index}#{add_index_opts}") - end - end - - private - - def index_range(pair_node) - range_with_surrounding_comma(range_with_surrounding_space(pair_node.source_range, side: :left), :left) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/after_commit_override.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/after_commit_override.rb deleted file mode 100644 index 070941de77af3e..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/after_commit_override.rb +++ /dev/null @@ -1,81 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces that there is only one call to `after_commit` - # (and its aliases - `after_create_commit`, `after_update_commit`, - # and `after_destroy_commit`) with the same callback name per model. - # - # @example - # # bad - # # This won't be triggered. - # after_create_commit :log_action - # - # # This will override the callback added by - # # after_create_commit. - # after_update_commit :log_action - # - # # bad - # # This won't be triggered. - # after_commit :log_action, on: :create - # # This won't be triggered. - # after_update_commit :log_action - # # This will override both previous callbacks. - # after_commit :log_action, on: :destroy - # - # # good - # after_save_commit :log_action - # - # # good - # after_create_commit :log_create_action - # after_update_commit :log_update_action - # - class AfterCommitOverride < Base - include ClassSendNodeHelper - - MSG = 'There can only be one `after_*_commit :%s` hook defined for a model.' - - AFTER_COMMIT_CALLBACKS = %i[ - after_commit - after_create_commit - after_update_commit - after_save_commit - after_destroy_commit - ].freeze - - def on_class(class_node) - seen_callback_names = {} - - each_after_commit_callback(class_node) do |node| - callback_name = node.arguments[0].value - if seen_callback_names.key?(callback_name) - add_offense(node, message: format(MSG, name: callback_name)) - else - seen_callback_names[callback_name] = true - end - end - end - - private - - def each_after_commit_callback(class_node) - class_send_nodes(class_node).each do |node| - yield node if after_commit_callback?(node) && named_callback?(node) - end - end - - def after_commit_callback?(node) - AFTER_COMMIT_CALLBACKS.include?(node.method_name) - end - - def named_callback?(node) - name = node.first_argument - return false unless name - - name.sym_type? - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/application_controller.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/application_controller.rb deleted file mode 100644 index d65fa3d8f75fc2..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/application_controller.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks that controllers subclass `ApplicationController`. - # - # @safety - # This cop's autocorrection is unsafe because it may let the logic from `ApplicationController` - # sneak into a controller that is not purposed to inherit logic common among other controllers. - # - # @example - # - # # good - # class MyController < ApplicationController - # # ... - # end - # - # # bad - # class MyController < ActionController::Base - # # ... - # end - class ApplicationController < Base - extend AutoCorrector - - MSG = 'Controllers should subclass `ApplicationController`.' - SUPERCLASS = 'ApplicationController' - BASE_PATTERN = '(const (const {nil? cbase} :ActionController) :Base)' - - # rubocop:disable Layout/ClassStructure - include RuboCop::Cop::EnforceSuperclass - # rubocop:enable Layout/ClassStructure - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/application_job.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/application_job.rb deleted file mode 100644 index b8d55cb419c36c..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/application_job.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks that jobs subclass `ApplicationJob` with Rails 5.0. - # - # @safety - # This cop's autocorrection is unsafe because it may let the logic from `ApplicationJob` - # sneak into a job that is not purposed to inherit logic common among other jobs. - # - # @example - # - # # good - # class Rails5Job < ApplicationJob - # # ... - # end - # - # # bad - # class Rails4Job < ActiveJob::Base - # # ... - # end - class ApplicationJob < Base - extend AutoCorrector - extend TargetRailsVersion - - minimum_target_rails_version 5.0 - - MSG = 'Jobs should subclass `ApplicationJob`.' - SUPERCLASS = 'ApplicationJob' - BASE_PATTERN = '(const (const {nil? cbase} :ActiveJob) :Base)' - - # rubocop:disable Layout/ClassStructure - include RuboCop::Cop::EnforceSuperclass - # rubocop:enable Layout/ClassStructure - - def autocorrect(node) - lambda do |corrector| - corrector.replace(node, self.class::SUPERCLASS) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/application_mailer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/application_mailer.rb deleted file mode 100644 index 256dc0385cfbf3..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/application_mailer.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks that mailers subclass `ApplicationMailer` with Rails 5.0. - # - # @safety - # This cop's autocorrection is unsafe because it may let the logic from `ApplicationMailer` - # sneak into a mailer that is not purposed to inherit logic common among other mailers. - # - # @example - # - # # good - # class MyMailer < ApplicationMailer - # # ... - # end - # - # # bad - # class MyMailer < ActionMailer::Base - # # ... - # end - class ApplicationMailer < Base - extend AutoCorrector - extend TargetRailsVersion - - minimum_target_rails_version 5.0 - - MSG = 'Mailers should subclass `ApplicationMailer`.' - SUPERCLASS = 'ApplicationMailer' - BASE_PATTERN = '(const (const {nil? cbase} :ActionMailer) :Base)' - - # rubocop:disable Layout/ClassStructure - include RuboCop::Cop::EnforceSuperclass - # rubocop:enable Layout/ClassStructure - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/application_record.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/application_record.rb deleted file mode 100644 index 91ee5e2aaff688..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/application_record.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks that models subclass `ApplicationRecord` with Rails 5.0. - # - # @safety - # This cop's autocorrection is unsafe because it may let the logic from `ApplicationRecord` - # sneak into an Active Record model that is not purposed to inherit logic common among other - # Active Record models. - # - # @example - # - # # good - # class Rails5Model < ApplicationRecord - # # ... - # end - # - # # bad - # class Rails4Model < ActiveRecord::Base - # # ... - # end - class ApplicationRecord < Base - extend AutoCorrector - extend TargetRailsVersion - - minimum_target_rails_version 5.0 - - MSG = 'Models should subclass `ApplicationRecord`.' - SUPERCLASS = 'ApplicationRecord' - BASE_PATTERN = '(const (const {nil? cbase} :ActiveRecord) :Base)' - - # rubocop:disable Layout/ClassStructure - include RuboCop::Cop::EnforceSuperclass - # rubocop:enable Layout/ClassStructure - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/arel_star.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/arel_star.rb deleted file mode 100644 index 74f43f9da3e664..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/arel_star.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Prevents usage of `"*"` on an Arel::Table column reference. - # - # Using `arel_table["*"]` causes the outputted string to be a literal - # quoted asterisk (e.g. `my_model`.`*`). This causes the - # database to look for a column named `*` (or `"*"`) as opposed - # to expanding the column list as one would likely expect. - # - # @safety - # This cop's autocorrection is unsafe because it turns a quoted `*` into - # an SQL `*`, unquoted. `*` is a valid column name in certain databases - # supported by Rails, and even though it is usually a mistake, - # it might denote legitimate access to a column named `*`. - # - # @example - # # bad - # MyTable.arel_table["*"] - # - # # good - # MyTable.arel_table[Arel.star] - # - class ArelStar < Base - extend AutoCorrector - - MSG = 'Use `Arel.star` instead of `"*"` for expanded column lists.' - - RESTRICT_ON_SEND = %i[[]].freeze - - def_node_matcher :star_bracket?, <<~PATTERN - (send {const (send _ :arel_table)} :[] $(str "*")) - PATTERN - - def on_send(node) - return unless (star = star_bracket?(node)) - - add_offense(star) do |corrector| - corrector.replace(star, 'Arel.star') - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/assert_not.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/assert_not.rb deleted file mode 100644 index 96102649273b52..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/assert_not.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # - # Use `assert_not` instead of `assert !`. - # - # @example - # # bad - # assert !x - # - # # good - # assert_not x - # - class AssertNot < Base - extend AutoCorrector - - MSG = 'Prefer `assert_not` over `assert !`.' - RESTRICT_ON_SEND = %i[assert].freeze - - def_node_matcher :offensive?, '(send nil? :assert (send ... :!) ...)' - - def on_send(node) - return unless offensive?(node) - - add_offense(node) do |corrector| - expression = node.source_range - - corrector.replace(expression, corrected_source(expression.source)) - end - end - - private - - def corrected_source(source) - source.gsub(/^assert(\(| ) *! */, 'assert_not\\1') - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/attribute_default_block_value.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/attribute_default_block_value.rb deleted file mode 100644 index 42bac8e3b2c218..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/attribute_default_block_value.rb +++ /dev/null @@ -1,90 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Looks for `attribute` class methods that specify a `:default` option - # which value is an array, string literal or method call without a block. - # It will accept all other values, such as string, symbol, integer and float literals - # as well as constants. - # - # @example - # # bad - # class User < ApplicationRecord - # attribute :confirmed_at, :datetime, default: Time.zone.now - # end - # - # # good - # class User < ApplicationRecord - # attribute :confirmed_at, :datetime, default: -> { Time.zone.now } - # end - # - # # bad - # class User < ApplicationRecord - # attribute :roles, :string, array: true, default: [] - # end - # - # # good - # class User < ApplicationRecord - # attribute :roles, :string, array: true, default: -> { [] } - # end - # - # # bad - # class User < ApplicationRecord - # attribute :configuration, default: {} - # end - # - # # good - # class User < ApplicationRecord - # attribute :configuration, default: -> { {} } - # end - # - # # good - # class User < ApplicationRecord - # attribute :role, :string, default: :customer - # end - # - # # good - # class User < ApplicationRecord - # attribute :activated, :boolean, default: false - # end - # - # # good - # class User < ApplicationRecord - # attribute :login_count, :integer, default: 0 - # end - # - # # good - # class User < ApplicationRecord - # FOO = 123 - # attribute :custom_attribute, :integer, default: FOO - # end - class AttributeDefaultBlockValue < Base - extend AutoCorrector - - MSG = 'Pass method in a block to `:default` option.' - RESTRICT_ON_SEND = %i[attribute].freeze - TYPE_OFFENDERS = %i[send array hash].freeze - - def_node_matcher :default_attribute, <<~PATTERN - (send nil? :attribute _ ?_ (hash <$#attribute ...>)) - PATTERN - - def_node_matcher :attribute, '(pair (sym :default) $_)' - - def on_send(node) - default_attribute(node) do |attribute| - value = attribute.children.last - return unless TYPE_OFFENDERS.any?(value.type) - - add_offense(value) do |corrector| - expression = default_attribute(node).children.last - - corrector.replace(value, "-> { #{expression.source} }") - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/belongs_to.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/belongs_to.rb deleted file mode 100644 index 055569ae788431..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/belongs_to.rb +++ /dev/null @@ -1,90 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Looks for belongs_to associations where we control whether the - # association is required via the deprecated `required` option instead. - # - # Since Rails 5, belongs_to associations are required by default and this - # can be controlled through the use of `optional: true`. - # - # From the release notes: - # - # belongs_to will now trigger a validation error by default if the - # association is not present. You can turn this off on a - # per-association basis with optional: true. Also deprecate required - # option in favor of optional for belongs_to. (Pull Request) - # - # In the case that the developer is doing `required: false`, we - # definitely want to autocorrect to `optional: true`. - # - # However, without knowing whether they've set overridden the default - # value of `config.active_record.belongs_to_required_by_default`, we - # can't say whether it's safe to remove `required: true` or whether we - # should replace it with `optional: false` (or, similarly, remove a - # superfluous `optional: false`). Therefore, in the cases we're using - # `required: true`, we'll simply invert it to `optional: false` and the - # user can remove depending on their defaults. - # - # @example - # # bad - # class Post < ApplicationRecord - # belongs_to :blog, required: false - # end - # - # # good - # class Post < ApplicationRecord - # belongs_to :blog, optional: true - # end - # - # # bad - # class Post < ApplicationRecord - # belongs_to :blog, required: true - # end - # - # # good - # class Post < ApplicationRecord - # belongs_to :blog, optional: false - # end - class BelongsTo < Base - extend AutoCorrector - extend TargetRailsVersion - - minimum_target_rails_version 5.0 - - SUPERFLOUS_REQUIRE_FALSE_MSG = - 'You specified `required: false`, in Rails > 5.0 the required ' \ - 'option is deprecated and you want to use `optional: true`.' - - SUPERFLOUS_REQUIRE_TRUE_MSG = - 'You specified `required: true`, in Rails > 5.0 the required ' \ - 'option is deprecated and you want to use `optional: false`. ' \ - 'In most configurations, this is the default and you can omit ' \ - 'this option altogether' - RESTRICT_ON_SEND = %i[belongs_to].freeze - - def_node_matcher :match_belongs_to_with_options, <<~PATTERN - (send _ :belongs_to ... - (hash <$(pair (sym :required) ${true false}) ...>) - ) - PATTERN - - def on_send(node) - match_belongs_to_with_options(node) do |option_node, option_value| - message, replacement = - if option_value.true_type? - [SUPERFLOUS_REQUIRE_TRUE_MSG, 'optional: false'] - elsif option_value.false_type? - [SUPERFLOUS_REQUIRE_FALSE_MSG, 'optional: true'] - end - - add_offense(node.loc.selector, message: message) do |corrector| - corrector.replace(option_node, replacement) - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/blank.rb deleted file mode 100644 index 1f30fd7425b8f4..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/blank.rb +++ /dev/null @@ -1,168 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for code that can be written with simpler conditionals - # using `Object#blank?` defined by Active Support. - # - # Interaction with `Style/UnlessElse`: - # The configuration of `NotPresent` will not produce an offense in the - # context of `unless else` if `Style/UnlessElse` is enabled. This is - # to prevent interference between the autocorrection of the two cops. - # - # @safety - # This cop is unsafe autocorrection, because `' '.empty?` returns false, - # but `' '.blank?` returns true. Therefore, autocorrection is not compatible - # if the receiver is a non-empty blank string, tab, or newline meta characters. - # - # @example NilOrEmpty: true (default) - # # Converts usages of `nil? || empty?` to `blank?` - # - # # bad - # foo.nil? || foo.empty? - # foo == nil || foo.empty? - # - # # good - # foo.blank? - # - # @example NotPresent: true (default) - # # Converts usages of `!present?` to `blank?` - # - # # bad - # !foo.present? - # - # # good - # foo.blank? - # - # @example UnlessPresent: true (default) - # # Converts usages of `unless present?` to `if blank?` - # - # # bad - # something unless foo.present? - # - # # good - # something if foo.blank? - # - # # bad - # unless foo.present? - # something - # end - # - # # good - # if foo.blank? - # something - # end - # - # # good - # def blank? - # !present? - # end - class Blank < Base - extend AutoCorrector - - MSG_NIL_OR_EMPTY = 'Use `%s` instead of `%s`.' - MSG_NOT_PRESENT = 'Use `%s` instead of `%s`.' - MSG_UNLESS_PRESENT = 'Use `if %s` instead of `%s`.' - RESTRICT_ON_SEND = %i[!].freeze - - # `(send nil $_)` is not actually a valid match for an offense. Nodes - # that have a single method call on the left hand side - # (`bar || foo.empty?`) will blow up when checking - # `(send (:nil) :== $_)`. - def_node_matcher :nil_or_empty?, <<~PATTERN - (or - { - (send $_ :!) - (send $_ :nil?) - (send $_ :== nil) - (send nil :== $_) - } - { - (send $_ :empty?) - (send (send (send $_ :empty?) :!) :!) - } - ) - PATTERN - - def_node_matcher :not_present?, '(send (send $_ :present?) :!)' - - def_node_matcher :defining_blank?, '(def :blank? (args) ...)' - - def_node_matcher :unless_present?, <<~PATTERN - (:if $(send $_ :present?) {nil? (...)} ...) - PATTERN - - def on_send(node) - return unless cop_config['NotPresent'] - - not_present?(node) do |receiver| - # accepts !present? if its in the body of a `blank?` method - next if defining_blank?(node.parent) - - message = format(MSG_NOT_PRESENT, prefer: replacement(receiver), current: node.source) - add_offense(node, message: message) do |corrector| - autocorrect(corrector, node) - end - end - end - - def on_or(node) - return unless cop_config['NilOrEmpty'] - - nil_or_empty?(node) do |var1, var2| - return unless var1 == var2 - - message = format(MSG_NIL_OR_EMPTY, prefer: replacement(var1), current: node.source) - add_offense(node, message: message) do |corrector| - autocorrect(corrector, node) - end - end - end - - def on_if(node) - return unless cop_config['UnlessPresent'] - return unless node.unless? - return if node.else? && config.for_cop('Style/UnlessElse')['Enabled'] - - unless_present?(node) do |method_call, receiver| - range = unless_condition(node, method_call) - - message = format(MSG_UNLESS_PRESENT, prefer: replacement(receiver), current: range.source) - add_offense(range, message: message) do |corrector| - autocorrect(corrector, node) - end - end - end - - private - - def autocorrect(corrector, node) - method_call, variable1 = unless_present?(node) - - if method_call - corrector.replace(node.loc.keyword, 'if') - range = method_call.source_range - else - variable1, _variable2 = nil_or_empty?(node) || not_present?(node) - range = node.source_range - end - - corrector.replace(range, replacement(variable1)) - end - - def unless_condition(node, method_call) - if node.modifier_form? - node.loc.keyword.join(node.source_range.end) - else - node.source_range.begin.join(method_call.source_range) - end - end - - def replacement(node) - node.respond_to?(:source) ? "#{node.source}.blank?" : 'blank?' - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/bulk_change_table.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/bulk_change_table.rb deleted file mode 100644 index a076958ddb77d7..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/bulk_change_table.rb +++ /dev/null @@ -1,294 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks whether alter queries are combinable. - # If combinable queries are detected, it suggests to you - # to use `change_table` with `bulk: true` instead. - # This option causes the migration to generate a single - # ALTER TABLE statement combining multiple column alterations. - # - # The `bulk` option is only supported on the MySQL and - # the PostgreSQL (5.2 later) adapter; thus it will - # automatically detect an adapter from `development` environment - # in `config/database.yml` when the `Database` option is not set. - # If the adapter is not `mysql2` or `postgresql`, - # this Cop ignores offenses. - # - # @example - # # bad - # def change - # add_column :users, :name, :string, null: false - # add_column :users, :nickname, :string - # - # # ALTER TABLE `users` ADD `name` varchar(255) NOT NULL - # # ALTER TABLE `users` ADD `nickname` varchar(255) - # end - # - # # good - # def change - # change_table :users, bulk: true do |t| - # t.string :name, null: false - # t.string :nickname - # end - # - # # ALTER TABLE `users` ADD `name` varchar(255) NOT NULL, - # # ADD `nickname` varchar(255) - # end - # - # @example - # # bad - # def change - # change_table :users do |t| - # t.string :name, null: false - # t.string :nickname - # end - # end - # - # # good - # def change - # change_table :users, bulk: true do |t| - # t.string :name, null: false - # t.string :nickname - # end - # end - # - # # good - # # When you don't want to combine alter queries. - # def change - # change_table :users, bulk: false do |t| - # t.string :name, null: false - # t.string :nickname - # end - # end - class BulkChangeTable < Base - MSG_FOR_CHANGE_TABLE = <<~MSG.chomp - You can combine alter queries using `bulk: true` options. - MSG - MSG_FOR_ALTER_METHODS = <<~MSG.chomp - You can use `change_table :%s, bulk: true` to combine alter queries. - MSG - - MYSQL = 'mysql' - POSTGRESQL = 'postgresql' - - MIGRATION_METHODS = %i[change up down].freeze - - COMBINABLE_TRANSFORMATIONS = %i[ - primary_key - column - string - text - integer - bigint - float - decimal - numeric - datetime - timestamp - time - date - binary - boolean - json - virtual - remove - change - timestamps - remove_timestamps - ].freeze - - COMBINABLE_ALTER_METHODS = %i[ - add_column - remove_column - remove_columns - change_column - add_timestamps - remove_timestamps - ].freeze - - MYSQL_COMBINABLE_TRANSFORMATIONS = %i[rename index remove_index].freeze - - MYSQL_COMBINABLE_ALTER_METHODS = %i[rename_column add_index remove_index].freeze - - POSTGRESQL_COMBINABLE_TRANSFORMATIONS = %i[change_default].freeze - - POSTGRESQL_COMBINABLE_ALTER_METHODS = %i[change_column_default].freeze - - def on_def(node) - return unless support_bulk_alter? - return unless MIGRATION_METHODS.include?(node.method_name) - return unless node.body - - recorder = AlterMethodsRecorder.new - - node.body.child_nodes.each do |child_node| - if call_to_combinable_alter_method? child_node - recorder.process(child_node) - else - recorder.flush - end - end - - recorder.offensive_nodes.each { |n| add_offense_for_alter_methods(n) } - end - - def on_send(node) - return unless support_bulk_alter? - return unless node.command?(:change_table) - return if include_bulk_options?(node) - return unless node.block_node - - send_nodes = send_nodes_from_change_table_block(node.block_node.body) - - add_offense_for_change_table(node) if count_transformations(send_nodes) > 1 - end - - private - - def send_nodes_from_change_table_block(body) - if body.send_type? - [body] - else - body.each_child_node(:send).to_a - end - end - - def count_transformations(send_nodes) - send_nodes.sum do |node| - if node.method?(:remove) - node.arguments.count { |arg| !arg.hash_type? } - else - combinable_transformations.include?(node.method_name) ? 1 : 0 - end - end - end - - # @param node [RuboCop::AST::SendNode] (send nil? :change_table ...) - def include_bulk_options?(node) - # arguments: [{(sym :table)(str "table")} (hash (pair (sym :bulk) _))] - options = node.arguments[1] - return false unless options - - options.hash_type? && options.keys.any? { |key| key.sym_type? && key.value == :bulk } - end - - def database - cop_config['Database'] || database_from_yaml - end - - def database_from_yaml - return nil unless database_yaml - - case database_yaml['adapter'] - when 'mysql2' - MYSQL - when 'postgresql' - POSTGRESQL - end - end - - def database_yaml - return nil unless File.exist?('config/database.yml') - - yaml = if YAML.respond_to?(:unsafe_load_file) - YAML.unsafe_load_file('config/database.yml') - else - YAML.load_file('config/database.yml') - end - return nil unless yaml.is_a? Hash - - config = yaml['development'] - return nil unless config.is_a?(Hash) - - config - rescue Psych::SyntaxError - nil - end - - def support_bulk_alter? - case database - when MYSQL - true - when POSTGRESQL - # Add bulk alter support for PostgreSQL in 5.2.0 - # See: https://github.com/rails/rails/pull/31331 - target_rails_version >= 5.2 - else - false - end - end - - def call_to_combinable_alter_method?(child_node) - child_node.send_type? && combinable_alter_methods.include?(child_node.method_name) - end - - def combinable_alter_methods - case database - when MYSQL - COMBINABLE_ALTER_METHODS + MYSQL_COMBINABLE_ALTER_METHODS - when POSTGRESQL - COMBINABLE_ALTER_METHODS + POSTGRESQL_COMBINABLE_ALTER_METHODS - end - end - - def combinable_transformations - case database - when MYSQL - COMBINABLE_TRANSFORMATIONS + MYSQL_COMBINABLE_TRANSFORMATIONS - when POSTGRESQL - COMBINABLE_TRANSFORMATIONS + POSTGRESQL_COMBINABLE_TRANSFORMATIONS - end - end - - # @param node [RuboCop::AST::SendNode] - def add_offense_for_alter_methods(node) - # arguments: [{(sym :table)(str "table")} ...] - table_node = node.arguments[0] - return unless table_node.is_a? RuboCop::AST::BasicLiteralNode - - message = format(MSG_FOR_ALTER_METHODS, table: table_node.value) - add_offense(node, message: message) - end - - # @param node [RuboCop::AST::SendNode] - def add_offense_for_change_table(node) - add_offense(node, message: MSG_FOR_CHANGE_TABLE) - end - - # Record combinable alter methods and register offensive nodes. - class AlterMethodsRecorder - def initialize - @nodes = [] - @offensive_nodes = [] - end - - # @param new_node [RuboCop::AST::SendNode] - def process(new_node) - # arguments: [{(sym :table)(str "table")} ...] - table_node = new_node.arguments[0] - if table_node.is_a? RuboCop::AST::BasicLiteralNode - flush unless @nodes.all? do |node| - node.arguments[0].value.to_s == table_node.value.to_s - end - @nodes << new_node - else - flush - end - end - - def flush - @offensive_nodes << @nodes.first if @nodes.size > 1 - @nodes = [] - end - - def offensive_nodes - flush - @offensive_nodes - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/compact_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/compact_blank.rb deleted file mode 100644 index 5ba028d55c0fbb..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/compact_blank.rb +++ /dev/null @@ -1,111 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks if collection can be blank-compacted with `compact_blank`. - # - # @safety - # It is unsafe by default because false positives may occur in the - # blank check of block arguments to the receiver object. - # - # For example, `[[1, 2], [3, nil]].reject { |first, second| second.blank? }` and - # `[[1, 2], [3, nil]].compact_blank` are not compatible. The same is true for `blank?`. - # This will work fine when the receiver is a hash object. - # - # And `compact_blank!` has different implementations for `Array`, `Hash`, and - # `ActionController::Parameters`. - # `Array#compact_blank!`, `Hash#compact_blank!` are equivalent to `delete_if(&:blank?)`. - # `ActionController::Parameters#compact_blank!` is equivalent to `reject!(&:blank?)`. - # If the cop makes a mistake, autocorrected code may get unexpected behavior. - # - # @example - # - # # bad - # collection.reject(&:blank?) - # collection.reject { |_k, v| v.blank? } - # - # # good - # collection.compact_blank - # - # # bad - # collection.delete_if(&:blank?) # Same behavior as `Array#compact_blank!` and `Hash#compact_blank!` - # collection.delete_if { |_k, v| v.blank? } # Same behavior as `Array#compact_blank!` and `Hash#compact_blank!` - # collection.reject!(&:blank?) # Same behavior as `ActionController::Parameters#compact_blank!` - # collection.reject! { |_k, v| v.blank? } # Same behavior as `ActionController::Parameters#compact_blank!` - # - # # good - # collection.compact_blank! - # - class CompactBlank < Base - include RangeHelp - extend AutoCorrector - extend TargetRailsVersion - - MSG = 'Use `%s` instead.' - RESTRICT_ON_SEND = %i[reject delete_if reject!].freeze - - minimum_target_rails_version 6.1 - - def_node_matcher :reject_with_block?, <<~PATTERN - (block - (send _ {:reject :delete_if :reject!}) - $(args ...) - (send - $(lvar _) :blank?)) - PATTERN - - def_node_matcher :reject_with_block_pass?, <<~PATTERN - (send _ {:reject :delete_if :reject!} - (block_pass - (sym :blank?))) - PATTERN - - def on_send(node) - return unless bad_method?(node) - - range = offense_range(node) - preferred_method = preferred_method(node) - add_offense(range, message: format(MSG, preferred_method: preferred_method)) do |corrector| - corrector.replace(range, preferred_method) - end - end - - private - - def bad_method?(node) - return true if reject_with_block_pass?(node) - - if (arguments, receiver_in_block = reject_with_block?(node.parent)) - return use_single_value_block_argument?(arguments, receiver_in_block) || - use_hash_value_block_argument?(arguments, receiver_in_block) - end - - false - end - - def use_single_value_block_argument?(arguments, receiver_in_block) - arguments.length == 1 && arguments[0].source == receiver_in_block.source - end - - def use_hash_value_block_argument?(arguments, receiver_in_block) - arguments.length == 2 && arguments[1].source == receiver_in_block.source - end - - def offense_range(node) - end_pos = if node.parent&.block_type? && node.parent&.send_node == node - node.parent.source_range.end_pos - else - node.source_range.end_pos - end - - range_between(node.loc.selector.begin_pos, end_pos) - end - - def preferred_method(node) - node.method?(:reject) ? 'compact_blank' : 'compact_blank!' - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/content_tag.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/content_tag.rb deleted file mode 100644 index 2ae4afe0852aa3..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/content_tag.rb +++ /dev/null @@ -1,93 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks legacy syntax usage of `tag` - # - # NOTE: Allow `tag` when the first argument is a variable because - # `tag(name)` is simpler rather than `tag.public_send(name)`. - # And this cop will be renamed to something like `LegacyTag` in the future. (e.g. RuboCop Rails 2.0) - # - # @example - # # bad - # tag(:p) - # tag(:br, class: 'classname') - # - # # good - # tag.p - # tag.br(class: 'classname') - # tag(name, class: 'classname') - class ContentTag < Base - include RangeHelp - extend AutoCorrector - extend TargetRailsVersion - - minimum_target_rails_version 5.1 - - MSG = 'Use `tag.%s` instead of `tag(%s)`.' - RESTRICT_ON_SEND = %i[tag].freeze - - def on_new_investigation - @corrected_nodes = nil - end - - def on_send(node) - return unless node.receiver.nil? - return if node.arguments.count >= 3 - - first_argument = node.first_argument - return if !first_argument || allowed_argument?(first_argument) || corrected_ancestor?(node) - - preferred_method = node.first_argument.value.to_s.underscore - message = format(MSG, preferred_method: preferred_method, current_argument: first_argument.source) - - register_offense(node, message, preferred_method) - end - - private - - def corrected_ancestor?(node) - node.each_ancestor(:send).any? { |ancestor| @corrected_nodes&.include?(ancestor) } - end - - def allowed_argument?(argument) - argument.variable? || - argument.send_type? || - argument.const_type? || - argument.splat_type? || - allowed_name?(argument) || - !argument.respond_to?(:value) - end - - def register_offense(node, message, preferred_method) - add_offense(node, message: message) do |corrector| - autocorrect(corrector, node, preferred_method) - - @corrected_nodes ||= Set.new.compare_by_identity - @corrected_nodes.add(node) - end - end - - def autocorrect(corrector, node, preferred_method) - range = correction_range(node) - - rest_args = node.arguments.drop(1) - replacement = "tag.#{preferred_method}(#{rest_args.map(&:source).join(', ')})" - - corrector.replace(range, replacement) - end - - def allowed_name?(argument) - return false unless argument.str_type? || argument.sym_type? - - !/^[a-zA-Z-][a-zA-Z\-0-9]*$/.match?(argument.value) - end - - def correction_range(node) - range_between(node.loc.selector.begin_pos, node.source_range.end_pos) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/create_table_with_timestamps.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/create_table_with_timestamps.rb deleted file mode 100644 index 03ce7f54ff9c8a..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/create_table_with_timestamps.rb +++ /dev/null @@ -1,98 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks the migration for which timestamps are not included when creating a new table. - # In many cases, timestamps are useful information and should be added. - # - # NOTE: Allow `timestamps` not written when `id: false` because this emphasizes respecting - # user's editing intentions. - # - # @example - # # bad - # create_table :users - # - # # bad - # create_table :users do |t| - # t.string :name - # t.string :email - # end - # - # # good - # create_table :users do |t| - # t.string :name - # t.string :email - # - # t.timestamps - # end - # - # # good - # create_table :users do |t| - # t.string :name - # t.string :email - # - # t.datetime :created_at, default: -> { 'CURRENT_TIMESTAMP' } - # end - # - # # good - # create_table :users do |t| - # t.string :name - # t.string :email - # - # t.datetime :updated_at, default: -> { 'CURRENT_TIMESTAMP' } - # end - # - # # good - # create_table :users, articles, id: false do |t| - # t.integer :user_id - # t.integer :article_id - # end - # - class CreateTableWithTimestamps < Base - include ActiveRecordMigrationsHelper - - MSG = 'Add timestamps when creating a new table.' - RESTRICT_ON_SEND = %i[create_table].freeze - - def_node_search :use_id_false_option?, <<~PATTERN - (pair (sym :id) (false)) - PATTERN - - def_node_matcher :create_table_with_timestamps_proc?, <<~PATTERN - (send nil? :create_table (sym _) ... (block-pass (sym :timestamps))) - PATTERN - - def_node_search :timestamps_included?, <<~PATTERN - (send _var :timestamps ...) - PATTERN - - def_node_search :created_at_or_updated_at_included?, <<~PATTERN - (send _var :datetime - {(sym {:created_at :updated_at})(str {"created_at" "updated_at"})} - ...) - PATTERN - - def on_send(node) - return if !node.command?(:create_table) || use_id_false_option?(node) - - parent = node.parent - - if create_table_with_block?(parent) - add_offense(parent) if parent.body.nil? || !time_columns_included?(parent.body) - elsif create_table_with_timestamps_proc?(node) - # nothing to do - else - add_offense(node) - end - end - - private - - def time_columns_included?(node) - timestamps_included?(node) || created_at_or_updated_at_included?(node) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/date.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/date.rb deleted file mode 100644 index e9de8d44e0b898..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/date.rb +++ /dev/null @@ -1,166 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for the correct use of Date methods, - # such as Date.today, Date.current etc. - # - # Using `Date.today` is dangerous, because it doesn't know anything about - # Rails time zone. You must use `Time.zone.today` instead. - # - # The cop also reports warnings when you are using `to_time` method, - # because it doesn't know about Rails time zone either. - # - # Two styles are supported for this cop. When `EnforcedStyle` is 'strict' - # then the Date methods `today`, `current`, `yesterday`, and `tomorrow` - # are prohibited and the usage of both `to_time` - # and 'to_time_in_current_zone' are reported as warning. - # - # When `EnforcedStyle` is `flexible` then only `Date.today` is prohibited. - # - # And you can set a warning for `to_time` with `AllowToTime: false`. - # `AllowToTime` is `true` by default to prevent false positive on `DateTime` object. - # - # @example EnforcedStyle: flexible (default) - # # bad - # Date.today - # - # # good - # Time.zone.today - # Time.zone.today - 1.day - # Date.current - # Date.yesterday - # date.in_time_zone - # - # @example EnforcedStyle: strict - # # bad - # Date.current - # Date.yesterday - # Date.today - # - # # good - # Time.zone.today - # Time.zone.today - 1.day - # - # @example AllowToTime: true (default) - # # good - # date.to_time - # - # @example AllowToTime: false - # # bad - # date.to_time - class Date < Base - include ConfigurableEnforcedStyle - - MSG = 'Do not use `Date.%s` without zone. Use `Time.zone.%s` instead.' - - MSG_SEND = 'Do not use `%s` on Date objects, because they know nothing about the time zone in use.' - - RESTRICT_ON_SEND = %i[to_time to_time_in_current_zone].freeze - - BAD_DAYS = %i[today current yesterday tomorrow].freeze - - DEPRECATED_METHODS = [{ deprecated: 'to_time_in_current_zone', relevant: 'in_time_zone' }].freeze - - DEPRECATED_MSG = '`%s` is deprecated. Use `%s` instead.' - - def on_const(node) - mod, klass = *node.children - # we should only check core Date class (`Date` or `::Date`) - return unless (mod.nil? || mod.cbase_type?) && method_send?(node) - - check_date_node(node.parent) if klass == :Date - end - - def on_send(node) - return unless node.receiver && bad_methods.include?(node.method_name) - return if allow_to_time? && node.method?(:to_time) - return if safe_chain?(node) || safe_to_time?(node) - - check_deprecated_methods(node) - - add_offense(node.loc.selector, message: format(MSG_SEND, method: node.method_name)) - end - alias on_csend on_send - - private - - def check_deprecated_methods(node) - DEPRECATED_METHODS.each do |method| - next unless node.method?(method[:deprecated].to_sym) - - message = format(DEPRECATED_MSG, deprecated: method[:deprecated], relevant: method[:relevant]) - - add_offense(node.loc.selector, message: message) - end - end - - def check_date_node(node) - chain = extract_method_chain(node) - - return if (chain & bad_days).empty? - - method_name = (chain & bad_days).join('.') - - day = method_name - day = 'today' if method_name == 'current' - - message = format(MSG, method_called: method_name, day: day) - - add_offense(node.loc.selector, message: message) - end - - def extract_method_chain(node) - [node, *node.each_ancestor(:send)].map(&:method_name) - end - - # checks that parent node of send_type - # and receiver is the given node - def method_send?(node) - return false unless node.parent&.send_type? - - node.parent.receiver == node - end - - def safe_chain?(node) - chain = extract_method_chain(node) - - (chain & bad_methods).empty? || !(chain & good_methods).empty? - end - - def safe_to_time?(node) - return unless node.method?(:to_time) - - if node.receiver.str_type? - zone_regexp = /([+-][\d:]+|\dZ)\z/ - - node.receiver.str_content.match(zone_regexp) - else - node.arguments.one? - end - end - - def allow_to_time? - cop_config.fetch('AllowToTime', true) - end - - def good_days - style == :strict ? [] : %i[current yesterday tomorrow] - end - - def bad_days - BAD_DAYS - good_days - end - - def bad_methods - %i[to_time to_time_in_current_zone] - end - - def good_methods - style == :strict ? [] : TimeZone::ACCEPTED_METHODS - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/default_scope.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/default_scope.rb deleted file mode 100644 index 3bbd88d0097234..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/default_scope.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Looks for uses of `default_scope`. - # - # @example - # # bad - # default_scope -> { where(hidden: false) } - # - # # good - # scope :published, -> { where(hidden: false) } - # - # # bad - # def self.default_scope - # where(hidden: false) - # end - # - # # good - # def self.published - # where(hidden: false) - # end - # - class DefaultScope < Base - MSG = 'Avoid use of `default_scope`. It is better to use explicitly named scopes.' - RESTRICT_ON_SEND = %i[default_scope].freeze - - def_node_matcher :method_call?, <<~PATTERN - (send nil? :default_scope ...) - PATTERN - - def_node_matcher :class_method_definition?, <<~PATTERN - (defs _ :default_scope args ...) - PATTERN - - def_node_matcher :eigenclass_method_definition?, <<~PATTERN - (sclass (self) $(def :default_scope args ...)) - PATTERN - - def on_send(node) - return unless method_call?(node) - - add_offense(node.loc.selector) - end - - def on_defs(node) - return unless class_method_definition?(node) - - add_offense(node.loc.name) - end - - def on_sclass(node) - eigenclass_method_definition?(node) do |default_scope| - add_offense(default_scope.loc.name) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/delegate.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/delegate.rb deleted file mode 100644 index a50f5d3e84ae7d..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/delegate.rb +++ /dev/null @@ -1,136 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Looks for delegations that could have been created - # automatically with the `delegate` method. - # - # Safe navigation `&.` is ignored because Rails' `allow_nil` - # option checks not just for nil but also delegates if nil - # responds to the delegated method. - # - # The `EnforceForPrefixed` option (defaulted to `true`) means that - # using the target object as a prefix of the method name - # without using the `delegate` method will be a violation. - # When set to `false`, this case is legal. - # - # @example - # # bad - # def bar - # foo.bar - # end - # - # # good - # delegate :bar, to: :foo - # - # # bad - # def bar - # self.bar - # end - # - # # good - # delegate :bar, to: :self - # - # # good - # def bar - # foo&.bar - # end - # - # # good - # private - # def bar - # foo.bar - # end - # - # @example EnforceForPrefixed: true (default) - # # bad - # def foo_bar - # foo.bar - # end - # - # # good - # delegate :bar, to: :foo, prefix: true - # - # @example EnforceForPrefixed: false - # # good - # def foo_bar - # foo.bar - # end - # - # # good - # delegate :bar, to: :foo, prefix: true - class Delegate < Base - extend AutoCorrector - include VisibilityHelp - - MSG = 'Use `delegate` to define delegations.' - - def_node_matcher :delegate?, <<~PATTERN - (def _method_name _args - (send {(send nil? _) (self)} _ ...)) - PATTERN - - def on_def(node) - return unless trivial_delegate?(node) - return if private_or_protected_delegation(node) - - register_offense(node) - end - - private - - def register_offense(node) - add_offense(node.loc.keyword) do |corrector| - body = node.body - - receiver = body.receiver.self_type? ? 'self' : ":#{body.receiver.method_name}" - - delegation = ["delegate :#{body.method_name}", "to: #{receiver}"] - delegation << ['prefix: true'] if node.method?(prefixed_method_name(node.body)) - - corrector.replace(node, delegation.join(', ')) - end - end - - def trivial_delegate?(def_node) - delegate?(def_node) && - method_name_matches?(def_node.method_name, def_node.body) && - arguments_match?(def_node.arguments, def_node.body) - end - - def arguments_match?(arg_array, body) - argument_array = body.arguments - - return false if arg_array.size != argument_array.size - - arg_array.zip(argument_array).all? do |arg, argument| - arg.arg_type? && argument.lvar_type? && arg.children == argument.children - end - end - - def method_name_matches?(method_name, body) - method_name == body.method_name || (include_prefix_case? && method_name == prefixed_method_name(body)) - end - - def include_prefix_case? - cop_config['EnforceForPrefixed'] - end - - def prefixed_method_name(body) - return '' if body.receiver.self_type? - - [body.receiver.method_name, body.method_name].join('_').to_sym - end - - def private_or_protected_delegation(node) - private_or_protected_inline(node) || node_visibility(node) != :public - end - - def private_or_protected_inline(node) - processed_source[node.first_line - 1].strip.match?(/\A(private )|(protected )/) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/delegate_allow_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/delegate_allow_blank.rb deleted file mode 100644 index 1d9869c50a8910..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/delegate_allow_blank.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Looks for delegations that pass :allow_blank as an option - # instead of :allow_nil. :allow_blank is not a valid option to pass - # to ActiveSupport#delegate. - # - # @example - # # bad - # delegate :foo, to: :bar, allow_blank: true - # - # # good - # delegate :foo, to: :bar, allow_nil: true - class DelegateAllowBlank < Base - extend AutoCorrector - - MSG = '`allow_blank` is not a valid option, use `allow_nil`.' - RESTRICT_ON_SEND = %i[delegate].freeze - - def_node_matcher :allow_blank_option, <<~PATTERN - (send nil? :delegate _ (hash <$(pair (sym :allow_blank) true) ...>)) - PATTERN - - def on_send(node) - return unless (offending_node = allow_blank_option(node)) - - add_offense(offending_node) do |corrector| - corrector.replace(offending_node.key, 'allow_nil') - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb deleted file mode 100644 index 302532a4888c82..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb +++ /dev/null @@ -1,168 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks direct manipulation of ActiveModel#errors as hash. - # These operations are deprecated in Rails 6.1 and will not work in Rails 7. - # - # @safety - # This cop is unsafe because it can report `errors` manipulation on non-ActiveModel, - # which is obviously valid. - # The cop has no way of knowing whether a variable is an ActiveModel or not. - # - # @example - # # bad - # user.errors[:name] << 'msg' - # user.errors.messages[:name] << 'msg' - # - # # good - # user.errors.add(:name, 'msg') - # - # # bad - # user.errors[:name].clear - # user.errors.messages[:name].clear - # - # # good - # user.errors.delete(:name) - # - # # bad - # user.errors.keys.include?(:attr) - # - # # good - # user.errors.attribute_names.include?(:attr) - # - class DeprecatedActiveModelErrorsMethods < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Avoid manipulating ActiveModel errors as hash directly.' - AUTOCORRECTABLE_METHODS = %i[<< clear keys].freeze - INCOMPATIBLE_METHODS = %i[keys values to_h to_xml].freeze - - MANIPULATIVE_METHODS = Set[ - *%i[ - << append clear collect! compact! concat - delete delete_at delete_if drop drop_while fill filter! keep_if - flatten! insert map! pop prepend push reject! replace reverse! - rotate! select! shift shuffle! slice! sort! sort_by! uniq! unshift - ] - ].freeze - - def_node_matcher :receiver_matcher_outside_model, '{send ivar lvar}' - def_node_matcher :receiver_matcher_inside_model, '{nil? send ivar lvar}' - - def_node_matcher :any_manipulation?, <<~PATTERN - { - #root_manipulation? - #root_assignment? - #errors_deprecated? - #messages_details_manipulation? - #messages_details_assignment? - } - PATTERN - - def_node_matcher :root_manipulation?, <<~PATTERN - (send - (send - (send #receiver_matcher :errors) :[] ...) - MANIPULATIVE_METHODS - ... - ) - PATTERN - - def_node_matcher :root_assignment?, <<~PATTERN - (send - (send #receiver_matcher :errors) - :[]= - ...) - PATTERN - - def_node_matcher :errors_deprecated?, <<~PATTERN - (send - (send #receiver_matcher :errors) - {:keys :values :to_h :to_xml}) - PATTERN - - def_node_matcher :messages_details_manipulation?, <<~PATTERN - (send - (send - (send - (send #receiver_matcher :errors) - {:messages :details}) - :[] - ...) - MANIPULATIVE_METHODS - ...) - PATTERN - - def_node_matcher :messages_details_assignment?, <<~PATTERN - (send - (send - (send #receiver_matcher :errors) - {:messages :details}) - :[]= - ...) - PATTERN - - def on_send(node) - any_manipulation?(node) do - next if target_rails_version <= 6.0 && INCOMPATIBLE_METHODS.include?(node.method_name) - - add_offense(node) do |corrector| - next if skip_autocorrect?(node) - - autocorrect(corrector, node) - end - end - end - - private - - def skip_autocorrect?(node) - return true unless AUTOCORRECTABLE_METHODS.include?(node.method_name) - return false unless (receiver = node.receiver.receiver) - - receiver.send_type? && receiver.method?(:details) && node.method?(:<<) - end - - def autocorrect(corrector, node) - receiver = node.receiver - - range = offense_range(node, receiver) - replacement = replacement(node, receiver) - - corrector.replace(range, replacement) - end - - def offense_range(node, receiver) - receiver = receiver.receiver while receiver.send_type? && !receiver.method?(:errors) && receiver.receiver - range_between(receiver.source_range.end_pos, node.source_range.end_pos) - end - - def replacement(node, receiver) - return '.attribute_names' if node.method?(:keys) - - key = receiver.first_argument.source - - case node.method_name - when :<< - value = node.first_argument.source - - ".add(#{key}, #{value})" - when :clear - ".delete(#{key})" - end - end - - def receiver_matcher(node) - model_file? ? receiver_matcher_inside_model(node) : receiver_matcher_outside_model(node) - end - - def model_file? - processed_source.file_path.include?('/models/') - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/dot_separated_keys.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/dot_separated_keys.rb deleted file mode 100644 index 61216951992339..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/dot_separated_keys.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces the use of dot-separated locale keys instead of specifying the `:scope` option - # with an array or a single symbol in `I18n` translation methods. - # Dot-separated notation is easier to read and trace the hierarchy. - # - # @example - # # bad - # I18n.t :record_invalid, scope: [:activerecord, :errors, :messages] - # I18n.t :title, scope: :invitation - # - # # good - # I18n.t 'activerecord.errors.messages.record_invalid' - # I18n.t :record_invalid, scope: 'activerecord.errors.messages' - # - class DotSeparatedKeys < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Use the dot-separated keys instead of specifying the `:scope` option.' - TRANSLATE_METHODS = %i[translate t].freeze - - def_node_matcher :translate_with_scope?, <<~PATTERN - (send {nil? (const {nil? cbase} :I18n)} {:translate :t} ${sym_type? str_type?} - (hash <$(pair (sym :scope) ${array_type? sym_type?}) ...>) - ) - PATTERN - - def on_send(node) - return unless TRANSLATE_METHODS.include?(node.method_name) - - translate_with_scope?(node) do |key_node, scope_node| - return unless should_convert_scope?(scope_node) - - add_offense(scope_node) do |corrector| - # Eat the comma on the left. - range = range_with_surrounding_space(scope_node.source_range, side: :left) - range = range_with_surrounding_comma(range, :left) - corrector.remove(range) - - corrector.replace(key_node, new_key(key_node, scope_node)) - end - end - end - - private - - def should_convert_scope?(scope_node) - scopes(scope_node).all?(&:basic_literal?) - end - - def new_key(key_node, scope_node) - "'#{scopes(scope_node).map(&:value).join('.')}.#{key_node.value}'".squeeze('.') - end - - def scopes(scope_node) - value = scope_node.value - - if value.array_type? - value.values - else - [value] - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/duplicate_association.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/duplicate_association.rb deleted file mode 100644 index 6c7b972bfbb93f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/duplicate_association.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Looks for associations that have been defined multiple times in the same file. - # - # When an association is defined multiple times on a model, Active Record overrides the - # previously defined association with the new one. Because of this, this cop's autocorrection - # simply keeps the last of any duplicates and discards the rest. - # - # @example - # - # # bad - # belongs_to :foo - # belongs_to :bar - # has_one :foo - # - # # good - # belongs_to :bar - # has_one :foo - # - class DuplicateAssociation < Base - include RangeHelp - extend AutoCorrector - include ClassSendNodeHelper - - MSG = "Association `%s` is defined multiple times. Don't repeat associations." - - def_node_matcher :association, <<~PATTERN - (send nil? {:belongs_to :has_one :has_many :has_and_belongs_to_many} ({sym str} $_) ...) - PATTERN - - def on_class(class_node) - offenses(class_node).each do |name, nodes| - nodes.each do |node| - add_offense(node, message: format(MSG, name: name)) do |corrector| - next if same_line?(nodes.last, node) - - corrector.remove(range_by_whole_lines(node.source_range, include_final_newline: true)) - end - end - end - end - - private - - def offenses(class_node) - class_send_nodes(class_node).select { |node| association(node) } - .group_by { |node| association(node).to_sym } - .select { |_, nodes| nodes.length > 1 } - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/duplicate_scope.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/duplicate_scope.rb deleted file mode 100644 index e5c2e0fdacb2d9..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/duplicate_scope.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for multiple scopes in a model that have the same `where` clause. This - # often means you copy/pasted a scope, updated the name, and forgot to change the condition. - # - # @example - # - # # bad - # scope :visible, -> { where(visible: true) } - # scope :hidden, -> { where(visible: true) } - # - # # good - # scope :visible, -> { where(visible: true) } - # scope :hidden, -> { where(visible: false) } - # - class DuplicateScope < Base - include ClassSendNodeHelper - - MSG = 'Multiple scopes share this same where clause.' - - def_node_matcher :scope, <<~PATTERN - (send nil? :scope _ $...) - PATTERN - - def on_class(class_node) - offenses(class_node).each do |node| - add_offense(node) - end - end - - private - - def offenses(class_node) - class_send_nodes(class_node).select { |node| scope(node) } - .group_by { |node| scope(node) } - .select { |_, nodes| nodes.length > 1 } - .values - .flatten - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/duration_arithmetic.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/duration_arithmetic.rb deleted file mode 100644 index 90cbd4501df771..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/duration_arithmetic.rb +++ /dev/null @@ -1,98 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks if a duration is added to or subtracted from `Time.current`. - # - # @example - # # bad - # Time.current - 1.minute - # Time.current + 2.days - # - # # good - using relative would make it harder to express and read - # Date.yesterday + 3.days - # created_at - 1.minute - # 3.days - 1.hour - # - # # good - # 1.minute.ago - # 2.days.from_now - class DurationArithmetic < Base - extend AutoCorrector - - MSG = 'Do not add or subtract duration.' - - RESTRICT_ON_SEND = %i[+ -].freeze - - DURATIONS = Set[:second, :seconds, :minute, :minutes, :hour, :hours, - :day, :days, :week, :weeks, :fortnight, :fortnights, - :month, :months, :year, :years] - - # @!method duration_arithmetic_argument?(node) - # Match duration subtraction or addition with current time. - # - # @example source that matches - # Time.current - 1.hour - # - # @example source that matches - # ::Time.zone.now + 1.hour - # - # @param node [RuboCop::AST::Node] - # @yield operator and duration - def_node_matcher :duration_arithmetic_argument?, <<~PATTERN - (send #time_current? ${ :+ :- } $#duration?) - PATTERN - - # @!method duration?(node) - # Match a literal Duration - # - # @example source that matches - # 1.hour - # - # @example source that matches - # 9.5.weeks - # - # @param node [RuboCop::AST::Node] - # @return [Boolean] true if matches - def_node_matcher :duration?, '(send { int float (send nil _) } DURATIONS)' - - # @!method time_current?(node) - # Match Time.current - # - # @example source that matches - # Time.current - # - # @example source that matches - # ::Time.zone.now - # - # @param node [RuboCop::AST::Node] - # @return [Boolean] true if matches - def_node_matcher :time_current?, <<~PATTERN - { - (send (const {nil? cbase} :Time) :current) - (send (send (const {nil? cbase} :Time) :zone) :now) - } - PATTERN - - def on_send(node) - duration_arithmetic_argument?(node) do |*operation| - add_offense(node) do |corrector| - corrector.replace(node, corrected_source(*operation)) - end - end - end - - private - - def corrected_source(operator, duration) - if operator == :- - "#{duration.source}.ago" - else - "#{duration.source}.from_now" - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/dynamic_find_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/dynamic_find_by.rb deleted file mode 100644 index b669b94c7fe3e2..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/dynamic_find_by.rb +++ /dev/null @@ -1,136 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks dynamic `find_by_*` methods. - # Use `find_by` instead of dynamic method. - # See. https://rails.rubystyle.guide#find_by - # - # @safety - # It is certainly unsafe when not configured properly, i.e. user-defined `find_by_xxx` - # method is not added to cop's `AllowedMethods`. - # - # @example - # # bad - # User.find_by_name(name) - # User.find_by_name_and_email(name) - # User.find_by_email!(name) - # - # # good - # User.find_by(name: name) - # User.find_by(name: name, email: email) - # User.find_by!(email: email) - # - # @example AllowedMethods: ['find_by_sql', 'find_by_token_for'] (default) - # # bad - # User.find_by_query(users_query) - # User.find_by_token_for(:password_reset, token) - # - # # good - # User.find_by_sql(users_sql) - # User.find_by_token_for(:password_reset, token) - # - # @example AllowedReceivers: ['Gem::Specification', 'page'] (default) - # # bad - # Specification.find_by_name('backend').gem_dir - # page.find_by_id('a_dom_id').click - # - # # good - # Gem::Specification.find_by_name('backend').gem_dir - # page.find_by_id('a_dom_id').click - class DynamicFindBy < Base - include ActiveRecordHelper - extend AutoCorrector - - MSG = 'Use `%s` instead of dynamic `%s`.' - METHOD_PATTERN = /^find_by_(.+?)(!)?$/.freeze - IGNORED_ARGUMENT_TYPES = %i[hash splat].freeze - - def on_send(node) - return if (node.receiver.nil? && !inherit_active_record_base?(node)) || allowed_invocation?(node) - - method_name = node.method_name - static_name = static_method_name(method_name) - return unless static_name - return unless dynamic_find_by_arguments?(node) - - message = format(MSG, static_name: static_name, method: method_name) - add_offense(node, message: message) do |corrector| - autocorrect(corrector, node) - end - end - alias on_csend on_send - - private - - def autocorrect(corrector, node) - autocorrect_method_name(corrector, node) - autocorrect_argument_keywords(corrector, node, column_keywords(node.method_name)) - end - - def allowed_invocation?(node) - allowed_method?(node) || allowed_receiver?(node) || whitelisted?(node) - end - - def allowed_method?(node) - return unless cop_config['AllowedMethods'] - - cop_config['AllowedMethods'].include?(node.method_name.to_s) - end - - def allowed_receiver?(node) - return unless cop_config['AllowedReceivers'] && node.receiver - - cop_config['AllowedReceivers'].include?(node.receiver.source) - end - - # config option `WhiteList` will be deprecated soon - def whitelisted?(node) - whitelist_config = cop_config['Whitelist'] - return unless whitelist_config - - whitelist_config.include?(node.method_name.to_s) - end - - def autocorrect_method_name(corrector, node) - corrector.replace(node.loc.selector, static_method_name(node.method_name.to_s)) - end - - def autocorrect_argument_keywords(corrector, node, keywords) - keywords.each.with_index do |keyword, idx| - corrector.insert_before(node.arguments[idx], keyword) - end - end - - def column_keywords(method) - keyword_string = method.to_s[METHOD_PATTERN, 1] - keyword_string.split('_and_').map { |keyword| "#{keyword}: " } - end - - # Returns static method name. - # If code isn't wrong, returns nil - def static_method_name(method_name) - match = METHOD_PATTERN.match(method_name) - return nil unless match - - match[2] ? 'find_by!' : 'find_by' - end - - def dynamic_find_by_arguments?(node) - dynamic_find_by_arguments_count?(node) && dynamic_find_by_arguments_type?(node) - end - - def dynamic_find_by_arguments_count?(node) - column_keywords(node.method_name).size == node.arguments.size - end - - def dynamic_find_by_arguments_type?(node) - node.arguments.none? do |argument| - IGNORED_ARGUMENT_TYPES.include?(argument.type) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/eager_evaluation_log_message.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/eager_evaluation_log_message.rb deleted file mode 100644 index 8fc230121f253f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/eager_evaluation_log_message.rb +++ /dev/null @@ -1,82 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks that blocks are used for interpolated strings passed to - # `Rails.logger.debug`. - # - # By default, Rails production environments use the `:info` log level. - # At the `:info` log level, `Rails.logger.debug` statements do not result - # in log output. However, Ruby must eagerly evaluate interpolated string - # arguments passed as method arguments. Passing a block to - # `Rails.logger.debug` prevents costly evaluation of interpolated strings - # when no output would be produced anyway. - # - # @example - # #bad - # Rails.logger.debug "The time is #{Time.zone.now}." - # - # #good - # Rails.logger.debug { "The time is #{Time.zone.now}." } - # - class EagerEvaluationLogMessage < Base - extend AutoCorrector - - MSG = 'Pass a block to `Rails.logger.debug`.' - RESTRICT_ON_SEND = %i[debug].freeze - - def_node_matcher :interpolated_string_passed_to_debug, <<~PATTERN - (send - (send - (const {cbase nil?} :Rails) - :logger - ) - :debug - $(dstr ...) - ) - PATTERN - - def self.autocorrect_incompatible_with - [Style::MethodCallWithArgsParentheses] - end - - def on_send(node) - return if node.parent&.block_type? - - interpolated_string_passed_to_debug(node) do |arguments| - message = format(MSG) - - range = replacement_range(node) - replacement = replacement_source(node, arguments) - - add_offense(range, message: message) do |corrector| - corrector.replace(range, replacement) - end - end - end - - private - - def replacement_range(node) - stop = node.source_range.end - start = node.loc.selector.end - - if node.parenthesized_call? - stop.with(begin_pos: start.begin_pos) - else - stop.with(begin_pos: start.begin_pos + 1) - end - end - - def replacement_source(node, arguments) - if node.parenthesized_call? - " { #{arguments.source} }" - else - "{ #{arguments.source} }" - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/enum_hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/enum_hash.rb deleted file mode 100644 index 2b69e2e2ee529f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/enum_hash.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Looks for enums written with array syntax. - # - # When using array syntax, adding an element in a - # position other than the last causes all previous - # definitions to shift. Explicitly specifying the - # value for each key prevents this from happening. - # - # @example - # # bad - # enum status: [:active, :archived] - # - # # good - # enum status: { active: 0, archived: 1 } - # - class EnumHash < Base - extend AutoCorrector - - MSG = 'Enum defined as an array found in `%s` enum declaration. Use hash syntax instead.' - RESTRICT_ON_SEND = %i[enum].freeze - - def_node_matcher :enum?, <<~PATTERN - (send nil? :enum (hash $...)) - PATTERN - - def_node_matcher :array_pair?, <<~PATTERN - (pair $_ $array) - PATTERN - - def on_send(node) - enum?(node) do |pairs| - pairs.each do |pair| - key, array = array_pair?(pair) - next unless key - - add_offense(array, message: format(MSG, enum: enum_name(key))) do |corrector| - hash = array.children.each_with_index.map do |elem, index| - "#{source(elem)} => #{index}" - end.join(', ') - - corrector.replace(array, "{#{hash}}") - end - end - end - end - - private - - def enum_name(key) - case key.type - when :sym, :str - key.value - else - key.source - end - end - - def source(elem) - case elem.type - when :str - elem.value.dump - when :sym - elem.value.inspect - else - elem.source - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/enum_uniqueness.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/enum_uniqueness.rb deleted file mode 100644 index dfb49502d13e0b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/enum_uniqueness.rb +++ /dev/null @@ -1,63 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Looks for duplicate values in enum declarations. - # - # @example - # # bad - # enum status: { active: 0, archived: 0 } - # - # # good - # enum status: { active: 0, archived: 1 } - # - # # bad - # enum status: [:active, :archived, :active] - # - # # good - # enum status: [:active, :archived] - class EnumUniqueness < Base - include Duplication - - MSG = 'Duplicate value `%s` found in `%s` enum declaration.' - RESTRICT_ON_SEND = %i[enum].freeze - - def_node_matcher :enum?, <<~PATTERN - (send nil? :enum (hash $...)) - PATTERN - - def_node_matcher :enum_values, <<~PATTERN - (pair $_ ${array hash}) - PATTERN - - def on_send(node) - enum?(node) do |pairs| - pairs.each do |pair| - enum_values(pair) do |key, args| - items = args.values - - next unless duplicates?(items) - - consecutive_duplicates(items).each do |item| - add_offense(item, message: format(MSG, value: item.source, enum: enum_name(key))) - end - end - end - end - end - - private - - def enum_name(key) - case key.type - when :sym, :str - key.value - else - key.source - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/environment_comparison.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/environment_comparison.rb deleted file mode 100644 index 456bc85dde607a..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/environment_comparison.rb +++ /dev/null @@ -1,116 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks that Rails.env is compared using `.production?`-like - # methods instead of equality against a string or symbol. - # - # @example - # # bad - # Rails.env == 'production' - # - # # bad, always returns false - # Rails.env == :test - # - # # good - # Rails.env.production? - class EnvironmentComparison < Base - extend AutoCorrector - - MSG = 'Favor `%sRails.env.%s?` over `%s`.' - - SYM_MSG = 'Do not compare `Rails.env` with a symbol, it will always evaluate to `false`.' - - RESTRICT_ON_SEND = %i[== !=].freeze - - def_node_matcher :comparing_str_env_with_rails_env_on_lhs?, <<~PATTERN - (send - (send (const {nil? cbase} :Rails) :env) - {:== :!=} - $str - ) - PATTERN - - def_node_matcher :comparing_str_env_with_rails_env_on_rhs?, <<~PATTERN - (send - $str - {:== :!=} - (send (const {nil? cbase} :Rails) :env) - ) - PATTERN - - def_node_matcher :comparing_sym_env_with_rails_env_on_lhs?, <<~PATTERN - (send - (send (const {nil? cbase} :Rails) :env) - {:== :!=} - $sym - ) - PATTERN - - def_node_matcher :comparing_sym_env_with_rails_env_on_rhs?, <<~PATTERN - (send - $sym - {:== :!=} - (send (const {nil? cbase} :Rails) :env) - ) - PATTERN - - def_node_matcher :content, <<~PATTERN - ({str sym} $_) - PATTERN - - def on_send(node) - if (env_node = comparing_str_env_with_rails_env_on_lhs?(node) || - comparing_str_env_with_rails_env_on_rhs?(node)) - env, = *env_node - bang = node.method?(:!=) ? '!' : '' - message = format(MSG, bang: bang, env: env, source: node.source) - - add_offense(node, message: message) do |corrector| - autocorrect(corrector, node) - end - end - - return unless comparing_sym_env_with_rails_env_on_lhs?(node) || comparing_sym_env_with_rails_env_on_rhs?(node) - - add_offense(node, message: SYM_MSG) do |corrector| - autocorrect(corrector, node) - end - end - - private - - def autocorrect(corrector, node) - replacement = build_predicate_method(node) - - corrector.replace(node, replacement) - end - - def build_predicate_method(node) - if rails_env_on_lhs?(node) - build_predicate_method_for_rails_env_on_lhs(node) - else - build_predicate_method_for_rails_env_on_rhs(node) - end - end - - def rails_env_on_lhs?(node) - comparing_str_env_with_rails_env_on_lhs?(node) || comparing_sym_env_with_rails_env_on_lhs?(node) - end - - def build_predicate_method_for_rails_env_on_lhs(node) - bang = node.method?(:!=) ? '!' : '' - - "#{bang}#{node.receiver.source}.#{content(node.first_argument)}?" - end - - def build_predicate_method_for_rails_env_on_rhs(node) - bang = node.method?(:!=) ? '!' : '' - - "#{bang}#{node.first_argument.source}.#{content(node.receiver)}?" - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/environment_variable_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/environment_variable_access.rb deleted file mode 100644 index e3642820c9bf97..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/environment_variable_access.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Looks for direct access to environment variables through the - # `ENV` variable within the application code. This can lead to runtime - # errors due to misconfiguration that could have been discovered at boot - # time if the environment variables were loaded as part of initialization - # and copied into the application's configuration or secrets. The cop can - # be configured to allow either reads or writes if required. - # - # @example - # # good - # Rails.application.config.foo - # Rails.application.config.x.foo.bar - # Rails.application.secrets.foo - # Rails.application.config.foo = "bar" - # - # @example AllowReads: false (default) - # # bad - # ENV["FOO"] - # ENV.fetch("FOO") - # - # @example AllowReads: true - # # good - # ENV["FOO"] - # ENV.fetch("FOO") - # - # @example AllowWrites: false (default) - # # bad - # ENV["FOO"] = "bar" - # - # @example AllowWrites: true - # # good - # ENV["FOO"] = "bar" - class EnvironmentVariableAccess < Base - READ_MSG = 'Do not read from `ENV` directly post initialization.' - WRITE_MSG = 'Do not write to `ENV` directly post initialization.' - - def on_const(node) - add_offense(node, message: READ_MSG) if env_read?(node) && !allow_reads? - add_offense(node, message: WRITE_MSG) if env_write?(node) && !allow_writes? - end - - def_node_search :env_read?, <<~PATTERN - ^(send (const {cbase nil?} :ENV) !:[]= ...) - PATTERN - - def_node_search :env_write?, <<~PATTERN - {^(indexasgn (const {cbase nil?} :ENV) ...) - ^(send (const {cbase nil?} :ENV) :[]= ...)} - PATTERN - - private - - def allow_reads? - cop_config['AllowReads'] == true - end - - def allow_writes? - cop_config['AllowWrites'] == true - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/exit.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/exit.rb deleted file mode 100644 index 9bd3cd4ab934df..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/exit.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces that `exit` calls are not used within a rails app. - # Valid options are instead to raise an error, break, return, or some - # other form of stopping execution of current request. - # - # There are two obvious cases where `exit` is particularly harmful: - # - # * Usage in library code for your application. Even though Rails will - # rescue from a `SystemExit` and continue on, unit testing that library - # code will result in specs exiting (potentially silently if `exit(0)` - # is used.) - # * Usage in application code outside of the web process could result in - # the program exiting, which could result in the code failing to run and - # do its job. - # - # @example - # # bad - # exit(0) - # - # # good - # raise 'a bad error has happened' - class Exit < Base - include ConfigurableEnforcedStyle - - MSG = 'Do not use `exit` in Rails applications.' - RESTRICT_ON_SEND = %i[exit exit!].freeze - EXPLICIT_RECEIVERS = %i[Kernel Process].freeze - - def on_send(node) - add_offense(node.loc.selector) if offending_node?(node) - end - - private - - def offending_node?(node) - right_argument_count?(node.arguments) && right_receiver?(node.receiver) - end - - # More than 1 argument likely means it is a different - # `exit` implementation than the one we are preventing. - def right_argument_count?(arg_nodes) - arg_nodes.size <= 1 - end - - # Only register if exit is being called explicitly on `Kernel`, - # `Process`, or if receiver node is nil for plain `exit` calls. - def right_receiver?(receiver_node) - return true unless receiver_node - - _a, receiver_node_class, _c = *receiver_node - - EXPLICIT_RECEIVERS.include?(receiver_node_class) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/expanded_date_range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/expanded_date_range.rb deleted file mode 100644 index 073d41abe9f13c..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/expanded_date_range.rb +++ /dev/null @@ -1,102 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for expanded date range. It only compatible `..` range is targeted. - # Incompatible `...` range is ignored. - # - # @example - # # bad - # date.beginning_of_day..date.end_of_day - # date.beginning_of_week..date.end_of_week - # date.beginning_of_month..date.end_of_month - # date.beginning_of_quarter..date.end_of_quarter - # date.beginning_of_year..date.end_of_year - # - # # good - # date.all_day - # date.all_week - # date.all_month - # date.all_quarter - # date.all_year - # - class ExpandedDateRange < Base - extend AutoCorrector - extend TargetRailsVersion - - MSG = 'Use `%s` instead.' - - minimum_target_rails_version 5.1 - - PREFERRED_METHODS = { - beginning_of_day: 'all_day', - beginning_of_week: 'all_week', - beginning_of_month: 'all_month', - beginning_of_quarter: 'all_quarter', - beginning_of_year: 'all_year' - }.freeze - - MAPPED_DATE_RANGE_METHODS = { - beginning_of_day: :end_of_day, - beginning_of_week: :end_of_week, - beginning_of_month: :end_of_month, - beginning_of_quarter: :end_of_quarter, - beginning_of_year: :end_of_year - }.freeze - - def on_irange(node) - begin_node = node.begin - end_node = node.end - return if allow?(begin_node, end_node) - - preferred_method = preferred_method(begin_node) - if begin_node.method?(:beginning_of_week) && begin_node.arguments.one? - return unless same_argument?(begin_node, end_node) - - preferred_method << "(#{begin_node.first_argument.source})" - elsif any_arguments?(begin_node, end_node) - return - end - - register_offense(node, preferred_method) - end - - private - - def allow?(begin_node, end_node) - return true unless (begin_source = receiver_source(begin_node)) - return true unless (end_source = receiver_source(end_node)) - - begin_source != end_source || MAPPED_DATE_RANGE_METHODS[begin_node.method_name] != end_node.method_name - end - - def receiver_source(node) - return if !node&.send_type? || node.receiver.nil? - - node.receiver.source - end - - def same_argument?(begin_node, end_node) - begin_node.first_argument.source == end_node.first_argument.source - end - - def preferred_method(begin_node) - +"#{begin_node.receiver.source}.#{PREFERRED_METHODS[begin_node.method_name]}" - end - - def any_arguments?(begin_node, end_node) - begin_node.arguments.any? || end_node.arguments.any? - end - - def register_offense(node, preferred_method) - message = format(MSG, preferred_method: preferred_method) - - add_offense(node, message: message) do |corrector| - corrector.replace(node, preferred_method) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/file_path.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/file_path.rb deleted file mode 100644 index 74595992efc39c..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/file_path.rb +++ /dev/null @@ -1,125 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Identifies usages of file path joining process to use `Rails.root.join` clause. - # It is used to add uniformity when joining paths. - # - # @example EnforcedStyle: slashes (default) - # # bad - # Rails.root.join('app', 'models', 'goober') - # - # # good - # Rails.root.join('app/models/goober') - # - # # bad - # File.join(Rails.root, 'app/models/goober') - # "#{Rails.root}/app/models/goober" - # - # # good - # Rails.root.join('app/models/goober').to_s - # - # @example EnforcedStyle: arguments - # # bad - # Rails.root.join('app/models/goober') - # - # # good - # Rails.root.join('app', 'models', 'goober') - # - # # bad - # File.join(Rails.root, 'app/models/goober') - # "#{Rails.root}/app/models/goober" - # - # # good - # Rails.root.join('app', 'models', 'goober').to_s - # - class FilePath < Base - include ConfigurableEnforcedStyle - include RangeHelp - - MSG_SLASHES = 'Prefer `Rails.root.join(\'path/to\')%s`.' - MSG_ARGUMENTS = 'Prefer `Rails.root.join(\'path\', \'to\')%s`.' - RESTRICT_ON_SEND = %i[join].freeze - - def_node_matcher :file_join_nodes?, <<~PATTERN - (send (const {nil? cbase} :File) :join ...) - PATTERN - - def_node_search :rails_root_nodes?, <<~PATTERN - (send (const {nil? cbase} :Rails) :root) - PATTERN - - def_node_matcher :rails_root_join_nodes?, <<~PATTERN - (send #rails_root_nodes? :join ...) - PATTERN - - def on_dstr(node) - return unless rails_root_nodes?(node) - return unless node.children.last.str_type? - - last_child_source = node.children.last.source - return unless last_child_source.start_with?('.') || last_child_source.include?(File::SEPARATOR) - return if last_child_source.start_with?(':') - - register_offense(node, require_to_s: true) - end - - def on_send(node) - check_for_file_join_with_rails_root(node) - check_for_rails_root_join_with_slash_separated_path(node) - check_for_rails_root_join_with_string_arguments(node) - end - - private - - def check_for_file_join_with_rails_root(node) - return unless file_join_nodes?(node) - return unless node.arguments.any? { |e| rails_root_nodes?(e) } - - register_offense(node, require_to_s: true) - end - - def check_for_rails_root_join_with_string_arguments(node) - return unless style == :slashes - return unless rails_root_nodes?(node) - return unless rails_root_join_nodes?(node) - return unless node.arguments.size > 1 - return unless node.arguments.all?(&:str_type?) - - register_offense(node, require_to_s: false) - end - - def check_for_rails_root_join_with_slash_separated_path(node) - return unless style == :arguments - return unless rails_root_nodes?(node) - return unless rails_root_join_nodes?(node) - return unless node.arguments.any? { |arg| string_with_slash?(arg) } - - register_offense(node, require_to_s: false) - end - - def string_with_slash?(node) - node.str_type? && node.source.include?('/') - end - - def register_offense(node, require_to_s:) - line_range = node.loc.column...node.loc.last_column - source_range = source_range(processed_source.buffer, node.first_line, line_range) - require_to_s = false if node.dstr_type? - - message = build_message(require_to_s) - - add_offense(source_range, message: message) - end - - def build_message(require_to_s) - message_template = style == :arguments ? MSG_ARGUMENTS : MSG_SLASHES - to_s = require_to_s ? '.to_s' : '' - - format(message_template, to_s: to_s) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/find_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/find_by.rb deleted file mode 100644 index 74da0840f326ce..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/find_by.rb +++ /dev/null @@ -1,74 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Identifies usages of `where.take` and change them to use `find_by` instead. - # - # And `where(...).first` can return different results from `find_by`. - # (They order records differently, so the "first" record can be different.) - # - # If you also want to detect `where.first`, you can set `IgnoreWhereFirst` to false. - # - # @example - # # bad - # User.where(name: 'Bruce').take - # - # # good - # User.find_by(name: 'Bruce') - # - # @example IgnoreWhereFirst: true (default) - # # good - # User.where(name: 'Bruce').first - # - # @example IgnoreWhereFirst: false - # # bad - # User.where(name: 'Bruce').first - class FindBy < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Use `find_by` instead of `where.%s`.' - RESTRICT_ON_SEND = %i[first take].freeze - - def on_send(node) - return unless node.arguments.empty? && where_method?(node.receiver) - return if ignore_where_first? && node.method?(:first) - - range = offense_range(node) - - add_offense(range, message: format(MSG, method: node.method_name)) do |corrector| - autocorrect(corrector, node) - end - end - alias on_csend on_send - - private - - def where_method?(receiver) - return false unless receiver - - receiver.respond_to?(:method?) && receiver.method?(:where) - end - - def offense_range(node) - range_between(node.receiver.loc.selector.begin_pos, node.loc.selector.end_pos) - end - - def autocorrect(corrector, node) - return if node.method?(:first) - - where_loc = node.receiver.loc.selector - first_loc = range_between(node.loc.dot.begin_pos, node.loc.selector.end_pos) - - corrector.replace(where_loc, 'find_by') - corrector.replace(first_loc, '') - end - - def ignore_where_first? - cop_config.fetch('IgnoreWhereFirst', true) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/find_by_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/find_by_id.rb deleted file mode 100644 index 9e6dc1c274b1e5..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/find_by_id.rb +++ /dev/null @@ -1,94 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces that `ActiveRecord#find` is used instead of - # `where.take!`, `find_by!`, and `find_by_id!` to retrieve a single record - # by primary key when you expect it to be found. - # - # @example - # # bad - # User.where(id: id).take! - # User.find_by_id!(id) - # User.find_by!(id: id) - # - # # good - # User.find(id) - # - class FindById < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s`.' - RESTRICT_ON_SEND = %i[take! find_by_id! find_by!].freeze - - def_node_matcher :where_take?, <<~PATTERN - (send - $(send _ :where - (hash - (pair (sym :id) $_))) :take!) - PATTERN - - def_node_matcher :find_by?, <<~PATTERN - { - (send _ :find_by_id! $_) - (send _ :find_by! (hash (pair (sym :id) $_))) - } - PATTERN - - def on_send(node) - where_take?(node) do |where, id_value| - range = where_take_offense_range(node, where) - bad_method = build_where_take_bad_method(id_value) - - register_offense(range, id_value, bad_method) - end - - find_by?(node) do |id_value| - range = find_by_offense_range(node) - bad_method = build_find_by_bad_method(node, id_value) - - register_offense(range, id_value, bad_method) - end - end - - private - - def register_offense(range, id_value, bad_method) - good_method = build_good_method(id_value) - message = format(MSG, good_method: good_method, bad_method: bad_method) - - add_offense(range, message: message) do |corrector| - corrector.replace(range, good_method) - end - end - - def where_take_offense_range(node, where) - range_between(where.loc.selector.begin_pos, node.source_range.end_pos) - end - - def find_by_offense_range(node) - range_between(node.loc.selector.begin_pos, node.source_range.end_pos) - end - - def build_good_method(id_value) - "find(#{id_value.source})" - end - - def build_where_take_bad_method(id_value) - "where(id: #{id_value.source}).take!" - end - - def build_find_by_bad_method(node, id_value) - case node.method_name - when :find_by_id! - "find_by_id!(#{id_value.source})" - when :find_by! - "find_by!(id: #{id_value.source})" - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/find_each.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/find_each.rb deleted file mode 100644 index 11d4a660fa176c..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/find_each.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Identifies usages of `all.each` and change them to use `all.find_each` instead. - # - # @safety - # This cop is unsafe if the receiver object is not an Active Record object. - # Also, `all.each` returns an `Array` instance and `all.find_each` returns nil, - # so the return values are different. - # - # @example - # # bad - # User.all.each - # - # # good - # User.all.find_each - # - # @example AllowedMethods: ['order'] - # # good - # User.order(:foo).each - # - # @example AllowedPattern: ['order'] - # # good - # User.order(:foo).each - class FindEach < Base - include ActiveRecordHelper - include AllowedMethods - include AllowedPattern - extend AutoCorrector - - MSG = 'Use `find_each` instead of `each`.' - RESTRICT_ON_SEND = %i[each].freeze - - SCOPE_METHODS = %i[ - all eager_load includes joins left_joins left_outer_joins not preload - references unscoped where - ].freeze - - def on_send(node) - return unless node.receiver&.send_type? - return unless SCOPE_METHODS.include?(node.receiver.method_name) - return if node.receiver.receiver.nil? && !inherit_active_record_base?(node) - return if ignored?(node) - - range = node.loc.selector - add_offense(range) do |corrector| - corrector.replace(range, 'find_each') - end - end - - private - - def ignored?(node) - return true if active_model_error_where?(node.receiver) - - method_chain = node.each_node(:send).map(&:method_name) - - method_chain.any? { |method_name| allowed_method?(method_name) || matches_allowed_pattern?(method_name) } - end - - def active_model_error_where?(node) - node.method?(:where) && active_model_error?(node.receiver) - end - - def active_model_error?(node) - return false if node.nil? - - node.send_type? && node.method?(:errors) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/freeze_time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/freeze_time.rb deleted file mode 100644 index 3a9bc863b65076..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/freeze_time.rb +++ /dev/null @@ -1,79 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Identifies usages of `travel_to` with an argument of the current time and - # change them to use `freeze_time` instead. - # - # @safety - # This cop’s autocorrection is unsafe because `freeze_time` just delegates to - # `travel_to` with a default `Time.now`, it is not strictly equivalent to `Time.now` - # if the argument of `travel_to` is the current time considering time zone. - # - # @example - # # bad - # travel_to(Time.now) - # travel_to(Time.new) - # travel_to(DateTime.now) - # travel_to(Time.current) - # travel_to(Time.zone.now) - # travel_to(Time.now.in_time_zone) - # travel_to(Time.current.to_time) - # - # # good - # freeze_time - # - class FreezeTime < Base - extend AutoCorrector - extend TargetRailsVersion - - minimum_target_rails_version 5.2 - - MSG = 'Use `freeze_time` instead of `travel_to`.' - NOW_METHODS = %i[now new current].freeze - CONVERT_METHODS = %i[to_time in_time_zone].freeze - RESTRICT_ON_SEND = %i[travel_to].freeze - - # @!method time_now?(node) - def_node_matcher :time_now?, <<~PATTERN - (const {nil? cbase} {:Time :DateTime}) - PATTERN - - # @!method zoned_time_now?(node) - def_node_matcher :zoned_time_now?, <<~PATTERN - (send (const {nil? cbase} :Time) :zone) - PATTERN - - def on_send(node) - child_node, method_name, time_argument = *node.first_argument&.children - return if time_argument || !child_node - return unless current_time?(child_node, method_name) || current_time_with_convert?(child_node, method_name) - - add_offense(node) do |corrector| - last_argument = node.last_argument - freeze_time_method = last_argument.block_pass_type? ? "freeze_time(#{last_argument.source})" : 'freeze_time' - corrector.replace(node, freeze_time_method) - end - end - - private - - def current_time?(node, method_name) - return false unless NOW_METHODS.include?(method_name) - - node.send_type? ? zoned_time_now?(node) : time_now?(node) - end - - def current_time_with_convert?(node, method_name) - return false unless CONVERT_METHODS.include?(method_name) - - child_node, child_method_name, time_argument = *node.children - return if time_argument - - current_time?(child_node, child_method_name) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/has_and_belongs_to_many.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/has_and_belongs_to_many.rb deleted file mode 100644 index cf6ca32c32d146..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for the use of the has_and_belongs_to_many macro. - # - # @example - # # bad - # # has_and_belongs_to_many :ingredients - # - # # good - # # has_many :ingredients, through: :recipe_ingredients - class HasAndBelongsToMany < Base - MSG = 'Prefer `has_many :through` to `has_and_belongs_to_many`.' - RESTRICT_ON_SEND = %i[has_and_belongs_to_many].freeze - - def on_send(node) - return unless node.command?(:has_and_belongs_to_many) - - add_offense(node.loc.selector) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb deleted file mode 100644 index a00f93c52ce4b4..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb +++ /dev/null @@ -1,143 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Looks for `has_many` or `has_one` associations that don't - # specify a `:dependent` option. - # - # It doesn't register an offense if `:through` or `dependent: nil` - # is specified, or if the model is read-only. - # - # @example - # # bad - # class User < ActiveRecord::Base - # has_many :comments - # has_one :avatar - # end - # - # # good - # class User < ActiveRecord::Base - # has_many :comments, dependent: :restrict_with_exception - # has_one :avatar, dependent: :destroy - # has_many :articles, dependent: nil - # has_many :patients, through: :appointments - # end - # - # class User < ActiveRecord::Base - # has_many :comments - # has_one :avatar - # - # def readonly? - # true - # end - # end - class HasManyOrHasOneDependent < Base - MSG = 'Specify a `:dependent` option.' - RESTRICT_ON_SEND = %i[has_many has_one].freeze - - def_node_search :active_resource_class?, <<~PATTERN - (const (const {nil? cbase} :ActiveResource) :Base) - PATTERN - - def_node_matcher :association_without_options?, <<~PATTERN - (send _ {:has_many :has_one} _) - PATTERN - - def_node_matcher :association_with_options?, <<~PATTERN - (send _ {:has_many :has_one} ... (hash $...)) - PATTERN - - def_node_matcher :dependent_option?, <<~PATTERN - (pair (sym :dependent) {!nil (nil)}) - PATTERN - - def_node_matcher :present_option?, <<~PATTERN - (pair (sym :through) !nil) - PATTERN - - def_node_matcher :with_options_block, <<~PATTERN - (block - (send nil? :with_options - (hash $...)) - (args) ...) - PATTERN - - def_node_matcher :association_extension_block?, <<~PATTERN - (block - (send nil? :has_many _) - (args) ...) - PATTERN - - def_node_matcher :readonly?, <<~PATTERN - (def :readonly? - (args) - (true)) - PATTERN - - def on_send(node) - return if active_resource?(node.parent) || readonly_model?(node) - return if !association_without_options?(node) && valid_options?(association_with_options?(node)) - return if valid_options_in_with_options_block?(node) - - add_offense(node.loc.selector) - end - - private - - def readonly_model?(node) - return false unless (parent = node.parent) - - parent.each_descendant(:def).any? { |def_node| readonly?(def_node) } - end - - def valid_options_in_with_options_block?(node) - return true unless node.parent - - n = node.parent.begin_type? || association_extension_block?(node.parent) ? node.parent.parent : node.parent - - contain_valid_options_in_with_options_block?(n) - end - - def contain_valid_options_in_with_options_block?(node) - if (options = with_options_block(node)) - return true if valid_options?(options) - - return false unless node.parent - - return true if contain_valid_options_in_with_options_block?(node.parent.parent) - end - - false - end - - def valid_options?(options) - return false if options.nil? - - options = extract_option_if_kwsplat(options) - - return true unless options - return true if options.any? do |o| - dependent_option?(o) || present_option?(o) - end - - false - end - - def extract_option_if_kwsplat(options) - if options.first.kwsplat_type? && options.first.children.first.hash_type? - return options.first.children.first.pairs - end - - options - end - - def active_resource?(node) - return false if node.nil? - - active_resource_class?(node) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/helper_instance_variable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/helper_instance_variable.rb deleted file mode 100644 index 92b327c30803a4..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/helper_instance_variable.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for use of the helper methods which reference - # instance variables. - # - # Relying on instance variables makes it difficult to re-use helper - # methods. - # - # If it seems awkward to explicitly pass in each dependent - # variable, consider moving the behavior elsewhere, for - # example to a model, decorator or presenter. - # - # Provided that a class inherits `ActionView::Helpers::FormBuilder`, - # an offense will not be registered. - # - # @example - # # bad - # def welcome_message - # "Hello #{@user.name}" - # end - # - # # good - # def welcome_message(user) - # "Hello #{user.name}" - # end - # - # # good - # class MyFormBuilder < ActionView::Helpers::FormBuilder - # @template.do_something - # end - class HelperInstanceVariable < Base - MSG = 'Do not use instance variables in helpers.' - - def_node_matcher :form_builder_class?, <<~PATTERN - (const - (const - (const {nil? cbase} :ActionView) :Helpers) :FormBuilder) - PATTERN - - def on_ivar(node) - return if inherit_form_builder?(node) - - add_offense(node) - end - - def on_ivasgn(node) - return if node.parent.or_asgn_type? || inherit_form_builder?(node) - - add_offense(node.loc.name) - end - - private - - def inherit_form_builder?(node) - node.each_ancestor(:class) do |class_node| - return true if form_builder_class?(class_node.parent_class) - end - - false - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/http_positional_arguments.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/http_positional_arguments.rb deleted file mode 100644 index 221fca3487f548..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/http_positional_arguments.rb +++ /dev/null @@ -1,146 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Identifies usages of http methods like `get`, `post`, - # `put`, `patch` without the usage of keyword arguments in your tests and - # change them to use keyword args. This cop only applies to Rails >= 5. - # If you are running Rails < 5 you should disable the - # Rails/HttpPositionalArguments cop or set your TargetRailsVersion in your - # .rubocop.yml file to 4.2. - # - # NOTE: It does not detect any cases where `include Rack::Test::Methods` is used - # which makes the http methods incompatible behavior. - # - # @example - # # bad - # get :new, { user_id: 1} - # - # # good - # get :new, params: { user_id: 1 } - # get :new, **options - class HttpPositionalArguments < Base - include RangeHelp - extend AutoCorrector - extend TargetRailsVersion - - MSG = 'Use keyword arguments instead of positional arguments for http call: `%s`.' - KEYWORD_ARGS = %i[method params session body flash xhr as headers env to].freeze - ROUTING_METHODS = %i[draw routes].freeze - RESTRICT_ON_SEND = %i[get post put patch delete head].freeze - - minimum_target_rails_version 5.0 - - def_node_matcher :http_request?, <<~PATTERN - (send nil? {#{RESTRICT_ON_SEND.map(&:inspect).join(' ')}} !nil? $_ ...) - PATTERN - - def_node_matcher :kwsplat_hash?, <<~PATTERN - (hash (kwsplat _)) - PATTERN - - def_node_matcher :include_rack_test_methods?, <<~PATTERN - (send nil? :include - (const - (const - (const {nil? cbase} :Rack) :Test) :Methods)) - PATTERN - - def on_send(node) - return if in_routing_block?(node) || use_rack_test_methods? - - http_request?(node) do |data| - return unless needs_conversion?(data) - - message = format(MSG, verb: node.method_name) - - add_offense(highlight_range(node), message: message) do |corrector| - # given a pre Rails 5 method: get :new, {user_id: @user.id}, {} - # - # @return lambda of auto correct procedure - # the result should look like: - # get :new, params: { user_id: @user.id }, session: {} - # the http_method is the method used to call the controller - # the controller node can be a symbol, method, object or string - # that represents the path/action on the Rails controller - # the data is the http parameters and environment sent in - # the Rails 5 http call - corrector.replace(node, correction(node)) - end - end - end - - private - - def in_routing_block?(node) - !!node.each_ancestor(:block).detect { |block| ROUTING_METHODS.include?(block.method_name) } - end - - def use_rack_test_methods? - processed_source.ast.each_descendant(:send).any? do |node| - include_rack_test_methods?(node) - end - end - - def needs_conversion?(data) - return true unless data.hash_type? - return false if kwsplat_hash?(data) - - data.each_pair.none? do |pair| - special_keyword_arg?(pair.key) || (format_arg?(pair.key) && data.pairs.one?) - end - end - - def special_keyword_arg?(node) - node.sym_type? && KEYWORD_ARGS.include?(node.value) - end - - def format_arg?(node) - node.sym_type? && node.value == :format - end - - def highlight_range(node) - _http_path, *data = *node.arguments - - range_between(data.first.source_range.begin_pos, data.last.source_range.end_pos) - end - - def convert_hash_data(data, type) - return '' if data.hash_type? && data.empty? - - hash_data = if data.hash_type? - format('{ %s }', data: data.pairs.map(&:source).join(', ')) - else - # user supplies an object, - # no need to surround with braces - data.source - end - - format(', %s: %s', type: type, hash_data: hash_data) - end - - def correction(node) - http_path, *data = *node.arguments - - controller_action = http_path.source - params = convert_hash_data(data.first, 'params') - session = convert_hash_data(data.last, 'session') if data.size > 1 - - format(correction_template(node), name: node.method_name, - action: controller_action, - params: params, - session: session) - end - - def correction_template(node) - if parentheses?(node) - '%s(%s%s%s)' - else - '%s %s%s%s' - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/http_status.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/http_status.rb deleted file mode 100644 index 52eb64966a5c83..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/http_status.rb +++ /dev/null @@ -1,164 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces use of symbolic or numeric value to define HTTP status. - # - # @example EnforcedStyle: symbolic (default) - # # bad - # render :foo, status: 200 - # render json: { foo: 'bar' }, status: 200 - # render plain: 'foo/bar', status: 304 - # redirect_to root_url, status: 301 - # head 200 - # - # # good - # render :foo, status: :ok - # render json: { foo: 'bar' }, status: :ok - # render plain: 'foo/bar', status: :not_modified - # redirect_to root_url, status: :moved_permanently - # head :ok - # - # @example EnforcedStyle: numeric - # # bad - # render :foo, status: :ok - # render json: { foo: 'bar' }, status: :not_found - # render plain: 'foo/bar', status: :not_modified - # redirect_to root_url, status: :moved_permanently - # head :ok - # - # # good - # render :foo, status: 200 - # render json: { foo: 'bar' }, status: 404 - # render plain: 'foo/bar', status: 304 - # redirect_to root_url, status: 301 - # head 200 - # - class HttpStatus < Base - include ConfigurableEnforcedStyle - extend AutoCorrector - - RESTRICT_ON_SEND = %i[render redirect_to head].freeze - - def_node_matcher :http_status, <<~PATTERN - { - (send nil? {:render :redirect_to} _ $hash) - (send nil? {:render :redirect_to} $hash) - (send nil? :head ${int sym} ...) - } - PATTERN - - def_node_matcher :status_code, <<~PATTERN - (hash <(pair (sym :status) ${int sym}) ...>) - PATTERN - - def on_send(node) - http_status(node) do |hash_node_or_status_code| - status = if hash_node_or_status_code.hash_type? - status_code(hash_node_or_status_code) - else - hash_node_or_status_code - end - return unless status - - checker = checker_class.new(status) - return unless checker.offensive? - - add_offense(checker.node, message: checker.message) do |corrector| - corrector.replace(checker.node, checker.preferred_style) - end - end - end - - private - - def checker_class - case style - when :symbolic - SymbolicStyleChecker - when :numeric - NumericStyleChecker - end - end - - # :nodoc: - class SymbolicStyleChecker - MSG = 'Prefer `%s` over `%s` to define HTTP status code.' - DEFAULT_MSG = 'Prefer `symbolic` over `numeric` to define HTTP status code.' - - attr_reader :node - - def initialize(node) - @node = node - end - - def offensive? - !node.sym_type? && !custom_http_status_code? - end - - def message - format(MSG, prefer: preferred_style, current: number.to_s) - end - - def preferred_style - symbol.inspect - end - - private - - def symbol - ::Rack::Utils::SYMBOL_TO_STATUS_CODE.key(number) - end - - def number - node.children.first - end - - def custom_http_status_code? - node.int_type? && !::Rack::Utils::SYMBOL_TO_STATUS_CODE.value?(number) - end - end - - # :nodoc: - class NumericStyleChecker - MSG = 'Prefer `%s` over `%s` to define HTTP status code.' - DEFAULT_MSG = 'Prefer `numeric` over `symbolic` to define HTTP status code.' - PERMITTED_STATUS = %i[error success missing redirect].freeze - - attr_reader :node - - def initialize(node) - @node = node - end - - def offensive? - !node.int_type? && !permitted_symbol? - end - - def message - format(MSG, prefer: preferred_style, current: symbol.inspect) - end - - def preferred_style - number.to_s - end - - private - - def number - ::Rack::Utils::SYMBOL_TO_STATUS_CODE[symbol] - end - - def symbol - node.value - end - - def permitted_symbol? - node.sym_type? && PERMITTED_STATUS.include?(node.value) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/i18n_lazy_lookup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/i18n_lazy_lookup.rb deleted file mode 100644 index 90533972551eee..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/i18n_lazy_lookup.rb +++ /dev/null @@ -1,96 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for places where I18n "lazy" lookup can be used. - # - # @example - # # en.yml - # # en: - # # books: - # # create: - # # success: Book created! - # - # # bad - # class BooksController < ApplicationController - # def create - # # ... - # redirect_to books_url, notice: t('books.create.success') - # end - # end - # - # # good - # class BooksController < ApplicationController - # def create - # # ... - # redirect_to books_url, notice: t('.success') - # end - # end - # - class I18nLazyLookup < Base - include VisibilityHelp - extend AutoCorrector - - MSG = 'Use "lazy" lookup for the text used in controllers.' - - RESTRICT_ON_SEND = %i[translate t].freeze - - def_node_matcher :translate_call?, <<~PATTERN - (send nil? {:translate :t} ${sym_type? str_type?} ...) - PATTERN - - def on_send(node) - translate_call?(node) do |key_node| - key = key_node.value - return if key.to_s.start_with?('.') - - controller, action = controller_and_action(node) - return unless controller && action - - scoped_key = get_scoped_key(key_node, controller, action) - return unless key == scoped_key - - add_offense(key_node) do |corrector| - unscoped_key = key_node.value.to_s.split('.').last - corrector.replace(key_node, "'.#{unscoped_key}'") - end - end - end - - private - - def controller_and_action(node) - action_node = node.each_ancestor(:def).first - return unless action_node && node_visibility(action_node) == :public - - controller_node = node.each_ancestor(:class).first - return unless controller_node && controller_node.identifier.source.end_with?('Controller') - - [controller_node, action_node] - end - - def get_scoped_key(key_node, controller, action) - path = controller_path(controller).tr('/', '.') - action_name = action.method_name - key = key_node.value.to_s.split('.').last - - "#{path}.#{action_name}.#{key}" - end - - def controller_path(controller) - module_name = controller.parent_module_name - controller_name = controller.identifier.source - - path = if module_name == 'Object' - controller_name - else - "#{module_name}::#{controller_name}" - end - - path.delete_suffix('Controller').underscore - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/i18n_locale_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/i18n_locale_assignment.rb deleted file mode 100644 index 1f9e852d5ae1db..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/i18n_locale_assignment.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for the use of `I18n.locale=` method. - # - # The `locale` attribute persists for the rest of the Ruby runtime, potentially causing - # unexpected behavior at a later time. - # Using `I18n.with_locale` ensures the code passed in the block is the only place `I18n.locale` is affected. - # It eliminates the possibility of a `locale` sticking around longer than intended. - # - # @example - # # bad - # I18n.locale = :fr - # - # # good - # I18n.with_locale(:fr) do - # end - # - class I18nLocaleAssignment < Base - MSG = 'Use `I18n.with_locale` with block instead of `I18n.locale=`.' - RESTRICT_ON_SEND = %i[locale=].freeze - - def_node_matcher :i18n_locale_assignment?, <<~PATTERN - (send (const {nil? cbase} :I18n) :locale= ...) - PATTERN - - def on_send(node) - return unless i18n_locale_assignment?(node) - - add_offense(node) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/i18n_locale_texts.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/i18n_locale_texts.rb deleted file mode 100644 index cb6207d2e479b6..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/i18n_locale_texts.rb +++ /dev/null @@ -1,110 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces use of I18n and locale files instead of locale specific strings. - # - # @example - # # bad - # class User < ApplicationRecord - # validates :email, presence: { message: "must be present" } - # end - # - # # good - # # config/locales/en.yml - # # en: - # # activerecord: - # # errors: - # # models: - # # user: - # # blank: "must be present" - # - # class User < ApplicationRecord - # validates :email, presence: true - # end - # - # # bad - # class PostsController < ApplicationController - # def create - # # ... - # redirect_to root_path, notice: "Post created!" - # end - # end - # - # # good - # # config/locales/en.yml - # # en: - # # posts: - # # create: - # # success: "Post created!" - # - # class PostsController < ApplicationController - # def create - # # ... - # redirect_to root_path, notice: t(".success") - # end - # end - # - # # bad - # class UserMailer < ApplicationMailer - # def welcome(user) - # mail(to: user.email, subject: "Welcome to My Awesome Site") - # end - # end - # - # # good - # # config/locales/en.yml - # # en: - # # user_mailer: - # # welcome: - # # subject: "Welcome to My Awesome Site" - # - # class UserMailer < ApplicationMailer - # def welcome(user) - # mail(to: user.email) - # end - # end - # - class I18nLocaleTexts < Base - MSG = 'Move locale texts to the locale files in the `config/locales` directory.' - - RESTRICT_ON_SEND = %i[validates redirect_to redirect_back []= mail].freeze - - def_node_search :validation_message, <<~PATTERN - (pair (sym :message) $str) - PATTERN - - def_node_search :redirect_to_flash, <<~PATTERN - (pair (sym {:notice :alert}) $str) - PATTERN - - def_node_matcher :flash_assignment?, <<~PATTERN - (send (send nil? :flash) :[]= _ $str) - PATTERN - - def_node_search :mail_subject, <<~PATTERN - (pair (sym :subject) $str) - PATTERN - - def on_send(node) - case node.method_name - when :validates - validation_message(node) do |text_node| - add_offense(text_node) - end - return - when :redirect_to, :redirect_back - text_node = redirect_to_flash(node).to_a.last - when :[]= - text_node = flash_assignment?(node) - when :mail - text_node = mail_subject(node).to_a.last - end - - add_offense(text_node) if text_node - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/ignored_columns_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/ignored_columns_assignment.rb deleted file mode 100644 index 66fa445b11b5a6..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/ignored_columns_assignment.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Looks for assignments of `ignored_columns` that may override previous - # assignments. - # - # Overwriting previous assignments is usually a mistake, since it will - # un-ignore the first set of columns. Since duplicate column names is not - # a problem, it is better to simply append to the list. - # - # @example - # - # # bad - # class User < ActiveRecord::Base - # self.ignored_columns = [:one] - # end - # - # # bad - # class User < ActiveRecord::Base - # self.ignored_columns = [:one, :two] - # end - # - # # good - # class User < ActiveRecord::Base - # self.ignored_columns += [:one, :two] - # end - # - # # good - # class User < ActiveRecord::Base - # self.ignored_columns += [:one] - # self.ignored_columns += [:two] - # end - # - class IgnoredColumnsAssignment < Base - extend AutoCorrector - - MSG = 'Use `+=` instead of `=`.' - RESTRICT_ON_SEND = %i[ignored_columns=].freeze - - def on_send(node) - add_offense(node.loc.operator) do |corrector| - corrector.replace(node.loc.operator, '+=') - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb deleted file mode 100644 index 17bddcbd44ef14..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb +++ /dev/null @@ -1,87 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks that `if` and `only` (or `except`) are not used together - # as options of `skip_*` action filter. - # - # The `if` option will be ignored when `if` and `only` are used together. - # Similarly, the `except` option will be ignored when `if` and `except` - # are used together. - # - # @example - # # bad - # class MyPageController < ApplicationController - # skip_before_action :login_required, - # only: :show, if: :trusted_origin? - # end - # - # # good - # class MyPageController < ApplicationController - # skip_before_action :login_required, - # if: -> { trusted_origin? && action_name == "show" } - # end - # - # @example - # # bad - # class MyPageController < ApplicationController - # skip_before_action :login_required, - # except: :admin, if: :trusted_origin? - # end - # - # # good - # class MyPageController < ApplicationController - # skip_before_action :login_required, - # if: -> { trusted_origin? && action_name != "admin" } - # end - class IgnoredSkipActionFilterOption < Base - MSG = <<~MSG.chomp.freeze - `%s` option will be ignored when `%s` and `%s` are used together. - MSG - - RESTRICT_ON_SEND = %i[skip_after_action skip_around_action skip_before_action skip_action_callback].freeze - - FILTERS = RESTRICT_ON_SEND.map { |method_name| ":#{method_name}" } - - def_node_matcher :filter_options, <<~PATTERN - (send - nil? - {#{FILTERS.join(' ')}} - _ - $_) - PATTERN - - def on_send(node) - options = filter_options(node) - return unless options - return unless options.hash_type? - - options = options_hash(options) - - if if_and_only?(options) - add_offense(options[:if], message: format(MSG, prefer: :only, ignore: :if)) - elsif if_and_except?(options) - add_offense(options[:except], message: format(MSG, prefer: :if, ignore: :except)) - end - end - - private - - def options_hash(options) - options.pairs - .select { |pair| pair.key.sym_type? } - .to_h { |pair| [pair.key.value, pair] } - end - - def if_and_only?(options) - options.key?(:if) && options.key?(:only) - end - - def if_and_except?(options) - options.key?(:if) && options.key?(:except) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/index_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/index_by.rb deleted file mode 100644 index 646cf8ebdaa3ba..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/index_by.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Looks for uses of `each_with_object({}) { ... }`, - # `map { ... }.to_h`, and `Hash[map { ... }]` that are transforming - # an enumerable into a hash where the values are the original elements. - # Rails provides the `index_by` method for this purpose. - # - # @example - # # bad - # [1, 2, 3].each_with_object({}) { |el, h| h[foo(el)] = el } - # [1, 2, 3].to_h { |el| [foo(el), el] } - # [1, 2, 3].map { |el| [foo(el), el] }.to_h - # Hash[[1, 2, 3].collect { |el| [foo(el), el] }] - # - # # good - # [1, 2, 3].index_by { |el| foo(el) } - class IndexBy < Base - include IndexMethod - extend AutoCorrector - - def_node_matcher :on_bad_each_with_object, <<~PATTERN - (block - (call _ :each_with_object (hash)) - (args (arg $_el) (arg _memo)) - (call (lvar _memo) :[]= $!`_memo (lvar _el))) - PATTERN - - def_node_matcher :on_bad_to_h, <<~PATTERN - (block - (call _ :to_h) - (args (arg $_el)) - (array $_ (lvar _el))) - PATTERN - - def_node_matcher :on_bad_map_to_h, <<~PATTERN - (call - (block - (call _ {:map :collect}) - (args (arg $_el)) - (array $_ (lvar _el))) - :to_h) - PATTERN - - def_node_matcher :on_bad_hash_brackets_map, <<~PATTERN - (send - (const {nil? cbase} :Hash) - :[] - (block - (call _ {:map :collect}) - (args (arg $_el)) - (array $_ (lvar _el)))) - PATTERN - - private - - def new_method_name - 'index_by' - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/index_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/index_with.rb deleted file mode 100644 index 90cc3be458760b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/index_with.rb +++ /dev/null @@ -1,68 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Looks for uses of `each_with_object({}) { ... }`, - # `map { ... }.to_h`, and `Hash[map { ... }]` that are transforming - # an enumerable into a hash where the keys are the original elements. - # Rails provides the `index_with` method for this purpose. - # - # @example - # # bad - # [1, 2, 3].each_with_object({}) { |el, h| h[el] = foo(el) } - # [1, 2, 3].to_h { |el| [el, foo(el)] } - # [1, 2, 3].map { |el| [el, foo(el)] }.to_h - # Hash[[1, 2, 3].collect { |el| [el, foo(el)] }] - # - # # good - # [1, 2, 3].index_with { |el| foo(el) } - class IndexWith < Base - extend AutoCorrector - extend TargetRailsVersion - include IndexMethod - - minimum_target_rails_version 6.0 - - def_node_matcher :on_bad_each_with_object, <<~PATTERN - (block - (call _ :each_with_object (hash)) - (args (arg $_el) (arg _memo)) - (call (lvar _memo) :[]= (lvar _el) $!`_memo)) - PATTERN - - def_node_matcher :on_bad_to_h, <<~PATTERN - (block - (call _ :to_h) - (args (arg $_el)) - (array (lvar _el) $_)) - PATTERN - - def_node_matcher :on_bad_map_to_h, <<~PATTERN - (call - (block - (call _ {:map :collect}) - (args (arg $_el)) - (array (lvar _el) $_)) - :to_h) - PATTERN - - def_node_matcher :on_bad_hash_brackets_map, <<~PATTERN - (send - (const {nil? cbase} :Hash) - :[] - (block - (call _ {:map :collect}) - (args (arg $_el)) - (array (lvar _el) $_))) - PATTERN - - private - - def new_method_name - 'index_with' - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/inquiry.rb deleted file mode 100644 index a7933a93478311..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/inquiry.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks that Active Support's `inquiry` method is not used. - # - # @example - # # bad - String#inquiry - # ruby = 'two'.inquiry - # ruby.two? - # - # # good - # ruby = 'two' - # ruby == 'two' - # - # # bad - Array#inquiry - # pets = %w(cat dog).inquiry - # pets.gopher? - # - # # good - # pets = %w(cat dog) - # pets.include? 'cat' - # - class Inquiry < Base - MSG = "Prefer Ruby's comparison operators over Active Support's `inquiry`." - RESTRICT_ON_SEND = %i[inquiry].freeze - - def on_send(node) - return unless node.arguments.empty? - return unless (receiver = node.receiver) - return if !receiver.str_type? && !receiver.array_type? - - add_offense(node.loc.selector) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/inverse_of.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/inverse_of.rb deleted file mode 100644 index c4dbd0e8eb722f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/inverse_of.rb +++ /dev/null @@ -1,252 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Looks for has_(one|many) and belongs_to associations where - # Active Record can't automatically determine the inverse association - # because of a scope or the options used. Using the blog with order scope - # example below, traversing the a Blog's association in both directions - # with `blog.posts.first.blog` would cause the `blog` to be loaded from - # the database twice. - # - # `:inverse_of` must be manually specified for Active Record to use the - # associated object in memory, or set to `false` to opt-out. Note that - # setting `nil` does not stop Active Record from trying to determine the - # inverse automatically, and is not considered a valid value for this. - # - # @example - # # good - # class Blog < ApplicationRecord - # has_many :posts - # end - # - # class Post < ApplicationRecord - # belongs_to :blog - # end - # - # @example - # # bad - # class Blog < ApplicationRecord - # has_many :posts, -> { order(published_at: :desc) } - # end - # - # class Post < ApplicationRecord - # belongs_to :blog - # end - # - # # good - # class Blog < ApplicationRecord - # has_many(:posts, - # -> { order(published_at: :desc) }, - # inverse_of: :blog) - # end - # - # class Post < ApplicationRecord - # belongs_to :blog - # end - # - # # good - # class Blog < ApplicationRecord - # with_options inverse_of: :blog do - # has_many :posts, -> { order(published_at: :desc) } - # end - # end - # - # class Post < ApplicationRecord - # belongs_to :blog - # end - # - # # good - # # When you don't want to use the inverse association. - # class Blog < ApplicationRecord - # has_many(:posts, - # -> { order(published_at: :desc) }, - # inverse_of: false) - # end - # - # @example - # # bad - # class Picture < ApplicationRecord - # belongs_to :imageable, polymorphic: true - # end - # - # class Employee < ApplicationRecord - # has_many :pictures, as: :imageable - # end - # - # class Product < ApplicationRecord - # has_many :pictures, as: :imageable - # end - # - # # good - # class Picture < ApplicationRecord - # belongs_to :imageable, polymorphic: true - # end - # - # class Employee < ApplicationRecord - # has_many :pictures, as: :imageable, inverse_of: :imageable - # end - # - # class Product < ApplicationRecord - # has_many :pictures, as: :imageable, inverse_of: :imageable - # end - # - # @example - # # bad - # # However, RuboCop can not detect this pattern... - # class Physician < ApplicationRecord - # has_many :appointments - # has_many :patients, through: :appointments - # end - # - # class Appointment < ApplicationRecord - # belongs_to :physician - # belongs_to :patient - # end - # - # class Patient < ApplicationRecord - # has_many :appointments - # has_many :physicians, through: :appointments - # end - # - # # good - # class Physician < ApplicationRecord - # has_many :appointments - # has_many :patients, through: :appointments - # end - # - # class Appointment < ApplicationRecord - # belongs_to :physician, inverse_of: :appointments - # belongs_to :patient, inverse_of: :appointments - # end - # - # class Patient < ApplicationRecord - # has_many :appointments - # has_many :physicians, through: :appointments - # end - # - # @example IgnoreScopes: false (default) - # # bad - # class Blog < ApplicationRecord - # has_many :posts, -> { order(published_at: :desc) } - # end - # - # @example IgnoreScopes: true - # # good - # class Blog < ApplicationRecord - # has_many :posts, -> { order(published_at: :desc) } - # end - class InverseOf < Base - SPECIFY_MSG = 'Specify an `:inverse_of` option.' - NIL_MSG = 'You specified `inverse_of: nil`, you probably meant to use `inverse_of: false`.' - RESTRICT_ON_SEND = %i[has_many has_one belongs_to].freeze - - def_node_matcher :association_recv_arguments, <<~PATTERN - (send $_ {:has_many :has_one :belongs_to} _ $...) - PATTERN - - def_node_matcher :options_from_argument, <<~PATTERN - (hash $...) - PATTERN - - def_node_matcher :conditions_option?, <<~PATTERN - (pair (sym :conditions) !nil) - PATTERN - - def_node_matcher :through_option?, <<~PATTERN - (pair (sym :through) !nil) - PATTERN - - def_node_matcher :polymorphic_option?, <<~PATTERN - (pair (sym :polymorphic) !nil) - PATTERN - - def_node_matcher :as_option?, <<~PATTERN - (pair (sym :as) !nil) - PATTERN - - def_node_matcher :foreign_key_option?, <<~PATTERN - (pair (sym :foreign_key) !nil) - PATTERN - - def_node_matcher :inverse_of_option?, <<~PATTERN - (pair (sym :inverse_of) !nil) - PATTERN - - def_node_matcher :inverse_of_nil_option?, <<~PATTERN - (pair (sym :inverse_of) nil) - PATTERN - - def on_send(node) - recv, arguments = association_recv_arguments(node) - return unless arguments - - with_options = with_options_arguments(recv, node) - - options = arguments.concat(with_options).flat_map do |arg| - options_from_argument(arg) - end - return if options_ignoring_inverse_of?(options) - - return unless scope?(arguments) || options_requiring_inverse_of?(options) - - return if options_contain_inverse_of?(options) - - add_offense(node.loc.selector, message: message(options)) - end - - def scope?(arguments) - !ignore_scopes? && arguments.any?(&:block_type?) - end - - def options_requiring_inverse_of?(options) - required = options.any? do |opt| - conditions_option?(opt) || foreign_key_option?(opt) - end - - return required if target_rails_version >= 5.2 - - required || options.any? { |opt| as_option?(opt) } - end - - def options_ignoring_inverse_of?(options) - options.any? do |opt| - through_option?(opt) || polymorphic_option?(opt) - end - end - - def options_contain_inverse_of?(options) - options.any? { |opt| inverse_of_option?(opt) } - end - - def with_options_arguments(recv, node) - blocks = node.each_ancestor(:block).select do |block| - block.send_node.command?(:with_options) && same_context_in_with_options?(block.arguments.first, recv) - end - blocks.flat_map { |n| n.send_node.arguments } - end - - def same_context_in_with_options?(arg, recv) - return true if arg.nil? && recv.nil? - - arg && recv && arg.children[0] == recv.children[0] - end - - private - - def message(options) - if options.any? { |opt| inverse_of_nil_option?(opt) } - NIL_MSG - else - SPECIFY_MSG - end - end - - def ignore_scopes? - cop_config['IgnoreScopes'] == true - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb deleted file mode 100644 index a79713f5134193..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +++ /dev/null @@ -1,205 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks that methods specified in the filter's `only` or - # `except` options are defined within the same class or module. - # - # @safety - # You can technically specify methods of superclass or methods added by - # mixins on the filter, but these can confuse developers. If you specify - # methods that are defined in other classes or modules, you should - # define the filter in that class or module. - # - # If you rely on behavior defined in the superclass actions, you must - # remember to invoke `super` in the subclass actions. - # - # @example - # # bad - # class LoginController < ApplicationController - # before_action :require_login, only: %i[index settings logout] - # - # def index - # end - # end - # - # # good - # class LoginController < ApplicationController - # before_action :require_login, only: %i[index settings logout] - # - # def index - # end - # - # def settings - # end - # - # def logout - # end - # end - # - # @example - # # bad - # module FooMixin - # extend ActiveSupport::Concern - # - # included do - # before_action proc { authenticate }, only: :foo - # end - # end - # - # # good - # module FooMixin - # extend ActiveSupport::Concern - # - # included do - # before_action proc { authenticate }, only: :foo - # end - # - # def foo - # # something - # end - # end - # - # @example - # class ContentController < ApplicationController - # def update - # @content.update(content_attributes) - # end - # end - # - # class ArticlesController < ContentController - # before_action :load_article, only: [:update] - # - # # the cop requires this method, but it relies on behavior defined - # # in the superclass, so needs to invoke `super` - # def update - # super - # end - # - # private - # - # def load_article - # @content = Article.find(params[:article_id]) - # end - # end - class LexicallyScopedActionFilter < Base - MSG = '%s not explicitly defined on the %s.' - - RESTRICT_ON_SEND = %i[ - after_action - append_after_action - append_around_action - append_before_action - around_action - before_action - prepend_after_action - prepend_around_action - prepend_before_action - skip_after_action - skip_around_action - skip_before_action - skip_action_callback - ].freeze - - FILTERS = RESTRICT_ON_SEND.map { |method_name| ":#{method_name}" } - - def_node_matcher :only_or_except_filter_methods, <<~PATTERN - (send - nil? - {#{FILTERS.join(' ')}} - _ - (hash - (pair - (sym {:only :except}) - $_))) - PATTERN - - def on_send(node) - methods_node = only_or_except_filter_methods(node) - return unless methods_node - - parent = node.each_ancestor(:class, :module).first - return unless parent - - block = parent.each_child_node(:begin).first - return unless block - - defined_action_methods = defined_action_methods(block) - - methods = array_values(methods_node).reject do |method| - defined_action_methods.include?(method) - end - - message = message(methods, parent) - add_offense(node, message: message) unless methods.empty? - end - - private - - def defined_action_methods(block) - defined_methods = block.each_child_node(:def).map(&:method_name) - - defined_methods + aliased_action_methods(block, defined_methods) - end - - def aliased_action_methods(node, defined_methods) - alias_methods = alias_methods(node) - defined_methods.each_with_object([]) do |defined_method, aliased_method| - if (new_method_name = alias_methods[defined_method]) - aliased_method << new_method_name - end - end - end - - def alias_methods(node) - result = {} - node.each_child_node(:send, :alias) do |child_node| - case child_node.type - when :send - if child_node.method?(:alias_method) - result[child_node.last_argument.value] = child_node.first_argument.value - end - when :alias - result[child_node.old_identifier.value] = child_node.new_identifier.value - end - end - result - end - - # @param node [RuboCop::AST::Node] - # @return [Array] - def array_values(node) # rubocop:disable Metrics/MethodLength - case node.type - when :str - [node.str_content.to_sym] - when :sym - [node.value] - when :array - node.values.map do |v| - case v.type - when :str - v.str_content.to_sym - when :sym - v.value - end - end.compact - else - [] - end - end - - # @param methods [Array] - # @param parent [RuboCop::AST::Node] - # @return [String] - def message(methods, parent) - if methods.size == 1 - format(MSG, action: "`#{methods[0]}` is", type: parent.type) - else - format(MSG, action: "`#{methods.join('`, `')}` are", type: parent.type) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/link_to_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/link_to_blank.rb deleted file mode 100644 index 61484050d214a8..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/link_to_blank.rb +++ /dev/null @@ -1,97 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for calls to `link_to` that contain a - # `target: '_blank'` but no `rel: 'noopener'`. This can be a security - # risk as the loaded page will have control over the previous page - # and could change its location for phishing purposes. - # - # The option `rel: 'noreferrer'` also blocks this behavior - # and removes the http-referrer header. - # - # @example - # # bad - # link_to 'Click here', url, target: '_blank' - # - # # good - # link_to 'Click here', url, target: '_blank', rel: 'noopener' - # - # # good - # link_to 'Click here', url, target: '_blank', rel: 'noreferrer' - class LinkToBlank < Base - extend AutoCorrector - - MSG = 'Specify a `:rel` option containing noopener.' - RESTRICT_ON_SEND = %i[link_to].freeze - - def_node_matcher :blank_target?, <<~PATTERN - (pair {(sym :target) (str "target")} {(str "_blank") (sym :_blank)}) - PATTERN - - def_node_matcher :includes_noopener?, <<~PATTERN - (pair {(sym :rel) (str "rel")} ({str sym} #contains_noopener?)) - PATTERN - - def_node_matcher :rel_node?, <<~PATTERN - (pair {(sym :rel) (str "rel")} (str _)) - PATTERN - - def on_send(node) - option_nodes = node.each_child_node(:hash) - - option_nodes.map(&:children).each do |options| - blank = options.find { |o| blank_target?(o) } - next unless blank && options.none? { |o| includes_noopener?(o) } - - add_offense(blank) do |corrector| - autocorrect(corrector, node, blank, option_nodes) - end - end - end - - private - - def autocorrect(corrector, send_node, node, option_nodes) - rel_node = nil - option_nodes.map(&:children).each do |options| - rel_node ||= options.find { |o| rel_node?(o) } - end - - if rel_node - append_to_rel(rel_node, corrector) - else - add_rel(send_node, node, corrector) - end - end - - def append_to_rel(rel_node, corrector) - existing_rel = rel_node.children.last.value - str_range = rel_node.children.last.source_range.adjust(begin_pos: 1, end_pos: -1) - corrector.replace(str_range, "#{existing_rel} noopener") - end - - def add_rel(send_node, offense_node, corrector) - opening_quote = offense_node.children.last.source[0] - closing_quote = opening_quote == ':' ? '' : opening_quote - new_rel_exp = ", rel: #{opening_quote}noopener#{closing_quote}" - range = if (last_argument = send_node.last_argument).hash_type? - last_argument.pairs.last.source_range - else - last_argument.source_range - end - - corrector.insert_after(range, new_rel_exp) - end - - def contains_noopener?(value) - return false unless value - - rel_array = value.to_s.split - rel_array.include?('noopener') || rel_array.include?('noreferrer') - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/mailer_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/mailer_name.rb deleted file mode 100644 index 168434b7df7d03..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/mailer_name.rb +++ /dev/null @@ -1,90 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces that mailer names end with `Mailer` suffix. - # - # Without the `Mailer` suffix it isn't immediately apparent what's a mailer - # and which views are related to the mailer. - # - # @safety - # This cop's autocorrection is unsafe because renaming a constant is - # always an unsafe operation. - # - # @example - # # bad - # class User < ActionMailer::Base - # end - # - # class User < ApplicationMailer - # end - # - # # good - # class UserMailer < ActionMailer::Base - # end - # - # class UserMailer < ApplicationMailer - # end - # - class MailerName < Base - extend AutoCorrector - - MSG = 'Mailer should end with `Mailer` suffix.' - - def_node_matcher :mailer_base_class?, <<~PATTERN - { - (const (const {nil? cbase} :ActionMailer) :Base) - (const {nil? cbase} :ApplicationMailer) - } - PATTERN - - def_node_matcher :class_definition?, <<~PATTERN - (class $(const _ !#mailer_suffix?) #mailer_base_class? ...) - PATTERN - - def_node_matcher :class_new_definition?, <<~PATTERN - (send (const {nil? cbase} :Class) :new #mailer_base_class?) - PATTERN - - def on_class(node) - class_definition?(node) do |name_node| - add_offense(name_node) do |corrector| - autocorrect(corrector, name_node) - end - end - end - - def on_send(node) - return unless class_new_definition?(node) - - casgn_parent = node.each_ancestor(:casgn).first - return unless casgn_parent - - name = casgn_parent.children[1] - return if mailer_suffix?(name) - - add_offense(casgn_parent.loc.name) do |corrector| - autocorrect(corrector, casgn_parent) - end - end - - private - - def autocorrect(corrector, node) - if node.casgn_type? - name = node.children[1] - corrector.replace(node.loc.name, "#{name}Mailer") - else - name = node.children.last - corrector.replace(node, "#{name}Mailer") - end - end - - def mailer_suffix?(mailer_name) - mailer_name.to_s.end_with?('Mailer') - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/match_route.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/match_route.rb deleted file mode 100644 index e7c7b4c418cd31..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/match_route.rb +++ /dev/null @@ -1,120 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Identifies places where defining routes with `match` - # can be replaced with a specific HTTP method. - # - # Don't use `match` to define any routes unless there is a need to map multiple request types - # among [:get, :post, :patch, :put, :delete] to a single action using the `:via` option. - # - # @example - # # bad - # match ':controller/:action/:id' - # match 'photos/:id', to: 'photos#show', via: :get - # - # # good - # get ':controller/:action/:id' - # get 'photos/:id', to: 'photos#show' - # match 'photos/:id', to: 'photos#show', via: [:get, :post] - # match 'photos/:id', to: 'photos#show', via: :all - # - class MatchRoute < Base - extend AutoCorrector - - MSG = 'Use `%s` instead of `match` to define a route.' - RESTRICT_ON_SEND = %i[match].freeze - HTTP_METHODS = %i[get post put patch delete].freeze - - def_node_matcher :match_method_call?, <<~PATTERN - (send nil? :match $_ $(hash ...) ?) - PATTERN - - def on_send(node) - match_method_call?(node) do |path_node, options_node| - return unless within_routes?(node) - - options_node = path_node.hash_type? ? path_node : options_node.first - - if options_node.nil? - register_offense(node, 'get') - else - via = extract_via(options_node) - return unless via.size == 1 && http_method?(via.first) - - register_offense(node, via.first) - end - end - end - - private - - def register_offense(node, http_method) - add_offense(node, message: format(MSG, http_method: http_method)) do |corrector| - match_method_call?(node) do |path_node, options_node| - options_node = options_node.first - - corrector.replace(node, replacement(path_node, options_node)) - end - end - end - - def_node_matcher :routes_draw?, <<~PATTERN - (send (send _ :routes) :draw) - PATTERN - - def within_routes?(node) - node.each_ancestor(:block).any? { |a| routes_draw?(a.send_node) } - end - - def extract_via(node) - via_pair = via_pair(node) - return %i[get] unless via_pair - - _, via = *via_pair - - if via.basic_literal? - [via.value] - elsif via.array_type? - via.values.map(&:value) - else - [] - end - end - - def via_pair(node) - node.pairs.find { |p| p.key.value == :via } - end - - def http_method?(method) - HTTP_METHODS.include?(method.to_sym) - end - - def replacement(path_node, options_node) - if path_node.hash_type? - http_method, options = *http_method_and_options(path_node) - "#{http_method} #{options.map(&:source).join(', ')}" - elsif options_node.nil? - "get #{path_node.source}" - else - http_method, options = *http_method_and_options(options_node) - - if options.any? - "#{http_method} #{path_node.source}, #{options.map(&:source).join(', ')}" - else - "#{http_method} #{path_node.source}" - end - end - end - - def http_method_and_options(node) - via_pair = via_pair(node) - http_method = extract_via(node).first - rest_pairs = node.pairs - [via_pair] - [http_method, rest_pairs] - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/migration_class_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/migration_class_name.rb deleted file mode 100644 index 1e895accde70f5..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/migration_class_name.rb +++ /dev/null @@ -1,63 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Makes sure that each migration file defines a migration class - # whose name matches the file name. - # (e.g. `20220224111111_create_users.rb` should define `CreateUsers` class.) - # - # @example - # # db/migrate/20220224111111_create_users.rb - # - # # bad - # class SellBooks < ActiveRecord::Migration[7.0] - # end - # - # # good - # class CreateUsers < ActiveRecord::Migration[7.0] - # end - # - class MigrationClassName < Base - extend AutoCorrector - include MigrationsHelper - - MSG = 'Replace with `%s` that matches the file name.' - - def on_class(node) - return unless migration_class?(node) - - basename = basename_without_timestamp_and_suffix(processed_source.file_path) - - class_identifier = node.identifier.location.name - camelized_basename = camelize(basename) - return if class_identifier.source.casecmp(camelized_basename).zero? - - message = format(MSG, camelized_basename: camelized_basename) - - add_offense(class_identifier, message: message) do |corrector| - corrector.replace(class_identifier, camelized_basename) - end - end - - private - - def basename_without_timestamp_and_suffix(filepath) - basename = File.basename(filepath, '.rb') - basename = remove_gem_suffix(basename) - - basename.sub(/\A\d+_/, '') - end - - # e.g.: from `add_blobs.active_storage` to `add_blobs`. - def remove_gem_suffix(file_name) - file_name.sub(/\..+\z/, '') - end - - def camelize(word) - word.split('_').map(&:capitalize).join - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/negate_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/negate_include.rb deleted file mode 100644 index cf48cda252c434..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/negate_include.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces the use of `collection.exclude?(obj)` - # over `!collection.include?(obj)`. - # - # @safety - # This cop is unsafe because false positive will occur for - # receiver objects that do not have an `exclude?` method. (e.g. `IPAddr`) - # - # @example - # # bad - # !array.include?(2) - # !hash.include?(:key) - # - # # good - # array.exclude?(2) - # hash.exclude?(:key) - # - class NegateInclude < Base - extend AutoCorrector - - MSG = 'Use `.exclude?` and remove the negation part.' - RESTRICT_ON_SEND = %i[!].freeze - - def_node_matcher :negate_include_call?, <<~PATTERN - (send (send $!nil? :include? $_) :!) - PATTERN - - def on_send(node) - return unless (receiver, obj = negate_include_call?(node)) - - add_offense(node) do |corrector| - corrector.replace(node, "#{receiver.source}.exclude?(#{obj.source})") - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/not_null_column.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/not_null_column.rb deleted file mode 100644 index 7f8e41c8be4efc..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/not_null_column.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for add_column call with NOT NULL constraint - # in migration file. - # - # @example - # # bad - # add_column :users, :name, :string, null: false - # add_reference :products, :category, null: false - # - # # good - # add_column :users, :name, :string, null: true - # add_column :users, :name, :string, null: false, default: '' - # add_reference :products, :category - # add_reference :products, :category, null: false, default: 1 - class NotNullColumn < Base - MSG = 'Do not add a NOT NULL column without a default value.' - RESTRICT_ON_SEND = %i[add_column add_reference].freeze - - def_node_matcher :add_not_null_column?, <<~PATTERN - (send nil? :add_column _ _ $_ (hash $...)) - PATTERN - - def_node_matcher :add_not_null_reference?, <<~PATTERN - (send nil? :add_reference _ _ (hash $...)) - PATTERN - - def_node_matcher :null_false?, <<~PATTERN - (pair (sym :null) (false)) - PATTERN - - def_node_matcher :default_option?, <<~PATTERN - (pair (sym :default) !nil) - PATTERN - - def on_send(node) - check_add_column(node) - check_add_reference(node) - end - - private - - def check_add_column(node) - add_not_null_column?(node) do |type, pairs| - return if type.value == :virtual || type.value == 'virtual' - - check_pairs(pairs) - end - end - - def check_add_reference(node) - add_not_null_reference?(node) do |pairs| - check_pairs(pairs) - end - end - - def check_pairs(pairs) - return if pairs.any? { |pair| default_option?(pair) } - - null_false = pairs.find { |pair| null_false?(pair) } - return unless null_false - - add_offense(null_false) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/order_by_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/order_by_id.rb deleted file mode 100644 index f5925821524de6..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/order_by_id.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for places where ordering by `id` column is used. - # - # Don't use the `id` column for ordering. The sequence of ids is not guaranteed - # to be in any particular order, despite often (incidentally) being chronological. - # Use a timestamp column to order chronologically. As a bonus the intent is clearer. - # - # NOTE: Make sure the changed order column does not introduce performance - # bottlenecks and appropriate database indexes are added. - # - # @example - # # bad - # scope :chronological, -> { order(id: :asc) } - # scope :chronological, -> { order(primary_key => :asc) } - # - # # good - # scope :chronological, -> { order(created_at: :asc) } - # - class OrderById < Base - include RangeHelp - - MSG = 'Do not use the `id` column for ordering. Use a timestamp column to order chronologically.' - RESTRICT_ON_SEND = %i[order].freeze - - def_node_matcher :order_by_id?, <<~PATTERN - (send _ :order - { - (sym :id) - (hash (pair (sym :id) _)) - (send _ :primary_key) - (hash (pair (send _ :primary_key) _)) - }) - PATTERN - - def on_send(node) - add_offense(offense_range(node)) if order_by_id?(node) - end - - private - - def offense_range(node) - range_between(node.loc.selector.begin_pos, node.source_range.end_pos) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/output.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/output.rb deleted file mode 100644 index 43b104c8f25a1a..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/output.rb +++ /dev/null @@ -1,68 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for the use of output calls like puts and print - # - # @safety - # This cop's autocorrection is unsafe because depending on the Rails log level configuration, - # changing from `puts` to `Rails.logger.debug` could result in no output being shown. - # - # @example - # # bad - # puts 'A debug message' - # pp 'A debug message' - # print 'A debug message' - # - # # good - # Rails.logger.debug 'A debug message' - class Output < Base - include RangeHelp - extend AutoCorrector - - MSG = "Do not write to stdout. Use Rails's logger if you want to log." - RESTRICT_ON_SEND = %i[ap p pp pretty_print print puts binwrite syswrite write write_nonblock].freeze - - def_node_matcher :output?, <<~PATTERN - (send nil? {:ap :p :pp :pretty_print :print :puts} ...) - PATTERN - - def_node_matcher :io_output?, <<~PATTERN - (send - { - (gvar #match_gvar?) - (const {nil? cbase} {:STDOUT :STDERR}) - } - {:binwrite :syswrite :write :write_nonblock} - ...) - PATTERN - - def on_send(node) - return if node.parent&.call_type? - return unless output?(node) || io_output?(node) - - range = offense_range(node) - - add_offense(range) do |corrector| - corrector.replace(range, 'Rails.logger.debug') - end - end - - private - - def match_gvar?(sym) - %i[$stdout $stderr].include?(sym) - end - - def offense_range(node) - if node.receiver - range_between(node.source_range.begin_pos, node.loc.selector.end_pos) - else - node.loc.selector - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/output_safety.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/output_safety.rb deleted file mode 100644 index fa754089f0c8e0..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/output_safety.rb +++ /dev/null @@ -1,104 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for the use of output safety calls like `html_safe`, - # `raw`, and `safe_concat`. These methods do not escape content. They - # simply return a SafeBuffer containing the content as is. Instead, - # use `safe_join` to join content and escape it and concat to - # concatenate content and escape it, ensuring its safety. - # - # @example - # user_content = "hi" - # - # # bad - # "

#{user_content}

".html_safe - # # => ActiveSupport::SafeBuffer "

hi

" - # - # # good - # content_tag(:p, user_content) - # # => ActiveSupport::SafeBuffer "

<b>hi</b>

" - # - # # bad - # out = "" - # out << "
  • #{user_content}
  • " - # out << "
  • #{user_content}
  • " - # out.html_safe - # # => ActiveSupport::SafeBuffer "
  • hi
  • hi
  • " - # - # # good - # out = [] - # out << content_tag(:li, user_content) - # out << content_tag(:li, user_content) - # safe_join(out) - # # => ActiveSupport::SafeBuffer - # # "
  • <b>hi</b>
  • <b>hi</b>
  • " - # - # # bad - # out = "

    trusted content

    ".html_safe - # out.safe_concat(user_content) - # # => ActiveSupport::SafeBuffer "

    trusted_content

    hi" - # - # # good - # out = "

    trusted content

    ".html_safe - # out.concat(user_content) - # # => ActiveSupport::SafeBuffer - # # "

    trusted_content

    <b>hi</b>" - # - # # safe, though maybe not good style - # out = "trusted content" - # result = out.concat(user_content) - # # => String "trusted contenthi" - # # because when rendered in ERB the String will be escaped: - # # <%= result %> - # # => trusted content<b>hi</b> - # - # # bad - # (user_content + " " + content_tag(:span, user_content)).html_safe - # # => ActiveSupport::SafeBuffer "hi hi" - # - # # good - # safe_join([user_content, " ", content_tag(:span, user_content)]) - # # => ActiveSupport::SafeBuffer - # # "<b>hi</b> <b>hi</b>" - class OutputSafety < Base - MSG = 'Tagging a string as html safe may be a security risk.' - RESTRICT_ON_SEND = %i[html_safe raw safe_concat].freeze - - def_node_search :i18n_method?, <<~PATTERN - (send {nil? (const {nil? cbase} :I18n)} {:t :translate :l :localize} ...) - PATTERN - - def on_send(node) - return if non_interpolated_string?(node) || i18n_method?(node) - - return unless looks_like_rails_html_safe?(node) || - looks_like_rails_raw?(node) || - looks_like_rails_safe_concat?(node) - - add_offense(node.loc.selector) - end - alias on_csend on_send - - private - - def non_interpolated_string?(node) - node.receiver&.str_type? && !node.receiver.dstr_type? - end - - def looks_like_rails_html_safe?(node) - node.receiver && node.method?(:html_safe) && !node.arguments? - end - - def looks_like_rails_raw?(node) - node.command?(:raw) && node.arguments.one? - end - - def looks_like_rails_safe_concat?(node) - node.method?(:safe_concat) && node.arguments.one? - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pick.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pick.rb deleted file mode 100644 index a13ba846f0a586..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pick.rb +++ /dev/null @@ -1,64 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces the use of `pick` over `pluck(...).first`. - # - # Using `pluck` followed by `first` creates an intermediate array, which - # `pick` avoids. When called on an Active Record relation, `pick` adds a - # limit to the query so that only one value is fetched from the database. - # - # @safety - # This cop is unsafe because `pluck` is defined on both `ActiveRecord::Relation` and `Enumerable`, - # whereas `pick` is only defined on `ActiveRecord::Relation` in Rails 6.0. This was addressed - # in Rails 6.1 via rails/rails#38760, at which point the cop is safe. - # - # See: https://github.com/rubocop/rubocop-rails/pull/249 - # - # @example - # # bad - # Model.pluck(:a).first - # [{ a: :b, c: :d }].pluck(:a, :b).first - # - # # good - # Model.pick(:a) - # [{ a: :b, c: :d }].pick(:a, :b) - class Pick < Base - extend AutoCorrector - extend TargetRailsVersion - - MSG = 'Prefer `pick(%s)` over `pluck(%s).first`.' - RESTRICT_ON_SEND = %i[first].freeze - - minimum_target_rails_version 6.0 - - def_node_matcher :pick_candidate?, <<~PATTERN - (send (send _ :pluck ...) :first) - PATTERN - - def on_send(node) - pick_candidate?(node) do - receiver = node.receiver - receiver_selector = receiver.loc.selector - node_selector = node.loc.selector - range = receiver_selector.join(node_selector) - - add_offense(range, message: message(receiver)) do |corrector| - first_range = receiver.source_range.end.join(node_selector) - - corrector.remove(first_range) - corrector.replace(receiver_selector, 'pick') - end - end - end - - private - - def message(receiver) - format(MSG, args: receiver.arguments.map(&:source).join(', ')) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pluck.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pluck.rb deleted file mode 100644 index ee10214853b7a3..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pluck.rb +++ /dev/null @@ -1,96 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces the use of `pluck` over `map`. - # - # `pluck` can be used instead of `map` to extract a single key from each - # element in an enumerable. When called on an Active Record relation, it - # results in a more efficient query that only selects the necessary key. - # - # @safety - # This cop is unsafe because model can use column aliases. - # - # [source,ruby] - # ---- - # # Original code - # User.select('name AS nickname').map { |user| user[:nickname] } # => array of nicknames - # - # # After autocorrection - # User.select('name AS nickname').pluck(:nickname) # => raises ActiveRecord::StatementInvalid - # ---- - # - # @example - # # bad - # Post.published.map { |post| post[:title] } - # [{ a: :b, c: :d }].collect { |el| el[:a] } - # - # # good - # Post.published.pluck(:title) - # [{ a: :b, c: :d }].pluck(:a) - class Pluck < Base - extend AutoCorrector - extend TargetRailsVersion - - MSG = 'Prefer `%s` over `%s`.' - - minimum_target_rails_version 5.0 - - def_node_matcher :pluck_candidate?, <<~PATTERN - ({block numblock} (send _ {:map :collect}) $_argument (send lvar :[] $_key)) - PATTERN - - def on_block(node) - pluck_candidate?(node) do |argument, key| - next if key.regexp_type? || !use_one_block_argument?(argument) - - match = if node.block_type? - block_argument = argument.children.first.source - use_block_argument_in_key?(block_argument, key) - else # numblock - argument == 1 && use_block_argument_in_key?('_1', key) - end - next unless match - - register_offense(node, key) - end - end - alias on_numblock on_block - - private - - def use_one_block_argument?(argument) - return true if argument == 1 # Checks for numbered argument `_1`. - - argument.respond_to?(:one?) && argument.one? - end - - def use_block_argument_in_key?(block_argument, key) - return false if block_argument == key.source - - key.each_descendant(:lvar).none? { |lvar| block_argument == lvar.source } - end - - def offense_range(node) - node.send_node.loc.selector.join(node.loc.end) - end - - def register_offense(node, key) - replacement = "pluck(#{key.source})" - message = message(replacement, node) - - add_offense(offense_range(node), message: message) do |corrector| - corrector.replace(offense_range(node), replacement) - end - end - - def message(replacement, node) - current = offense_range(node).source - - format(MSG, replacement: replacement, current: current) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pluck_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pluck_id.rb deleted file mode 100644 index 4ba2e109b28d43..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pluck_id.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces the use of `ids` over `pluck(:id)` and `pluck(primary_key)`. - # - # @safety - # This cop is unsafe if the receiver object is not an Active Record object. - # - # @example - # # bad - # User.pluck(:id) - # user.posts.pluck(:id) - # - # def self.user_ids - # pluck(primary_key) - # end - # - # # good - # User.ids - # user.posts.ids - # - # def self.user_ids - # ids - # end - # - class PluckId < Base - include RangeHelp - include ActiveRecordHelper - extend AutoCorrector - - MSG = 'Use `ids` instead of `%s`.' - RESTRICT_ON_SEND = %i[pluck].freeze - - def_node_matcher :pluck_id_call?, <<~PATTERN - (send _ :pluck {(sym :id) (send nil? :primary_key)}) - PATTERN - - def on_send(node) - return if !pluck_id_call?(node) || in_where?(node) - - range = offense_range(node) - message = format(MSG, bad_method: range.source) - - add_offense(range, message: message) do |corrector| - corrector.replace(offense_range(node), 'ids') - end - end - - private - - def offense_range(node) - range_between(node.loc.selector.begin_pos, node.source_range.end_pos) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pluck_in_where.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pluck_in_where.rb deleted file mode 100644 index 1da59673867e65..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pluck_in_where.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Identifies places where `pluck` is used in `where` query methods - # and can be replaced with `select`. - # - # Since `pluck` is an eager method and hits the database immediately, - # using `select` helps to avoid additional database queries. - # - # This cop has two different enforcement modes. When the `EnforcedStyle` - # is `conservative` (the default) then only calls to `pluck` on a constant - # (i.e. a model class) in the `where` is used as offenses. - # - # @safety - # When the `EnforcedStyle` is `aggressive` then all calls to `pluck` in the - # `where` is used as offenses. This may lead to false positives - # as the cop cannot replace to `select` between calls to `pluck` on an - # `ActiveRecord::Relation` instance vs a call to `pluck` on an `Array` instance. - # - # @example - # # bad - # Post.where(user_id: User.active.pluck(:id)) - # - # # good - # Post.where(user_id: User.active.select(:id)) - # Post.where(user_id: active_users.select(:id)) - # - # @example EnforcedStyle: conservative (default) - # # good - # Post.where(user_id: active_users.pluck(:id)) - # - # @example EnforcedStyle: aggressive - # # bad - # Post.where(user_id: active_users.pluck(:id)) - # - class PluckInWhere < Base - include ActiveRecordHelper - include ConfigurableEnforcedStyle - extend AutoCorrector - - MSG = 'Use `select` instead of `pluck` within `where` query method.' - RESTRICT_ON_SEND = %i[pluck].freeze - - def on_send(node) - return unless in_where?(node) - return if style == :conservative && !root_receiver(node)&.const_type? - - range = node.loc.selector - - add_offense(range) do |corrector| - corrector.replace(range, 'select') - end - end - - private - - def root_receiver(node) - receiver = node.receiver - - if receiver&.send_type? - root_receiver(receiver) - else - receiver - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pluralization_grammar.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pluralization_grammar.rb deleted file mode 100644 index ef62d15c8c80c9..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/pluralization_grammar.rb +++ /dev/null @@ -1,102 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for correct grammar when using ActiveSupport's - # core extensions to the numeric classes. - # - # @example - # # bad - # 3.day.ago - # 1.months.ago - # - # # good - # 3.days.ago - # 1.month.ago - class PluralizationGrammar < Base - extend AutoCorrector - - SINGULAR_DURATION_METHODS = { second: :seconds, - minute: :minutes, - hour: :hours, - day: :days, - week: :weeks, - fortnight: :fortnights, - month: :months, - year: :years }.freeze - - RESTRICT_ON_SEND = SINGULAR_DURATION_METHODS.keys + SINGULAR_DURATION_METHODS.values - - PLURAL_DURATION_METHODS = SINGULAR_DURATION_METHODS.invert.freeze - - MSG = 'Prefer `%s.%s`.' - - def on_send(node) - return unless duration_method?(node.method_name) && literal_number?(node.receiver) && offense?(node) - - number, = *node.receiver - - add_offense(node, message: message(number, node.method_name)) do |corrector| - method_name = node.loc.selector.source - - corrector.replace(node.loc.selector, correct_method(method_name)) - end - end - - private - - def message(number, method_name) - format(MSG, number: number, correct: correct_method(method_name)) - end - - def correct_method(method_name) - if plural_method?(method_name) - singularize(method_name) - else - pluralize(method_name) - end - end - - def offense?(node) - number, = *node.receiver - - (singular_receiver?(number) && plural_method?(node.method_name)) || - (plural_receiver?(number) && singular_method?(node.method_name)) - end - - def plural_method?(method_name) - method_name.to_s.end_with?('s') - end - - def singular_method?(method_name) - !plural_method?(method_name) - end - - def singular_receiver?(number) - number.abs == 1 - end - - def plural_receiver?(number) - !singular_receiver?(number) - end - - def literal_number?(node) - node && (node.int_type? || node.float_type?) - end - - def pluralize(method_name) - SINGULAR_DURATION_METHODS.fetch(method_name.to_sym).to_s - end - - def singularize(method_name) - PLURAL_DURATION_METHODS.fetch(method_name.to_sym).to_s - end - - def duration_method?(method_name) - SINGULAR_DURATION_METHODS.key?(method_name) || PLURAL_DURATION_METHODS.key?(method_name) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/presence.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/presence.rb deleted file mode 100644 index 49dbfe09ac9271..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/presence.rb +++ /dev/null @@ -1,152 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks code that can be written more easily using - # `Object#presence` defined by Active Support. - # - # @example - # # bad - # a.present? ? a : nil - # - # # bad - # !a.present? ? nil : a - # - # # bad - # a.blank? ? nil : a - # - # # bad - # !a.blank? ? a : nil - # - # # good - # a.presence - # - # @example - # # bad - # a.present? ? a : b - # - # # bad - # !a.present? ? b : a - # - # # bad - # a.blank? ? b : a - # - # # bad - # !a.blank? ? a : b - # - # # good - # a.presence || b - class Presence < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s`.' - - def_node_matcher :redundant_receiver_and_other, <<~PATTERN - { - (if - (send $_recv :present?) - _recv - $!begin - ) - (if - (send $_recv :blank?) - $!begin - _recv - ) - } - PATTERN - - def_node_matcher :redundant_negative_receiver_and_other, <<~PATTERN - { - (if - (send (send $_recv :present?) :!) - $!begin - _recv - ) - (if - (send (send $_recv :blank?) :!) - _recv - $!begin - ) - } - PATTERN - - def on_if(node) - return if ignore_if_node?(node) - - redundant_receiver_and_other(node) do |receiver, other| - return if ignore_other_node?(other) || receiver.nil? - - register_offense(node, receiver, other) - end - - redundant_negative_receiver_and_other(node) do |receiver, other| - return if ignore_other_node?(other) || receiver.nil? - - register_offense(node, receiver, other) - end - end - - private - - def register_offense(node, receiver, other) - add_offense(node, message: message(node, receiver, other)) do |corrector| - corrector.replace(node, replacement(receiver, other, node.left_sibling)) - end - end - - def ignore_if_node?(node) - node.elsif? - end - - def ignore_other_node?(node) - node && (node.if_type? || node.rescue_type? || node.while_type?) - end - - def message(node, receiver, other) - prefer = replacement(receiver, other, node.left_sibling).gsub(/^\s*|\n/, '') - current = current(node).gsub(/^\s*|\n/, '') - format(MSG, prefer: prefer, current: current) - end - - def current(node) - if !node.ternary? && node.source.include?("\n") - "#{node.loc.keyword.with(end_pos: node.condition.loc.selector.end_pos).source} ... end" - else - node.source.gsub(/\n\s*/, ' ') - end - end - - def replacement(receiver, other, left_sibling) - or_source = if other&.send_type? - build_source_for_or_method(other) - elsif other.nil? || other.nil_type? - '' - else - " || #{other.source}" - end - - replaced = "#{receiver.source}.presence#{or_source}" - left_sibling ? "(#{replaced})" : replaced - end - - def build_source_for_or_method(other) - if other.parenthesized? || other.method?('[]') || other.arithmetic_operation? || !other.arguments? - " || #{other.source}" - else - method = method_range(other).source - arguments = other.arguments.map(&:source).join(', ') - - " || #{method}(#{arguments})" - end - end - - def method_range(node) - range_between(node.source_range.begin_pos, node.first_argument.source_range.begin_pos - 1) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/present.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/present.rb deleted file mode 100644 index 1d789cf7bdaba2..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/present.rb +++ /dev/null @@ -1,156 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for code that can be written with simpler conditionals - # using `Object#present?` defined by Active Support. - # - # Interaction with `Style/UnlessElse`: - # The configuration of `NotBlank` will not produce an offense in the - # context of `unless else` if `Style/UnlessElse` is enabled. This is - # to prevent interference between the autocorrection of the two cops. - # - # @example NotNilAndNotEmpty: true (default) - # # Converts usages of `!nil? && !empty?` to `present?` - # - # # bad - # !foo.nil? && !foo.empty? - # - # # bad - # foo != nil && !foo.empty? - # - # # good - # foo.present? - # - # @example NotBlank: true (default) - # # Converts usages of `!blank?` to `present?` - # - # # bad - # !foo.blank? - # - # # bad - # not foo.blank? - # - # # good - # foo.present? - # - # @example UnlessBlank: true (default) - # # Converts usages of `unless blank?` to `if present?` - # - # # bad - # something unless foo.blank? - # - # # good - # something if foo.present? - class Present < Base - extend AutoCorrector - - MSG_NOT_BLANK = 'Use `%s` instead of `%s`.' - MSG_EXISTS_AND_NOT_EMPTY = 'Use `%s` instead of `%s`.' - MSG_UNLESS_BLANK = 'Use `if %s` instead of `%s`.' - RESTRICT_ON_SEND = %i[!].freeze - - def_node_matcher :exists_and_not_empty?, <<~PATTERN - (and - { - (send (send $_ :nil?) :!) - (send (send $_ :!) :!) - (send $_ :!= nil) - $_ - } - { - (send (send $_ :empty?) :!) - } - ) - PATTERN - - def_node_matcher :not_blank?, '(send (send $_ :blank?) :!)' - - def_node_matcher :unless_blank?, <<~PATTERN - (:if $(send $_ :blank?) {nil? (...)} ...) - PATTERN - - def on_send(node) - return unless cop_config['NotBlank'] - - not_blank?(node) do |receiver| - message = format(MSG_NOT_BLANK, prefer: replacement(receiver), current: node.source) - - add_offense(node, message: message) do |corrector| - autocorrect(corrector, node) - end - end - end - - def on_and(node) - return unless cop_config['NotNilAndNotEmpty'] - - exists_and_not_empty?(node) do |var1, var2| - return unless var1 == var2 - - message = format(MSG_EXISTS_AND_NOT_EMPTY, prefer: replacement(var1), current: node.source) - - add_offense(node, message: message) do |corrector| - autocorrect(corrector, node) - end - end - end - - def on_or(node) - return unless cop_config['NilOrEmpty'] - - exists_and_not_empty?(node) do |var1, var2| - return unless var1 == var2 - - add_offense(node, message: MSG_EXISTS_AND_NOT_EMPTY) do |corrector| - autocorrect(corrector, node) - end - end - end - - def on_if(node) - return unless cop_config['UnlessBlank'] - return unless node.unless? - return if node.else? && config.for_cop('Style/UnlessElse')['Enabled'] - - unless_blank?(node) do |method_call, receiver| - range = unless_condition(node, method_call) - msg = format(MSG_UNLESS_BLANK, prefer: replacement(receiver), current: range.source) - add_offense(range, message: msg) do |corrector| - autocorrect(corrector, node) - end - end - end - - def autocorrect(corrector, node) - method_call, variable1 = unless_blank?(node) - - if method_call - corrector.replace(node.loc.keyword, 'if') - range = method_call.source_range - else - variable1, _variable2 = exists_and_not_empty?(node) || not_blank?(node) - range = node.source_range - end - - corrector.replace(range, replacement(variable1)) - end - - private - - def unless_condition(node, method_call) - if node.modifier_form? - node.loc.keyword.join(node.source_range.end) - else - node.source_range.begin.join(method_call.source_range) - end - end - - def replacement(node) - node.respond_to?(:source) ? "#{node.source}.present?" : 'present?' - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/rake_environment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/rake_environment.rb deleted file mode 100644 index 67694b30b7c555..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/rake_environment.rb +++ /dev/null @@ -1,112 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for Rake tasks without the `:environment` task - # dependency. The `:environment` task loads application code for other - # Rake tasks. Without it, tasks cannot make use of application code like - # models. - # - # You can ignore the offense if the task satisfies at least one of the - # following conditions: - # - # * The task does not need application code. - # * The task invokes the `:environment` task. - # - # @safety - # Probably not a problem in most cases, but it is possible that calling `:environment` task - # will break a behavior. It's also slower. E.g. some task that only needs one gem to be - # loaded to run will run significantly faster without loading the whole application. - # - # @example - # # bad - # task :foo do - # do_something - # end - # - # # good - # task foo: :environment do - # do_something - # end - # - class RakeEnvironment < Base - extend AutoCorrector - - MSG = 'Include `:environment` task as a dependency for all Rake tasks.' - - def_node_matcher :task_definition?, <<~PATTERN - (block $(send nil? :task ...) ...) - PATTERN - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - task_definition?(node) do |task_method| - return if task_name(task_method) == :default - return if with_dependencies?(task_method) - - add_offense(task_method) do |corrector| - task_name = task_method.arguments[0] - task_dependency = correct_task_dependency(task_name) - - corrector.replace(task_name, task_dependency) - end - end - end - - private - - def correct_task_dependency(task_name) - if task_name.sym_type? - "#{task_name.source.delete(':|\'|"')}: :environment" - else - "#{task_name.source} => :environment" - end - end - - def task_name(node) - first_arg = node.arguments[0] - case first_arg&.type - when :sym, :str - first_arg.value.to_sym - when :hash - return nil if first_arg.children.size != 1 - - pair = first_arg.children.first - key = pair.children.first - case key.type - when :sym, :str - key.value.to_sym - end - end - end - - def with_dependencies?(node) - first_arg = node.arguments[0] - return false unless first_arg - - if first_arg.hash_type? - with_hash_style_dependencies?(first_arg) - else - task_args = node.arguments[1] - return false unless task_args - return false unless task_args.hash_type? - - with_hash_style_dependencies?(task_args) - end - end - - def with_hash_style_dependencies?(hash_node) - deps = hash_node.pairs.first&.value - return false unless deps - - case deps.type - when :array - !deps.values.empty? - else - true - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/read_write_attribute.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/read_write_attribute.rb deleted file mode 100644 index b3c30aba3aff94..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/read_write_attribute.rb +++ /dev/null @@ -1,112 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for the use of the `read_attribute` or `write_attribute` - # methods and recommends square brackets instead. - # - # If an attribute is missing from the instance (for example, when - # initialized by a partial `select`) then `read_attribute` - # will return nil, but square brackets will raise - # an `ActiveModel::MissingAttributeError`. - # - # Explicitly raising an error in this situation is preferable, and that - # is why rubocop recommends using square brackets. - # - # @example - # - # # bad - # x = read_attribute(:attr) - # write_attribute(:attr, val) - # - # # good - # x = self[:attr] - # self[:attr] = val - # - # When called from within a method with the same name as the attribute, - # `read_attribute` and `write_attribute` must be used to prevent an - # infinite loop: - # - # @example - # - # # good - # def foo - # bar || read_attribute(:foo) - # end - class ReadWriteAttribute < Base - extend AutoCorrector - - MSG = 'Prefer `%s`.' - RESTRICT_ON_SEND = %i[read_attribute write_attribute].freeze - - def_node_matcher :read_write_attribute?, <<~PATTERN - { - (send nil? :read_attribute _) - (send nil? :write_attribute _ _) - } - PATTERN - - def on_send(node) - return unless read_write_attribute?(node) - return if within_shadowing_method?(node) - - add_offense(node, message: build_message(node)) do |corrector| - corrector.replace(node, node_replacement(node)) - end - end - - private - - def within_shadowing_method?(node) - first_arg = node.first_argument - return false unless first_arg.respond_to?(:value) - - enclosing_method = node.each_ancestor(:def).first - return false unless enclosing_method - - shadowing_method_name = first_arg.value.to_s - shadowing_method_name << '=' if node.method?(:write_attribute) - enclosing_method.method?(shadowing_method_name) - end - - def build_message(node) - if node.single_line? - single_line_message(node) - else - multi_line_message(node) - end - end - - def single_line_message(node) - format(MSG, prefer: node_replacement(node)) - end - - def multi_line_message(node) - if node.method?(:read_attribute) - format(MSG, prefer: 'self[:attr]') - else - format(MSG, prefer: 'self[:attr] = val') - end - end - - def node_replacement(node) - case node.method_name - when :read_attribute - read_attribute_replacement(node) - when :write_attribute - write_attribute_replacement(node) - end - end - - def read_attribute_replacement(node) - "self[#{node.first_argument.source}]" - end - - def write_attribute_replacement(node) - "self[#{node.first_argument.source}] = #{node.last_argument.source}" - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_allow_nil.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_allow_nil.rb deleted file mode 100644 index 07b61b0b05cdad..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_allow_nil.rb +++ /dev/null @@ -1,99 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks Rails model validations for a redundant `allow_nil` when - # `allow_blank` is present. - # - # @example - # # bad - # validates :x, length: { is: 5 }, allow_nil: true, allow_blank: true - # - # # bad - # validates :x, length: { is: 5 }, allow_nil: false, allow_blank: true - # - # # bad - # validates :x, length: { is: 5 }, allow_nil: false, allow_blank: false - # - # # good - # validates :x, length: { is: 5 }, allow_blank: true - # - # # good - # validates :x, length: { is: 5 }, allow_blank: false - # - # # good - # # Here, `nil` is valid but `''` is not - # validates :x, length: { is: 5 }, allow_nil: true, allow_blank: false - # - class RedundantAllowNil < Base - include RangeHelp - extend AutoCorrector - - MSG_SAME = '`allow_nil` is redundant when `allow_blank` has the same value.' - - MSG_ALLOW_NIL_FALSE = '`allow_nil: false` is redundant when `allow_blank` is true.' - - RESTRICT_ON_SEND = %i[validates].freeze - - def on_send(node) - allow_nil, allow_blank = find_allow_nil_and_allow_blank(node) - return unless allow_nil && allow_blank - - allow_nil_val = allow_nil.children.last - allow_blank_val = allow_blank.children.last - - if allow_nil_val.type == allow_blank_val.type - register_offense(allow_nil, MSG_SAME) - elsif allow_nil_val.false_type? && allow_blank_val.true_type? - register_offense(allow_nil, MSG_ALLOW_NIL_FALSE) - end - end - - private - - def register_offense(allow_nil, message) - add_offense(allow_nil, message: message) do |corrector| - prv_sib = allow_nil.left_sibling - nxt_sib = allow_nil.right_sibling - - if nxt_sib - corrector.remove(range_between(node_beg(allow_nil), node_beg(nxt_sib))) - elsif prv_sib - corrector.remove(range_between(node_end(prv_sib), node_end(allow_nil))) - else - corrector.remove(allow_nil) - end - end - end - - def find_allow_nil_and_allow_blank(node) - allow_nil, allow_blank = nil - - node.each_child_node do |child_node| - if child_node.pair_type? - key = child_node.children.first.source - - allow_nil = child_node if key == 'allow_nil' - allow_blank = child_node if key == 'allow_blank' - end - return [allow_nil, allow_blank] if allow_nil && allow_blank - - found_in_children_nodes = find_allow_nil_and_allow_blank(child_node) - return found_in_children_nodes if found_in_children_nodes - end - - nil - end - - def node_beg(node) - node.source_range.begin_pos - end - - def node_end(node) - node.source_range.end_pos - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_foreign_key.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_foreign_key.rb deleted file mode 100644 index 3026fca2948050..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_foreign_key.rb +++ /dev/null @@ -1,77 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Detects cases where the `:foreign_key` option on associations - # is redundant. - # - # @example - # # bad - # class Post - # has_many :comments, foreign_key: 'post_id' - # end - # - # class Comment - # belongs_to :post, foreign_key: 'post_id' - # end - # - # # good - # class Post - # has_many :comments - # end - # - # class Comment - # belongs_to :author, foreign_key: 'user_id' - # end - class RedundantForeignKey < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Specifying the default value for `foreign_key` is redundant.' - RESTRICT_ON_SEND = %i[belongs_to has_one has_many has_and_belongs_to_many].freeze - - def_node_matcher :association_with_foreign_key, <<~PATTERN - (send nil? ${:belongs_to :has_one :has_many :has_and_belongs_to_many} ({sym str} $_) - $(hash <$(pair (sym :foreign_key) ({sym str} $_)) ...>) - ) - PATTERN - - def on_send(node) - association_with_foreign_key(node) do |type, name, options, foreign_key_pair, foreign_key| - if redundant?(node, type, name, options, foreign_key) - add_offense(foreign_key_pair.source_range) do |corrector| - range = range_with_surrounding_space(foreign_key_pair.source_range, side: :left) - range = range_with_surrounding_comma(range, :left) - - corrector.remove(range) - end - end - end - end - - private - - def redundant?(node, association_type, association_name, options, foreign_key) - foreign_key.to_s == default_foreign_key(node, association_type, association_name, options) - end - - def default_foreign_key(node, association_type, association_name, options) - if association_type == :belongs_to - "#{association_name}_id" - elsif (as = find_as_option(options)) - "#{as}_id" - else - node.parent_module_name&.foreign_key - end - end - - def find_as_option(options) - options.pairs.find do |pair| - pair.key.sym_type? && pair.key.value == :as - end&.value&.value - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb deleted file mode 100644 index d8ee2670e7379a..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb +++ /dev/null @@ -1,257 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Since Rails 5.0 the default for `belongs_to` is `optional: false` - # unless `config.active_record.belongs_to_required_by_default` is - # explicitly set to `false`. The presence validator is added - # automatically, and explicit presence validation is redundant. - # - # @safety - # This cop's autocorrection is unsafe because it changes the default error message - # from "can't be blank" to "must exist". - # - # @example - # # bad - # belongs_to :user - # validates :user, presence: true - # - # # bad - # belongs_to :user - # validates :user_id, presence: true - # - # # bad - # belongs_to :author, foreign_key: :user_id - # validates :user_id, presence: true - # - # # good - # belongs_to :user - # - # # good - # belongs_to :author, foreign_key: :user_id - # - class RedundantPresenceValidationOnBelongsTo < Base - include RangeHelp - extend AutoCorrector - extend TargetRailsVersion - - MSG = 'Remove explicit presence validation for %s.' - RESTRICT_ON_SEND = %i[validates].freeze - - minimum_target_rails_version 5.0 - - # @!method presence_validation?(node) - # Match a `validates` statement with a presence check - # - # @example source that matches - by association - # validates :user, presence: true - # - # @example source that matches - by association - # validates :name, :user, presence: true - # - # @example source that matches - by a foreign key - # validates :user_id, presence: true - # - # @example source that DOES NOT match - strict validation - # validates :user_id, presence: true, strict: true - # - # @example source that DOES NOT match - custom strict validation - # validates :user_id, presence: true, strict: MissingUserError - def_node_matcher :presence_validation?, <<~PATTERN - ( - send nil? :validates - (sym $_)+ - $[ - (hash <$(pair (sym :presence) true) ...>) # presence: true - !(hash <$(pair (sym :strict) {true const}) ...>) # strict: true - ] - ) - PATTERN - - # @!method optional?(node) - # Match a `belongs_to` association with an optional option in a hash - def_node_matcher :optional?, <<~PATTERN - (send nil? :belongs_to _ ... #optional_option?) - PATTERN - - # @!method optional_option?(node) - # Match an optional option in a hash - def_node_matcher :optional_option?, <<~PATTERN - { - (hash <(pair (sym :optional) true) ...>) # optional: true - (hash <(pair (sym :required) false) ...>) # required: false - } - PATTERN - - # @!method any_belongs_to?(node, association:) - # Match a class with `belongs_to` with no regard to `foreign_key` option - # - # @example source that matches - # belongs_to :user - # - # @example source that matches - regardless of `foreign_key` - # belongs_to :author, foreign_key: :user_id - # - # @param node [RuboCop::AST::Node] - # @param association [Symbol] - # @return [Array, nil] matching node - def_node_matcher :any_belongs_to?, <<~PATTERN - (begin - < - $(send nil? :belongs_to (sym %association) ...) - ... - > - ) - PATTERN - - # @!method belongs_to?(node, key:, fk:) - # Match a class with a matching association, either by name or an explicit - # `foreign_key` option - # - # @example source that matches - fk matches `foreign_key` option - # belongs_to :author, foreign_key: :user_id - # - # @example source that matches - key matches association name - # belongs_to :user - # - # @example source that does not match - explicit `foreign_key` does not match - # belongs_to :user, foreign_key: :account_id - # - # @param node [RuboCop::AST::Node] - # @param key [Symbol] e.g. `:user` - # @param fk [Symbol] e.g. `:user_id` - # @return [Array] matching nodes - def_node_matcher :belongs_to?, <<~PATTERN - (begin - < - ${ - #belongs_to_without_fk?(%key) # belongs_to :user - #belongs_to_with_a_matching_fk?(%fk) # belongs_to :author, foreign_key: :user_id - } - ... - > - ) - PATTERN - - # @!method belongs_to_without_fk?(node, key) - # Match a matching `belongs_to` association, without an explicit `foreign_key` option - # - # @param node [RuboCop::AST::Node] - # @param key [Symbol] e.g. `:user` - # @return [Array] matching nodes - def_node_matcher :belongs_to_without_fk?, <<~PATTERN - { - (send nil? :belongs_to (sym %1)) # belongs_to :user - (send nil? :belongs_to (sym %1) !hash ...) # belongs_to :user, -> { not_deleted } - (send nil? :belongs_to (sym %1) !(hash <(pair (sym :foreign_key) _) ...>)) - } - PATTERN - - # @!method belongs_to_with_a_matching_fk?(node, fk) - # Match a matching `belongs_to` association with a matching explicit `foreign_key` option - # - # @example source that matches - # belongs_to :author, foreign_key: :user_id - # - # @param node [RuboCop::AST::Node] - # @param fk [Symbol] e.g. `:user_id` - # @return [Array] matching nodes - def_node_matcher :belongs_to_with_a_matching_fk?, <<~PATTERN - (send nil? :belongs_to ... (hash <(pair (sym :foreign_key) (sym %1)) ...>)) - PATTERN - - def on_send(node) - presence_validation?(node) do |all_keys, options, presence| - keys = non_optional_belongs_to(node.parent, all_keys) - return if keys.none? - - add_offense_and_correct(node, all_keys, keys, options, presence) - end - end - - private - - def add_offense_and_correct(node, all_keys, keys, options, presence) - add_offense(presence, message: message_for(keys)) do |corrector| - if options.children.one? # `presence: true` is the only option - if keys == all_keys - remove_validation(corrector, node) - else - remove_keys_from_validation(corrector, node, keys) - end - elsif keys == all_keys - remove_presence_option(corrector, presence) - else - extract_validation_for_keys(corrector, node, keys, options) - end - end - end - - def message_for(keys) - display_keys = keys.map { |key| "`#{key}`" }.join('/') - format(MSG, association: display_keys) - end - - def non_optional_belongs_to(node, keys) - keys.select do |key| - belongs_to = belongs_to_for(node, key) - belongs_to && !optional?(belongs_to) - end - end - - def belongs_to_for(model_class_node, key) - if key.to_s.end_with?('_id') - normalized_key = key.to_s.delete_suffix('_id').to_sym - belongs_to?(model_class_node, key: normalized_key, fk: key) - else - any_belongs_to?(model_class_node, association: key) - end - end - - def remove_validation(corrector, node) - corrector.remove(validation_range(node)) - end - - def remove_keys_from_validation(corrector, node, keys) - keys.each do |key| - key_node = node.arguments.find { |arg| arg.value == key } - key_range = range_with_surrounding_space( - range_with_surrounding_comma(key_node.source_range, :right), - side: :right - ) - corrector.remove(key_range) - end - end - - def remove_presence_option(corrector, presence) - range = range_with_surrounding_comma( - range_with_surrounding_space(presence.source_range, side: :left), - :left - ) - corrector.remove(range) - end - - def extract_validation_for_keys(corrector, node, keys, options) - indentation = ' ' * node.source_range.column - options_without_presence = options.children.reject { |pair| pair.key.value == :presence } - source = [ - indentation, - 'validates ', - keys.map(&:inspect).join(', '), - ', ', - options_without_presence.map(&:source).join(', '), - "\n" - ].join - - remove_keys_from_validation(corrector, node, keys) - corrector.insert_after(validation_range(node), source) - end - - def validation_range(node) - range_by_whole_lines(node.source_range, include_final_newline: true) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb deleted file mode 100644 index ec6699e96dd379..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +++ /dev/null @@ -1,138 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for redundant receiver in `with_options`. - # Receiver is implicit from Rails 4.2 or higher. - # - # @example - # # bad - # class Account < ApplicationRecord - # with_options dependent: :destroy do |assoc| - # assoc.has_many :customers - # assoc.has_many :products - # assoc.has_many :invoices - # assoc.has_many :expenses - # end - # end - # - # # good - # class Account < ApplicationRecord - # with_options dependent: :destroy do - # has_many :customers - # has_many :products - # has_many :invoices - # has_many :expenses - # end - # end - # - # @example - # # bad - # with_options options: false do |merger| - # merger.invoke(merger.something) - # end - # - # # good - # with_options options: false do - # invoke(something) - # end - # - # # good - # client = Client.new - # with_options options: false do |merger| - # client.invoke(merger.something, something) - # end - # - # # ok - # # When `with_options` includes a block, all scoping scenarios - # # cannot be evaluated. Thus, it is ok to include the explicit - # # receiver. - # with_options options: false do |merger| - # merger.invoke - # with_another_method do |another_receiver| - # merger.invoke(another_receiver) - # end - # end - class RedundantReceiverInWithOptions < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Redundant receiver in `with_options`.' - - def_node_search :all_block_nodes_in, <<~PATTERN - (block ...) - PATTERN - - def_node_search :all_send_nodes_in, <<~PATTERN - (send ...) - PATTERN - - def on_block(node) - return unless node.method?(:with_options) - return unless (body = node.body) - return unless all_block_nodes_in(body).count.zero? - - send_nodes = all_send_nodes_in(body) - return unless redundant_receiver?(send_nodes, node) - - send_nodes.each do |send_node| - receiver = send_node.receiver - add_offense(receiver.source_range) do |corrector| - autocorrect(corrector, send_node, node) - end - end - end - - alias on_numblock on_block - - private - - def autocorrect(corrector, send_node, node) - corrector.remove(send_node.receiver) - corrector.remove(send_node.loc.dot) - corrector.remove(block_argument_range(send_node)) unless node.numblock_type? - end - - def redundant_receiver?(send_nodes, node) - proc = if node.numblock_type? - ->(n) { n.receiver.lvar_type? && n.receiver.source == '_1' } - else - return false if node.arguments.empty? - - arg = node.arguments.first - ->(n) { same_value?(arg, n.receiver) } - end - - send_nodes.all?(&proc) - end - - def block_argument_range(node) - block_node = node.each_ancestor(:block).first - block_argument = block_node.children[1].source_range - - range_between( - search_begin_pos_of_space_before_block_argument( - block_argument.begin_pos - ), - block_argument.end_pos - ) - end - - def search_begin_pos_of_space_before_block_argument(begin_pos) - position = begin_pos - 1 - - if processed_source.raw_source[position] == ' ' - search_begin_pos_of_space_before_block_argument(position) - else - begin_pos - end - end - - def same_value?(arg_node, recv_node) - recv_node && recv_node.children[0] == arg_node.children[0] - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_travel_back.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_travel_back.rb deleted file mode 100644 index f26c08677da660..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/redundant_travel_back.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for redundant `travel_back` calls. - # Since Rails 5.2, `travel_back` is automatically called at the end of the test. - # - # @example - # - # # bad - # def teardown - # do_something - # travel_back - # end - # - # # good - # def teardown - # do_something - # end - # - # # bad - # after do - # do_something - # travel_back - # end - # - # # good - # after do - # do_something - # end - # - class RedundantTravelBack < Base - include RangeHelp - extend AutoCorrector - extend TargetRailsVersion - - minimum_target_rails_version 5.2 - - MSG = 'Redundant `travel_back` detected.' - RESTRICT_ON_SEND = %i[travel_back].freeze - - def on_send(node) - return unless node.each_ancestor(:def, :block).any? do |ancestor| - method_name = ancestor.def_type? ? :teardown : :after - - ancestor.method?(method_name) - end - - add_offense(node) do |corrector| - corrector.remove(range_by_whole_lines(node.source_range, include_final_newline: true)) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/reflection_class_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/reflection_class_name.rb deleted file mode 100644 index d0afa1acb6d40c..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/reflection_class_name.rb +++ /dev/null @@ -1,86 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks if the value of the option `class_name`, in - # the definition of a reflection is a string. - # - # @safety - # This cop is unsafe because it cannot be determined whether - # constant or method return value specified to `class_name` is a string. - # - # @example - # # bad - # has_many :accounts, class_name: Account - # has_many :accounts, class_name: Account.name - # - # # good - # has_many :accounts, class_name: 'Account' - class ReflectionClassName < Base - extend AutoCorrector - - MSG = 'Use a string value for `class_name`.' - RESTRICT_ON_SEND = %i[has_many has_one belongs_to].freeze - ALLOWED_REFLECTION_CLASS_TYPES = %i[dstr str sym].freeze - - def_node_matcher :association_with_reflection, <<~PATTERN - (send nil? {:has_many :has_one :belongs_to} _ _ ? - (hash <$#reflection_class_name ...>) - ) - PATTERN - - def_node_matcher :reflection_class_name, <<~PATTERN - (pair (sym :class_name) #reflection_class_value?) - PATTERN - - def_node_matcher :const_or_string, <<~PATTERN - {$(const nil? _) (send $(const nil? _) :name) (send $(const nil? _) :to_s)} - PATTERN - - def on_send(node) - association_with_reflection(node) do |reflection_class_name| - return if reflection_class_name.value.send_type? && reflection_class_name.value.receiver.nil? - return if reflection_class_name.value.lvar_type? && str_assigned?(reflection_class_name) - - add_offense(reflection_class_name.source_range) do |corrector| - autocorrect(corrector, reflection_class_name) - end - end - end - - private - - def str_assigned?(reflection_class_name) - lvar = reflection_class_name.value.source - - reflection_class_name.ancestors.each do |nodes| - return true if nodes.each_child_node(:lvasgn).detect do |node| - lhs, rhs = *node - - lhs.to_s == lvar && ALLOWED_REFLECTION_CLASS_TYPES.include?(rhs.type) - end - end - - false - end - - def reflection_class_value?(class_value) - if class_value.send_type? - !class_value.method?(:to_s) || class_value.receiver&.const_type? - else - !ALLOWED_REFLECTION_CLASS_TYPES.include?(class_value.type) - end - end - - def autocorrect(corrector, class_config) - class_value = class_config.value - replacement = const_or_string(class_value) - return unless replacement.present? - - corrector.replace(class_value, replacement.source.inspect) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/refute_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/refute_methods.rb deleted file mode 100644 index e141b24ea6b8fb..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/refute_methods.rb +++ /dev/null @@ -1,97 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # - # Use `assert_not` methods instead of `refute` methods. - # - # @example EnforcedStyle: assert_not (default) - # # bad - # refute false - # refute_empty [1, 2, 3] - # refute_equal true, false - # - # # good - # assert_not false - # assert_not_empty [1, 2, 3] - # assert_not_equal true, false - # - # @example EnforcedStyle: refute - # # bad - # assert_not false - # assert_not_empty [1, 2, 3] - # assert_not_equal true, false - # - # # good - # refute false - # refute_empty [1, 2, 3] - # refute_equal true, false - # - class RefuteMethods < Base - include ConfigurableEnforcedStyle - extend AutoCorrector - - MSG = 'Prefer `%s` over `%s`.' - - CORRECTIONS = { - refute: :assert_not, - refute_empty: :assert_not_empty, - refute_equal: :assert_not_equal, - refute_in_delta: :assert_not_in_delta, - refute_in_epsilon: :assert_not_in_epsilon, - refute_includes: :assert_not_includes, - refute_instance_of: :assert_not_instance_of, - refute_kind_of: :assert_not_kind_of, - refute_nil: :assert_not_nil, - refute_operator: :assert_not_operator, - refute_predicate: :assert_not_predicate, - refute_respond_to: :assert_not_respond_to, - refute_same: :assert_not_same, - refute_match: :assert_no_match - }.freeze - - REFUTE_METHODS = CORRECTIONS.keys.freeze - ASSERT_NOT_METHODS = CORRECTIONS.values.freeze - - RESTRICT_ON_SEND = REFUTE_METHODS + ASSERT_NOT_METHODS - - def_node_matcher :offensive?, '(send nil? #bad_method? ...)' - - def on_send(node) - return unless offensive?(node) - - method_name = node.method_name - message = offense_message(method_name) - range = node.loc.selector - - add_offense(range, message: message) do |corrector| - corrector.replace(range, convert_good_method(method_name)) - end - end - - private - - def bad_method?(method_name) - if style == :assert_not - REFUTE_METHODS.include?(method_name) - else - ASSERT_NOT_METHODS.include?(method_name) - end - end - - def offense_message(method_name) - format(MSG, bad_method: method_name, good_method: convert_good_method(method_name)) - end - - def convert_good_method(bad_method) - if style == :assert_not - CORRECTIONS.fetch(bad_method) - else - CORRECTIONS.invert.fetch(bad_method) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/relative_date_constant.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/relative_date_constant.rb deleted file mode 100644 index a2fed38e8e5d94..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/relative_date_constant.rb +++ /dev/null @@ -1,112 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks whether constant value isn't relative date. - # Because the relative date will be evaluated only once. - # - # @safety - # This cop's autocorrection is unsafe because its dependence on the constant is not corrected. - # - # @example - # # bad - # class SomeClass - # EXPIRED_AT = 1.week.since - # end - # - # # good - # class SomeClass - # EXPIRES = 1.week - # - # def self.expired_at - # EXPIRES.since - # end - # end - # - # # good - # class SomeClass - # def self.expired_at - # 1.week.since - # end - # end - class RelativeDateConstant < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Do not assign `%s` to constants as it will be evaluated only once.' - RELATIVE_DATE_METHODS = %i[since from_now after ago until before yesterday tomorrow].to_set.freeze - - def on_casgn(node) - nested_relative_date(node) do |method_name| - add_offense(node, message: message(method_name)) do |corrector| - autocorrect(corrector, node) - end - end - end - - def on_masgn(node) - lhs, rhs = *node - - return unless rhs&.array_type? - - lhs.children.zip(rhs.children).each do |(name, value)| - next unless name.casgn_type? - - nested_relative_date(value) do |method_name| - add_offense(offense_range(name, value), message: message(method_name)) do |corrector| - autocorrect(corrector, node) - end - end - end - end - - def on_or_asgn(node) - relative_date_or_assignment(node) do |method_name| - add_offense(node, message: format(MSG, method_name: method_name)) - end - end - - private - - def autocorrect(corrector, node) - return unless node.casgn_type? - - scope, const_name, value = *node - return unless scope.nil? - - indent = ' ' * node.loc.column - new_code = ["def self.#{const_name.downcase}", "#{indent}#{value.source}", 'end'].join("\n#{indent}") - - corrector.replace(node, new_code) - end - - def message(method_name) - format(MSG, method_name: method_name) - end - - def offense_range(name, value) - range_between(name.source_range.begin_pos, value.source_range.end_pos) - end - - def nested_relative_date(node, &callback) - return if node.nil? || node.block_type? - - node.each_child_node do |child| - nested_relative_date(child, &callback) - end - - relative_date(node, &callback) - end - - def_node_matcher :relative_date_or_assignment, <<~PATTERN - (:or_asgn (casgn _ _) (send _ $RELATIVE_DATE_METHODS)) - PATTERN - - def_node_matcher :relative_date, <<~PATTERN - (send _ $RELATIVE_DATE_METHODS) - PATTERN - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/render_inline.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/render_inline.rb deleted file mode 100644 index 6d7db676c25909..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/render_inline.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Looks for inline rendering within controller actions. - # - # @example - # # bad - # class ProductsController < ApplicationController - # def index - # render inline: "<% products.each do |p| %>

    <%= p.name %>

    <% end %>", type: :erb - # end - # end - # - # # good - # # app/views/products/index.html.erb - # # <% products.each do |p| %> - # #

    <%= p.name %>

    - # # <% end %> - # - # class ProductsController < ApplicationController - # def index - # end - # end - # - class RenderInline < Base - MSG = 'Prefer using a template over inline rendering.' - RESTRICT_ON_SEND = %i[render].freeze - - def_node_matcher :render_with_inline_option?, <<~PATTERN - (send nil? :render (hash <(pair {(sym :inline) (str "inline")} _) ...>)) - PATTERN - - def on_send(node) - add_offense(node) if render_with_inline_option?(node) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/render_plain_text.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/render_plain_text.rb deleted file mode 100644 index 0736bb3c28246a..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/render_plain_text.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Identifies places where `render text:` can be - # replaced with `render plain:`. - # - # @example - # # bad - explicit MIME type to `text/plain` - # render text: 'Ruby!', content_type: 'text/plain' - # - # # good - short and precise - # render plain: 'Ruby!' - # - # # good - explicit MIME type not to `text/plain` - # render text: 'Ruby!', content_type: 'text/html' - # - # @example ContentTypeCompatibility: true (default) - # # good - sets MIME type to `text/html` - # render text: 'Ruby!' - # - # @example ContentTypeCompatibility: false - # # bad - sets MIME type to `text/html` - # render text: 'Ruby!' - # - class RenderPlainText < Base - extend AutoCorrector - - MSG = 'Prefer `render plain:` over `render text:`.' - RESTRICT_ON_SEND = %i[render].freeze - - def_node_matcher :render_plain_text?, <<~PATTERN - (send nil? :render $(hash <$(pair (sym :text) $_) ...>)) - PATTERN - - def on_send(node) - render_plain_text?(node) do |options_node, option_node, option_value| - content_type_node = find_content_type(options_node) - return unless compatible_content_type?(content_type_node) - - add_offense(node) do |corrector| - rest_options = options_node.pairs - [option_node, content_type_node].compact - - corrector.replace(node, replacement(rest_options, option_value)) - end - end - end - - private - - def find_content_type(node) - node.pairs.find { |p| p.key.value.to_sym == :content_type } - end - - def compatible_content_type?(node) - (node && node.value.value == 'text/plain') || - (!node && !cop_config['ContentTypeCompatibility']) - end - - def replacement(rest_options, option_value) - if rest_options.any? - "render plain: #{option_value.source}, #{rest_options.map(&:source).join(', ')}" - else - "render plain: #{option_value.source}" - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/request_referer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/request_referer.rb deleted file mode 100644 index 38a68d80996a24..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/request_referer.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for consistent uses of `request.referer` or - # `request.referrer`, depending on the cop's configuration. - # - # @example EnforcedStyle: referer (default) - # # bad - # request.referrer - # - # # good - # request.referer - # - # @example EnforcedStyle: referrer - # # bad - # request.referer - # - # # good - # request.referrer - class RequestReferer < Base - include ConfigurableEnforcedStyle - extend AutoCorrector - - MSG = 'Use `request.%s` instead of `request.%s`.' - RESTRICT_ON_SEND = %i[referer referrer].freeze - - def_node_matcher :referer?, <<~PATTERN - (send (send nil? :request) {:referer :referrer}) - PATTERN - - def on_send(node) - referer?(node) do - return unless node.method?(wrong_method_name) - - add_offense(node.source_range) do |corrector| - corrector.replace(node, "request.#{style}") - end - end - end - - private - - def message(_range) - format(MSG, prefer: style, current: wrong_method_name) - end - - def wrong_method_name - style == :referer ? :referrer : :referer - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/require_dependency.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/require_dependency.rb deleted file mode 100644 index 58e60627581f42..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/require_dependency.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for the usage of `require_dependency`. - # - # `require_dependency` is an obsolete method for Rails applications running in Zeitwerk mode. - # In Zeitwerk mode, the semantics should match Ruby's and no need to be defensive with load order, - # just refer to classes and modules normally. - # If the constant name is dynamic, camelize if needed, and constantize. - # - # Applications running in Zeitwerk mode should not use `require_dependency`. - # - # NOTE: This cop is disabled by default. Please enable it if you are using Zeitwerk mode. - # - # @example - # # bad - # require_dependency 'some_lib' - class RequireDependency < Base - extend TargetRailsVersion - - minimum_target_rails_version 6.0 - - MSG = 'Do not use `require_dependency` with Zeitwerk mode.' - RESTRICT_ON_SEND = %i[require_dependency].freeze - - def_node_matcher :require_dependency_call?, <<~PATTERN - (send {nil? (const {nil? cbase} :Kernel)} :require_dependency _) - PATTERN - - def on_send(node) - require_dependency_call?(node) { add_offense(node) } - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/response_parsed_body.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/response_parsed_body.rb deleted file mode 100644 index d80b2ec06bdb1f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/response_parsed_body.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Prefer `response.parsed_body` to `JSON.parse(response.body)`. - # - # @safety - # This cop is unsafe because Content-Type may not be `application/json`. For example, the proprietary - # Content-Type provided by corporate entities such as `application/vnd.github+json` is not supported at - # `response.parsed_body` by default, so you still have to use `JSON.parse(response.body)` there. - # - # @example - # # bad - # JSON.parse(response.body) - # - # # good - # response.parsed_body - class ResponseParsedBody < Base - extend AutoCorrector - extend TargetRailsVersion - - MSG = 'Prefer `response.parsed_body` to `JSON.parse(response.body)`.' - - RESTRICT_ON_SEND = %i[parse].freeze - - minimum_target_rails_version 5.0 - - # @!method json_parse_response_body?(node) - def_node_matcher :json_parse_response_body?, <<~PATTERN - (send - (const {nil? cbase} :JSON) - :parse - (send - (send nil? :response) - :body - ) - ) - PATTERN - - def on_send(node) - return unless json_parse_response_body?(node) - - add_offense(node) do |corrector| - autocorrect(corrector, node) - end - end - - private - - def autocorrect(corrector, node) - corrector.replace(node, 'response.parsed_body') - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/reversible_migration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/reversible_migration.rb deleted file mode 100644 index 3f2ba23f9f5a06..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/reversible_migration.rb +++ /dev/null @@ -1,326 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks whether the change method of the migration file is - # reversible. - # - # @example - # # bad - # def change - # change_table :users do |t| - # t.remove :name - # end - # end - # - # # good - # def change - # change_table :users do |t| - # t.remove :name, :string - # end - # end - # - # # good - # def change - # create_table :users do |t| - # t.string :name - # end - # end - # - # @example - # # drop_table - # - # # bad - # def change - # drop_table :users - # end - # - # # good - # def change - # drop_table :users do |t| - # t.string :name - # end - # end - # - # @example - # # change_column_default - # - # # bad - # def change - # change_column_default(:suppliers, :qualification, 'new') - # end - # - # # good - # def change - # change_column_default(:posts, :state, from: nil, to: "draft") - # end - # - # @example - # # remove_column - # - # # bad - # def change - # remove_column(:suppliers, :qualification) - # end - # - # # good - # def change - # remove_column(:suppliers, :qualification, :string) - # end - # - # @example - # # remove_foreign_key - # - # # bad - # def change - # remove_foreign_key :accounts, column: :owner_id - # end - # - # # good - # def change - # remove_foreign_key :accounts, :branches - # end - # - # # good - # def change - # remove_foreign_key :accounts, to_table: :branches - # end - # - # @example - # # change_table - # - # # bad - # def change - # change_table :users do |t| - # t.remove :name - # t.change_default :authorized, 1 - # t.change :price, :string - # end - # end - # - # # good - # def change - # change_table :users do |t| - # t.string :name - # end - # end - # - # @example - # # remove_columns - # - # # bad - # def change - # remove_columns :users, :name, :email - # end - # - # # good - # def change - # reversible do |dir| - # dir.up do - # remove_columns :users, :name, :email - # end - # - # dir.down do - # add_column :users, :name, :string - # add_column :users, :email, :string - # end - # end - # end - # - # # good (Rails >= 6.1, see https://github.com/rails/rails/pull/36589) - # def change - # remove_columns :users, :name, :email, type: :string - # end - # - # @example - # # remove_index - # - # # bad - # def change - # remove_index :users, name: :index_users_on_email - # end - # - # # good - # def change - # remove_index :users, :email - # end - # - # # good - # def change - # remove_index :users, column: :email - # end - class ReversibleMigration < Base - include MigrationsHelper - - MSG = '%s is not reversible.' - - def_node_matcher :irreversible_schema_statement_call, <<~PATTERN - (send nil? ${:change_column :execute} ...) - PATTERN - - def_node_matcher :drop_table_call, <<~PATTERN - (send nil? :drop_table ...) - PATTERN - - def_node_matcher :remove_column_call, <<~PATTERN - (send nil? :remove_column $...) - PATTERN - - def_node_matcher :remove_foreign_key_call, <<~PATTERN - (send nil? :remove_foreign_key _ $_) - PATTERN - - def_node_matcher :change_table_call, <<~PATTERN - (send nil? :change_table $_ ...) - PATTERN - - def_node_matcher :remove_columns_call, <<~PATTERN - (send nil? :remove_columns ... $_) - PATTERN - - def_node_matcher :remove_index_call, <<~PATTERN - (send nil? :remove_index _ $_) - PATTERN - - def on_send(node) - return unless in_migration?(node) && within_change_method?(node) - return if within_reversible_or_up_only_block?(node) - - check_irreversible_schema_statement_node(node) - check_drop_table_node(node) - check_reversible_hash_node(node) - check_remove_column_node(node) - check_remove_foreign_key_node(node) - check_remove_columns_node(node) - check_remove_index_node(node) - end - - def on_block(node) - return unless in_migration?(node) && within_change_method?(node) - return if within_reversible_or_up_only_block?(node) - return if node.body.nil? - - check_change_table_node(node.send_node, node.body) - end - - alias on_numblock on_block - - private - - def check_irreversible_schema_statement_node(node) - irreversible_schema_statement_call(node) do |method_name| - add_offense(node, message: format(MSG, action: method_name)) - end - end - - def check_drop_table_node(node) - drop_table_call(node) do - unless node.parent.block_type? || node.last_argument.block_pass_type? - add_offense(node, message: format(MSG, action: 'drop_table(without block)')) - end - end - end - - def check_reversible_hash_node(node) - return if reversible_change_table_call?(node) - - add_offense(node, message: format(MSG, action: "#{node.method_name}(without :from and :to)")) - end - - def check_remove_column_node(node) - remove_column_call(node) do |args| - add_offense(node, message: format(MSG, action: 'remove_column(without type)')) if args.to_a.size < 3 - end - end - - def check_remove_foreign_key_node(node) - remove_foreign_key_call(node) do |arg| - if arg.hash_type? && !all_hash_key?(arg, :to_table) - add_offense(node, message: format(MSG, action: 'remove_foreign_key(without table)')) - end - end - end - - def check_change_table_node(node, block) - change_table_call(node) do |arg| - if block.send_type? - check_change_table_offense(arg, block) - else - block.each_child_node(:send) do |child_node| - check_change_table_offense(arg, child_node) - end - end - end - end - - def check_remove_columns_node(node) - remove_columns_call(node) do |args| - unless all_hash_key?(args, :type) && target_rails_version >= 6.1 - action = target_rails_version >= 6.1 ? 'remove_columns(without type)' : 'remove_columns' - - add_offense(node, message: format(MSG, action: action)) - end - end - end - - def check_remove_index_node(node) - remove_index_call(node) do |args| - if args.hash_type? && !all_hash_key?(args, :column) - add_offense(node, message: format(MSG, action: 'remove_index(without column)')) - end - end - end - - def check_change_table_offense(receiver, node) - method_name = node.method_name - return if receiver != node.receiver && reversible_change_table_call?(node) - - action = if method_name == :remove - target_rails_version >= 6.1 ? 't.remove (without type)' : 't.remove' - else - "change_table(with #{method_name})" - end - - add_offense(node, message: format(MSG, action: action)) - end - - def reversible_change_table_call?(node) - case node.method_name - when :change - false - when :remove - target_rails_version >= 6.1 && all_hash_key?(node.arguments.last, :type) - when :change_default, :change_column_default, :change_table_comment, - :change_column_comment - all_hash_key?(node.arguments.last, :from, :to) - else - true - end - end - - def within_change_method?(node) - node.each_ancestor(:def).any? do |ancestor| - ancestor.method?(:change) - end - end - - def within_reversible_or_up_only_block?(node) - node.each_ancestor(:block).any? do |ancestor| - (ancestor.block_type? && ancestor.send_node.method?(:reversible)) || ancestor.send_node.method?(:up_only) - end - end - - def all_hash_key?(args, *keys) - return false unless args&.hash_type? - - hash_keys = args.keys.map do |key| - key.children.first.to_sym - end - - (hash_keys & keys).sort == keys - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/reversible_migration_method_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/reversible_migration_method_definition.rb deleted file mode 100644 index fbf2b1d87d9032..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/reversible_migration_method_definition.rb +++ /dev/null @@ -1,66 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks whether the migration implements - # either a `change` method or both an `up` and a `down` - # method. - # - # @example - # # bad - # class SomeMigration < ActiveRecord::Migration[6.0] - # def up - # # up migration - # end - # - # # <----- missing down method - # end - # - # class SomeMigration < ActiveRecord::Migration[6.0] - # # <----- missing up method - # - # def down - # # down migration - # end - # end - # - # # good - # class SomeMigration < ActiveRecord::Migration[6.0] - # def change - # # reversible migration - # end - # end - # - # # good - # class SomeMigration < ActiveRecord::Migration[6.0] - # def up - # # up migration - # end - # - # def down - # # down migration - # end - # end - class ReversibleMigrationMethodDefinition < Base - include MigrationsHelper - - MSG = 'Migrations must contain either a `change` method, or both an `up` and a `down` method.' - - def_node_matcher :change_method?, <<~PATTERN - `(def :change (args) _) - PATTERN - - def_node_matcher :up_and_down_methods?, <<~PATTERN - [`(def :up (args) _) `(def :down (args) _)] - PATTERN - - def on_class(node) - return if !migration_class?(node) || change_method?(node) || up_and_down_methods?(node) - - add_offense(node) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/root_join_chain.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/root_join_chain.rb deleted file mode 100644 index 66a1549e104237..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/root_join_chain.rb +++ /dev/null @@ -1,72 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Use a single `#join` instead of chaining on `Rails.root` or `Rails.public_path`. - # - # @example - # # bad - # Rails.root.join('db').join('schema.rb') - # Rails.root.join('db').join(migrate).join('migration.rb') - # Rails.public_path.join('path').join('file.pdf') - # Rails.public_path.join('path').join(to).join('file.pdf') - # - # # good - # Rails.root.join('db', 'schema.rb') - # Rails.root.join('db', migrate, 'migration.rb') - # Rails.public_path.join('path', 'file.pdf') - # Rails.public_path.join('path', to, 'file.pdf') - # - class RootJoinChain < Base - extend AutoCorrector - include RangeHelp - - MSG = 'Use `%s.join(...)` instead of chaining `#join` calls.' - - RESTRICT_ON_SEND = %i[join].to_set.freeze - - # @!method rails_root?(node) - def_node_matcher :rails_root?, <<~PATTERN - (send (const {nil? cbase} :Rails) {:root :public_path}) - PATTERN - - # @!method join?(node) - def_node_matcher :join?, <<~PATTERN - (send _ :join $...) - PATTERN - - def on_send(node) - evidence(node) do |rails_node, args| - add_offense(node, message: format(MSG, root: rails_node.source)) do |corrector| - range = range_between(rails_node.loc.selector.end_pos, node.source_range.end_pos) - replacement = ".join(#{args.map(&:source).join(', ')})" - - corrector.replace(range, replacement) - end - end - end - - private - - def evidence(node) - # Are we at the *end* of the join chain? - return if join?(node.parent) - # Is there only one join? - return if rails_root?(node.receiver) - - all_args = [] - - while (args = join?(node)) - all_args = args + all_args - node = node.receiver - end - - rails_root?(node) do - yield(node, all_args) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/root_pathname_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/root_pathname_methods.rb deleted file mode 100644 index cc7c87a796cf2c..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/root_pathname_methods.rb +++ /dev/null @@ -1,238 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Use `Rails.root` IO methods instead of passing it to `File`. - # - # `Rails.root` is an instance of `Pathname` - # so we can apply many IO methods directly. - # - # This cop works best when used together with - # `Style/FileRead`, `Style/FileWrite` and `Rails/RootJoinChain`. - # - # @safety - # This cop is unsafe for autocorrection because `Dir`'s `children`, `each_child`, `entries`, and `glob` - # methods return string element, but these methods of `Pathname` return `Pathname` element. - # - # @example - # # bad - # File.open(Rails.root.join('db', 'schema.rb')) - # File.open(Rails.root.join('db', 'schema.rb'), 'w') - # File.read(Rails.root.join('db', 'schema.rb')) - # File.binread(Rails.root.join('db', 'schema.rb')) - # File.write(Rails.root.join('db', 'schema.rb'), content) - # File.binwrite(Rails.root.join('db', 'schema.rb'), content) - # - # # good - # Rails.root.join('db', 'schema.rb').open - # Rails.root.join('db', 'schema.rb').open('w') - # Rails.root.join('db', 'schema.rb').read - # Rails.root.join('db', 'schema.rb').binread - # Rails.root.join('db', 'schema.rb').write(content) - # Rails.root.join('db', 'schema.rb').binwrite(content) - # - class RootPathnameMethods < Base - extend AutoCorrector - include RangeHelp - - MSG = '`%s` is a `Pathname` so you can just append `#%s`.' - - DIR_METHODS = %i[children delete each_child empty? entries exist? glob mkdir open rmdir unlink].to_set.freeze - - FILE_METHODS = %i[ - atime - basename - binread - binwrite - birthtime - blockdev? - chardev? - chmod - chown - ctime - delete - directory? - dirname - empty? - executable? - executable_real? - exist? - expand_path - extname - file? - fnmatch - fnmatch? - ftype - grpowned? - join - lchmod - lchown - lstat - mtime - open - owned? - pipe? - read - readable? - readable_real? - readlines - readlink - realdirpath - realpath - rename - setgid? - setuid? - size - size? - socket? - split - stat - sticky? - symlink? - sysopen - truncate - unlink - utime - world_readable? - world_writable? - writable? - writable_real? - write - zero? - ].to_set.freeze - - FILE_TEST_METHODS = %i[ - blockdev? - chardev? - directory? - empty? - executable? - executable_real? - exist? - file? - grpowned? - owned? - pipe? - readable? - readable_real? - setgid? - setuid? - size - size? - socket? - sticky? - symlink? - world_readable? - world_writable? - writable? - writable_real? - zero? - ].to_set.freeze - - FILE_UTILS_METHODS = %i[chmod chown mkdir mkpath rmdir rmtree].to_set.freeze - - RESTRICT_ON_SEND = (DIR_METHODS + FILE_METHODS + FILE_TEST_METHODS + FILE_UTILS_METHODS).to_set.freeze - - def_node_matcher :pathname_method, <<~PATTERN - { - (send (const {nil? cbase} :Dir) $DIR_METHODS $_ $...) - (send (const {nil? cbase} {:IO :File}) $FILE_METHODS $_ $...) - (send (const {nil? cbase} :FileTest) $FILE_TEST_METHODS $_ $...) - (send (const {nil? cbase} :FileUtils) $FILE_UTILS_METHODS $_ $...) - } - PATTERN - - def_node_matcher :dir_glob?, <<~PATTERN - (send - (const {cbase nil?} :Dir) :glob ...) - PATTERN - - def_node_matcher :rails_root_pathname?, <<~PATTERN - { - $#rails_root? - (send $#rails_root? :join ...) - } - PATTERN - - # @!method rails_root?(node) - def_node_matcher :rails_root?, <<~PATTERN - (send (const {nil? cbase} :Rails) {:root :public_path}) - PATTERN - - def on_send(node) - evidence(node) do |method, path, args, rails_root| - add_offense(node, message: format(MSG, method: method, rails_root: rails_root.source)) do |corrector| - replacement = if dir_glob?(node) - build_path_glob_replacement(path, method) - else - build_path_replacement(path, method, args) - end - - corrector.replace(node, replacement) - end - end - end - - private - - def evidence(node) - return if node.method?(:open) && node.parent&.send_type? - return unless (method, path, args = pathname_method(node)) && (rails_root = rails_root_pathname?(path)) - - yield(method, path, args, rails_root) - end - - def build_path_glob_replacement(path, method) - receiver = range_between(path.source_range.begin_pos, path.children.first.loc.selector.end_pos).source - - argument = path.arguments.one? ? path.first_argument.source : join_arguments(path.arguments) - - "#{receiver}.#{method}(#{argument})" - end - - def build_path_replacement(path, method, args) - path_replacement = path.source - if path.arguments? && !path.parenthesized_call? - path_replacement[' '] = '(' - path_replacement << ')' - end - - replacement = "#{path_replacement}.#{method}" - replacement += "(#{args.map(&:source).join(', ')})" unless args.empty? - replacement - end - - def include_interpolation?(arguments) - arguments.any? do |argument| - argument.children.any? { |child| child.respond_to?(:begin_type?) && child.begin_type? } - end - end - - def join_arguments(arguments) - use_interpolation = false - - joined_arguments = arguments.map do |arg| - if arg.respond_to?(:value) - arg.value - else - use_interpolation = true - "\#{#{arg.source}}" - end - end.join('/') - quote = enforce_double_quotes? || include_interpolation?(arguments) || use_interpolation ? '"' : "'" - - "#{quote}#{joined_arguments}#{quote}" - end - - def enforce_double_quotes? - string_literals_config['EnforcedStyle'] == 'double_quotes' - end - - def string_literals_config - config.for_cop('Style/StringLiterals') - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/root_public_path.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/root_public_path.rb deleted file mode 100644 index 78448c6f5996c9..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/root_public_path.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Favor `Rails.public_path` over `Rails.root` with `'public'` - # - # @example - # # bad - # Rails.root.join('public') - # Rails.root.join('public/file.pdf') - # Rails.root.join('public', 'file.pdf') - # - # # good - # Rails.public_path - # Rails.public_path.join('file.pdf') - # Rails.public_path.join('file.pdf') - # - class RootPublicPath < Base - extend AutoCorrector - - MSG = 'Use `Rails.public_path`.' - - RESTRICT_ON_SEND = %i[join].to_set.freeze - - PATTERN = %r{\Apublic(/|\z)}.freeze - - def_node_matcher :rails_root_public, <<~PATTERN - (send - (send - $(const {nil? cbase} :Rails) :root) :join - (str $#public_path?) $...) - PATTERN - - def on_send(node) - return unless (rails, maybe_public_path, other_args = rails_root_public(node)) - - add_offense(node) do |corrector| - first_args = maybe_public_path.gsub(PATTERN, '') - - args = other_args.map(&:source) - args.unshift("'#{first_args}'") unless first_args.empty? - - replacement = "#{rails.source}.public_path" - replacement += ".join(#{args.join(', ')})" unless args.empty? - - corrector.replace(node, replacement) - end - end - - private - - def public_path?(string) - PATTERN.match?(string) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/safe_navigation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/safe_navigation.rb deleted file mode 100644 index 8c6205c71e269f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/safe_navigation.rb +++ /dev/null @@ -1,99 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Converts usages of `try!` to `&.`. It can also be configured - # to convert `try`. It will convert code to use safe navigation - # if the target Ruby version is set to 2.3+ - # - # @example ConvertTry: false (default) - # # bad - # foo.try!(:bar) - # foo.try!(:bar, baz) - # foo.try!(:bar) { |e| e.baz } - # - # foo.try!(:[], 0) - # - # # good - # foo.try(:bar) - # foo.try(:bar, baz) - # foo.try(:bar) { |e| e.baz } - # - # foo&.bar - # foo&.bar(baz) - # foo&.bar { |e| e.baz } - # - # @example ConvertTry: true - # # bad - # foo.try!(:bar) - # foo.try!(:bar, baz) - # foo.try!(:bar) { |e| e.baz } - # foo.try(:bar) - # foo.try(:bar, baz) - # foo.try(:bar) { |e| e.baz } - # - # # good - # foo&.bar - # foo&.bar(baz) - # foo&.bar { |e| e.baz } - class SafeNavigation < Base - include RangeHelp - extend AutoCorrector - extend TargetRubyVersion - - minimum_target_ruby_version 2.3 - - MSG = 'Use safe navigation (`&.`) instead of `%s`.' - RESTRICT_ON_SEND = %i[try try!].freeze - - def_node_matcher :try_call, <<~PATTERN - (send _ ${:try :try!} $_ ...) - PATTERN - - def self.autocorrect_incompatible_with - [Style::RedundantSelf] - end - - def on_send(node) - try_call(node) do |try_method, dispatch| - return if try_method == :try && !cop_config['ConvertTry'] - return unless dispatch.sym_type? && dispatch.value.match?(/\w+[=!?]?/) - - add_offense(node, message: format(MSG, try: try_method)) do |corrector| - autocorrect(corrector, node) - end - end - end - - private - - def autocorrect(corrector, node) - method_node, *params = *node.arguments - method = method_node.source[1..] - - range = if node.receiver - range_between(node.loc.dot.begin_pos, node.source_range.end_pos) - else - corrector.insert_before(node, 'self') - node - end - - corrector.replace(range, replacement(method, params)) - end - - def replacement(method, params) - new_params = params.map(&:source).join(', ') - - if method.end_with?('=') - "&.#{method[0...-1]} = #{new_params}" - elsif params.empty? - "&.#{method}" - else - "&.#{method}(#{new_params})" - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/safe_navigation_with_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/safe_navigation_with_blank.rb deleted file mode 100644 index c19cd8180edac2..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/safe_navigation_with_blank.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks to make sure safe navigation isn't used with `blank?` in - # a conditional. - # - # @safety - # While the safe navigation operator is generally a good idea, when - # checking `foo&.blank?` in a conditional, `foo` being `nil` will actually - # do the opposite of what the author intends. - # - # For example: - # - # [source,ruby] - # ---- - # foo&.blank? #=> nil - # foo.blank? #=> true - # ---- - # - # @example - # # bad - # do_something if foo&.blank? - # do_something unless foo&.blank? - # - # # good - # do_something if foo.blank? - # do_something unless foo.blank? - # - class SafeNavigationWithBlank < Base - extend AutoCorrector - - MSG = 'Avoid calling `blank?` with the safe navigation operator in conditionals.' - - def_node_matcher :safe_navigation_blank_in_conditional?, <<~PATTERN - (if $(csend ... :blank?) ...) - PATTERN - - def on_if(node) - return unless safe_navigation_blank_in_conditional?(node) - - add_offense(node) do |corrector| - corrector.replace(safe_navigation_blank_in_conditional?(node).location.dot, '.') - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/save_bang.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/save_bang.rb deleted file mode 100644 index cd0f6288e7ddb3..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/save_bang.rb +++ /dev/null @@ -1,342 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Identifies possible cases where Active Record save! or related - # should be used instead of save because the model might have failed to - # save and an exception is better than unhandled failure. - # - # This will allow: - # - # * update or save calls, assigned to a variable, - # or used as a condition in an if/unless/case statement. - # * create calls, assigned to a variable that then has a - # call to `persisted?`, or whose return value is checked by - # `persisted?` immediately - # * calls if the result is explicitly returned from methods and blocks, - # or provided as arguments. - # * calls whose signature doesn't look like an ActiveRecord - # persistence method. - # - # By default it will also allow implicit returns from methods and blocks. - # that behavior can be turned off with `AllowImplicitReturn: false`. - # - # You can permit receivers that are giving false positives with - # `AllowedReceivers: []` - # - # @safety - # This cop's autocorrection is unsafe because a custom `update` method call would be changed to `update!`, - # but the method name in the definition would be unchanged. - # - # [source,ruby] - # ---- - # # Original code - # def update_attributes - # end - # - # update_attributes - # - # # After running rubocop --safe-autocorrect - # def update_attributes - # end - # - # update - # ---- - # - # @example - # - # # bad - # user.save - # user.update(name: 'Joe') - # user.find_or_create_by(name: 'Joe') - # user.destroy - # - # # good - # unless user.save - # # ... - # end - # user.save! - # user.update!(name: 'Joe') - # user.find_or_create_by!(name: 'Joe') - # user.destroy! - # - # user = User.find_or_create_by(name: 'Joe') - # unless user.persisted? - # # ... - # end - # - # def save_user - # return user.save - # end - # - # @example AllowImplicitReturn: true (default) - # - # # good - # users.each { |u| u.save } - # - # def save_user - # user.save - # end - # - # @example AllowImplicitReturn: false - # - # # bad - # users.each { |u| u.save } - # def save_user - # user.save - # end - # - # # good - # users.each { |u| u.save! } - # - # def save_user - # user.save! - # end - # - # def save_user - # return user.save - # end - # - # @example AllowedReceivers: ['merchant.customers', 'Service::Mailer'] - # - # # bad - # merchant.create - # customers.builder.save - # Mailer.create - # - # module Service::Mailer - # self.create - # end - # - # # good - # merchant.customers.create - # MerchantService.merchant.customers.destroy - # Service::Mailer.update(message: 'Message') - # ::Service::Mailer.update - # Services::Service::Mailer.update(message: 'Message') - # Service::Mailer::update - # - class SaveBang < Base - include NegativeConditional - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s` if the return value is not checked.' - CREATE_MSG = "#{MSG} Or check `persisted?` on model returned from `%s`." - CREATE_CONDITIONAL_MSG = '`%s` returns a model which is always truthy.' - - CREATE_PERSIST_METHODS = %i[create create_or_find_by first_or_create find_or_create_by].freeze - MODIFY_PERSIST_METHODS = %i[save update update_attributes destroy].freeze - RESTRICT_ON_SEND = (CREATE_PERSIST_METHODS + MODIFY_PERSIST_METHODS).freeze - - def self.joining_forces - VariableForce - end - - def after_leaving_scope(scope, _variable_table) - scope.variables.each_value do |variable| - variable.assignments.each do |assignment| - check_assignment(assignment) - end - end - end - - def check_assignment(assignment) - node = right_assignment_node(assignment) - - return unless node&.send_type? - return unless persist_method?(node, CREATE_PERSIST_METHODS) - return if persisted_referenced?(assignment) - - register_offense(node, CREATE_MSG) - end - - # rubocop:disable Metrics/CyclomaticComplexity - def on_send(node) - return unless persist_method?(node) - return if return_value_assigned?(node) - return if implicit_return?(node) - return if check_used_in_condition_or_compound_boolean(node) - return if argument?(node) - return if explicit_return?(node) - return if checked_immediately?(node) - - register_offense(node, MSG) - end - # rubocop:enable Metrics/CyclomaticComplexity - alias on_csend on_send - - private - - def register_offense(node, msg) - current_method = node.method_name - bang_method = "#{current_method}!" - full_message = format(msg, prefer: bang_method, current: current_method) - - range = node.loc.selector - add_offense(range, message: full_message) do |corrector| - corrector.replace(range, bang_method) - end - end - - def right_assignment_node(assignment) - node = assignment.node.child_nodes.first - - return node unless node&.block_type? - - node.send_node - end - - def persisted_referenced?(assignment) - return unless assignment.referenced? - - assignment.variable.references.any? do |reference| - call_to_persisted?(reference.node.parent) - end - end - - def call_to_persisted?(node) - node.send_type? && node.method?(:persisted?) - end - - def assignable_node(node) - assignable = node.block_node || node - while node - node = hash_parent(node) || array_parent(node) - assignable = node if node - end - assignable - end - - def hash_parent(node) - pair = node.parent - return unless pair&.pair_type? - - hash = pair.parent - return unless hash&.hash_type? - - hash - end - - def array_parent(node) - array = node.parent - return unless array&.array_type? - - array - end - - def check_used_in_condition_or_compound_boolean(node) - return false unless in_condition_or_compound_boolean?(node) - - register_offense(node, CREATE_CONDITIONAL_MSG) unless MODIFY_PERSIST_METHODS.include?(node.method_name) - - true - end - - def in_condition_or_compound_boolean?(node) - node = node.block_node || node - parent = node.parent - return false unless parent - - operator_or_single_negative?(parent) || (conditional?(parent) && node == parent.condition) - end - - def operator_or_single_negative?(node) - node.or_type? || node.and_type? || single_negative?(node) - end - - def conditional?(parent) - parent.if_type? || parent.case_type? - end - - def checked_immediately?(node) - node.parent && call_to_persisted?(node.parent) - end - - def allowed_receiver?(node) - return false unless node.receiver - return true if node.receiver.const_name == 'ENV' - return false unless cop_config['AllowedReceivers'] - - cop_config['AllowedReceivers'].any? do |allowed_receiver| - receiver_chain_matches?(node, allowed_receiver) - end - end - - def receiver_chain_matches?(node, allowed_receiver) - allowed_receiver.split('.').reverse.all? do |receiver_part| - node = node.receiver - return false unless node - - if node.variable? - node.node_parts.first == receiver_part.to_sym - elsif node.send_type? - node.method?(receiver_part.to_sym) - elsif node.const_type? - const_matches?(node.const_name, receiver_part) - end - end - end - - # Const == Const - # ::Const == ::Const - # ::Const == Const - # Const == ::Const - # NameSpace::Const == Const - # NameSpace::Const == NameSpace::Const - # NameSpace::Const != ::Const - # Const != NameSpace::Const - def const_matches?(const, allowed_const) - parts = allowed_const.split('::').reverse.zip(const.split('::').reverse) - parts.all? do |(allowed_part, const_part)| - allowed_part == const_part.to_s - end - end - - def implicit_return?(node) - return false unless cop_config['AllowImplicitReturn'] - - node = assignable_node(node) - method, sibling_index = find_method_with_sibling_index(node.parent) - return unless method && (method.def_type? || method.block_type?) - - method.children.size == node.sibling_index + sibling_index - end - - def find_method_with_sibling_index(node, sibling_index = 1) - return node, sibling_index unless node&.or_type? - - sibling_index += 1 - - find_method_with_sibling_index(node.parent, sibling_index) - end - - def argument?(node) - assignable_node(node).argument? - end - - def explicit_return?(node) - ret = assignable_node(node).parent - ret && (ret.return_type? || ret.next_type?) - end - - def return_value_assigned?(node) - assignment = assignable_node(node).parent - assignment&.lvasgn_type? - end - - def persist_method?(node, methods = RESTRICT_ON_SEND) - methods.include?(node.method_name) && expected_signature?(node) && !allowed_receiver?(node) - end - - # Check argument signature as no arguments or one hash - def expected_signature?(node) - !node.arguments? || - (node.arguments.one? && - node.method_name != :destroy && - (node.first_argument.hash_type? || !node.first_argument.literal?)) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/schema_comment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/schema_comment.rb deleted file mode 100644 index 0e1c23028d16d1..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/schema_comment.rb +++ /dev/null @@ -1,104 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces the use of the `comment` option when adding a new table or column - # to the database during a migration. - # - # @example - # # bad (no comment for a new column or table) - # add_column :table, :column, :integer - # - # create_table :table do |t| - # t.type :column - # end - # - # # good - # add_column :table, :column, :integer, comment: 'Number of offenses' - # - # create_table :table, comment: 'Table of offenses data' do |t| - # t.type :column, comment: 'Number of offenses' - # end - # - class SchemaComment < Base - include ActiveRecordMigrationsHelper - - COLUMN_MSG = 'New database column without `comment`.' - TABLE_MSG = 'New database table without `comment`.' - RESTRICT_ON_SEND = %i[add_column create_table].freeze - CREATE_TABLE_COLUMN_METHODS = Set[ - *( - RAILS_ABSTRACT_SCHEMA_DEFINITIONS | - RAILS_ABSTRACT_SCHEMA_DEFINITIONS_HELPERS | - POSTGRES_SCHEMA_DEFINITIONS | - MYSQL_SCHEMA_DEFINITIONS - ) - ].freeze - - # @!method comment_present?(node) - def_node_matcher :comment_present?, <<~PATTERN - (hash <(pair {(sym :comment) (str "comment")} (_ [present?])) ...>) - PATTERN - - # @!method add_column?(node) - def_node_matcher :add_column?, <<~PATTERN - (send nil? :add_column _table _column _type _?) - PATTERN - - # @!method add_column_with_comment?(node) - def_node_matcher :add_column_with_comment?, <<~PATTERN - (send nil? :add_column _table _column _type #comment_present?) - PATTERN - - # @!method create_table?(node) - def_node_matcher :create_table?, <<~PATTERN - (send nil? :create_table _table _?) - PATTERN - - # @!method create_table?(node) - def_node_matcher :create_table_with_comment?, <<~PATTERN - (send nil? :create_table _table #comment_present? ...) - PATTERN - - # @!method t_column?(node) - def_node_matcher :t_column?, <<~PATTERN - (send _var CREATE_TABLE_COLUMN_METHODS ...) - PATTERN - - # @!method t_column_with_comment?(node) - def_node_matcher :t_column_with_comment?, <<~PATTERN - (send _var CREATE_TABLE_COLUMN_METHODS _column _type? #comment_present?) - PATTERN - - def on_send(node) - if add_column_without_comment?(node) - add_offense(node, message: COLUMN_MSG) - elsif create_table?(node) - if create_table_without_comment?(node) - add_offense(node, message: TABLE_MSG) - elsif create_table_column_call_without_comment?(node) - add_offense(node.parent.body, message: COLUMN_MSG) - end - end - end - - private - - def add_column_without_comment?(node) - add_column?(node) && !add_column_with_comment?(node) - end - - def create_table_without_comment?(node) - create_table?(node) && !create_table_with_comment?(node) - end - - def create_table_column_call_without_comment?(node) - create_table_with_block?(node.parent) && - t_column?(node.parent.body) && - !t_column_with_comment?(node.parent.body) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/scope_args.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/scope_args.rb deleted file mode 100644 index 100007b7b478c8..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/scope_args.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for scope calls where it was passed - # a method (usually a scope) instead of a lambda/proc. - # - # @example - # - # # bad - # scope :something, where(something: true) - # - # # good - # scope :something, -> { where(something: true) } - class ScopeArgs < Base - extend AutoCorrector - - MSG = 'Use `lambda`/`proc` instead of a plain method call.' - RESTRICT_ON_SEND = %i[scope].freeze - - def_node_matcher :scope?, '(send nil? :scope _ $send)' - - def on_send(node) - scope?(node) do |second_arg| - add_offense(second_arg) do |corrector| - corrector.replace(second_arg, "-> { #{second_arg.source} }") - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/short_i18n.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/short_i18n.rb deleted file mode 100644 index dea14b8dd38f49..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/short_i18n.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces that short forms of `I18n` methods are used: - # `t` instead of `translate` and `l` instead of `localize`. - # - # This cop has two different enforcement modes. When the EnforcedStyle - # is conservative (the default) then only `I18n.translate` and `I18n.localize` - # calls are added as offenses. - # - # When the EnforcedStyle is aggressive then all `translate` and `localize` calls - # without a receiver are added as offenses. - # - # @example - # # bad - # I18n.translate :key - # I18n.localize Time.now - # - # # good - # I18n.t :key - # I18n.l Time.now - # - # @example EnforcedStyle: conservative (default) - # # good - # translate :key - # localize Time.now - # t :key - # l Time.now - # - # @example EnforcedStyle: aggressive - # # bad - # translate :key - # localize Time.now - # - # # good - # t :key - # l Time.now - # - class ShortI18n < Base - include ConfigurableEnforcedStyle - extend AutoCorrector - - MSG = 'Use `%s` instead of `%s`.' - - PREFERRED_METHODS = { translate: :t, localize: :l }.freeze - - RESTRICT_ON_SEND = PREFERRED_METHODS.keys.freeze - - def_node_matcher :long_i18n?, <<~PATTERN - (send {nil? (const {nil? cbase} :I18n)} ${:translate :localize} ...) - PATTERN - - def on_send(node) - return if style == :conservative && !node.receiver - - long_i18n?(node) do |method_name| - good_method = PREFERRED_METHODS[method_name] - message = format(MSG, good_method: good_method, bad_method: method_name) - range = node.loc.selector - - add_offense(range, message: message) do |corrector| - corrector.replace(range, PREFERRED_METHODS[method_name]) - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/skips_model_validations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/skips_model_validations.rb deleted file mode 100644 index de92ef30c50c36..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/skips_model_validations.rb +++ /dev/null @@ -1,124 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for the use of methods which skip - # validations which are listed in - # https://guides.rubyonrails.org/active_record_validations.html#skipping-validations - # - # Methods may be ignored from this rule by configuring a `AllowedMethods`. - # - # @example - # # bad - # Article.first.decrement!(:view_count) - # DiscussionBoard.decrement_counter(:post_count, 5) - # Article.first.increment!(:view_count) - # DiscussionBoard.increment_counter(:post_count, 5) - # person.toggle :active - # product.touch - # Billing.update_all("category = 'authorized', author = 'David'") - # user.update_attribute(:website, 'example.com') - # user.update_columns(last_request_at: Time.current) - # Post.update_counters 5, comment_count: -1, action_count: 1 - # - # # good - # user.update(website: 'example.com') - # FileUtils.touch('file') - # - # @example AllowedMethods: ["touch"] - # # bad - # DiscussionBoard.decrement_counter(:post_count, 5) - # DiscussionBoard.increment_counter(:post_count, 5) - # person.toggle :active - # - # # good - # user.touch - # - class SkipsModelValidations < Base - MSG = 'Avoid using `%s` because it skips validations.' - - METHODS_WITH_ARGUMENTS = %w[decrement! - decrement_counter - increment! - increment_counter - insert - insert! - insert_all - insert_all! - toggle! - update_all - update_attribute - update_column - update_columns - update_counters - upsert - upsert_all].freeze - - def_node_matcher :good_touch?, <<~PATTERN - { - (send (const {nil? cbase} :FileUtils) :touch ...) - (send _ :touch {true false}) - } - PATTERN - - def_node_matcher :good_insert?, <<~PATTERN - (send _ {:insert :insert!} _ { - !(hash ...) - (hash <(pair (sym !{:returning :unique_by}) _) ...>) - } ...) - PATTERN - - def on_send(node) - return if allowed_methods.include?(node.method_name.to_s) - return unless forbidden_methods.include?(node.method_name.to_s) - return if allowed_method?(node) - return if good_touch?(node) - return if good_insert?(node) - - add_offense(node.loc.selector, message: message(node)) - end - alias on_csend on_send - - def initialize(*) - super - @displayed_allowed_warning = false - @displayed_forbidden_warning = false - end - - private - - def message(node) - format(MSG, method: node.method_name) - end - - def allowed_method?(node) - METHODS_WITH_ARGUMENTS.include?(node.method_name.to_s) && !node.arguments? - end - - def forbidden_methods - obsolete_result = cop_config['Blacklist'] - if obsolete_result - warn '`Blacklist` has been renamed to `ForbiddenMethods`.' unless @displayed_forbidden_warning - @displayed_forbidden_warning = true - return obsolete_result - end - - cop_config['ForbiddenMethods'] || [] - end - - def allowed_methods - obsolete_result = cop_config['Whitelist'] - if obsolete_result - warn '`Whitelist` has been renamed to `AllowedMethods`.' unless @displayed_allowed_warning - @displayed_allowed_warning = true - - return obsolete_result - end - - cop_config['AllowedMethods'] || [] - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/squished_sql_heredocs.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/squished_sql_heredocs.rb deleted file mode 100644 index 55d2fd5b16f204..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/squished_sql_heredocs.rb +++ /dev/null @@ -1,87 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # - # Checks SQL heredocs to use `.squish`. - # - # @safety - # Some SQL syntax (e.g. PostgreSQL comments and functions) requires newlines - # to be preserved in order to work, thus autocorrection for this cop is not safe. - # - # @example - # # bad - # <<-SQL - # SELECT * FROM posts; - # SQL - # - # <<-SQL - # SELECT * FROM posts - # WHERE id = 1 - # SQL - # - # execute(<<~SQL, "Post Load") - # SELECT * FROM posts - # WHERE post_id = 1 - # SQL - # - # # good - # <<-SQL.squish - # SELECT * FROM posts; - # SQL - # - # <<~SQL.squish - # SELECT * FROM table - # WHERE id = 1 - # SQL - # - # execute(<<~SQL.squish, "Post Load") - # SELECT * FROM posts - # WHERE post_id = 1 - # SQL - # - class SquishedSQLHeredocs < Base - include Heredoc - extend AutoCorrector - - SQL = 'SQL' - SQUISH = '.squish' - MSG = 'Use `%s` instead of `%s`.' - SQL_IDENTIFIER_MARKERS = /(".+?")|('.+?')|(\[.+?\])/.freeze - - def on_heredoc(node) - return unless offense_detected?(node) - - add_offense(node) do |corrector| - corrector.insert_after(node, SQUISH) - end - end - - private - - def offense_detected?(node) - sql_heredoc?(node) && !using_squish?(node) && !singleline_comments_present?(node) - end - - def sql_heredoc?(node) - delimiter_string(node) == SQL - end - - def using_squish?(node) - node.parent&.send_type? && node.parent&.method?(:squish) - end - - def singleline_comments_present?(node) - sql = node.children.map { |c| c.is_a?(String) ? c : c.source }.join('\n') - - sql.gsub(SQL_IDENTIFIER_MARKERS, '').include?('--') - end - - def message(node) - format(MSG, expect: "#{node.source}#{SQUISH}", current: node.source) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/strip_heredoc.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/strip_heredoc.rb deleted file mode 100644 index 201ad0463bb34d..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/strip_heredoc.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces the use of squiggly heredoc over `strip_heredoc`. - # - # @example - # - # # bad - # <) - PATTERN - - def_node_search :change_column_null?, <<~PATTERN - (send nil? :change_column_null {(sym %1) (str %1)} {(sym %2) (str %2)} false) - PATTERN - - def on_send(node) - three_state_boolean?(node) do |column_node, options_node| - options_node = options_node.first - - return if required_options?(options_node) - - def_node = node.each_ancestor(:def, :defs).first - table_node = table_node(node) - if def_node && (table_node.nil? || change_column_null?(def_node, table_node.value, column_node.value)) - return - end - - add_offense(node) - end - end - - private - - def table_node(node) - case node.method_name - when :add_column - node.first_argument - when :column, :boolean - ancestor = node.each_ancestor(:block).find do |n| - n.method?(:create_table) || n.method?(:change_table) - end - ancestor&.send_node&.first_argument - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/time_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/time_zone.rb deleted file mode 100644 index f4f7b5f0f6f67b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/time_zone.rb +++ /dev/null @@ -1,254 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for the use of Time methods without zone. - # - # Built on top of Ruby on Rails style guide (https://rails.rubystyle.guide#time) - # and the article http://danilenko.org/2012/7/6/rails_timezones/ - # - # Two styles are supported for this cop. When `EnforcedStyle` is 'strict' - # then only use of `Time.zone` is allowed. - # - # When EnforcedStyle is 'flexible' then it's also allowed - # to use `Time#in_time_zone`. - # - # @safety - # This cop's autocorrection is unsafe because it may change handling time. - # - # @example - # # bad - # Time.now - # Time.parse('2015-03-02T19:05:37') - # - # # good - # Time.current - # Time.zone.now - # Time.zone.parse('2015-03-02T19:05:37') - # Time.zone.parse('2015-03-02T19:05:37Z') # Respect ISO 8601 format with timezone specifier. - # - # @example EnforcedStyle: flexible (default) - # # `flexible` allows usage of `in_time_zone` instead of `zone`. - # - # # good - # Time.at(timestamp).in_time_zone - # - # @example EnforcedStyle: strict - # # `strict` means that `Time` should be used with `zone`. - # - # # bad - # Time.at(timestamp).in_time_zone - class TimeZone < Base - include ConfigurableEnforcedStyle - extend AutoCorrector - - MSG = 'Do not use `%s` without zone. Use `%s` instead.' - - MSG_ACCEPTABLE = 'Do not use `%s` without zone. Use one of %s instead.' - - MSG_LOCALTIME = 'Do not use `Time.localtime` without offset or zone.' - - GOOD_METHODS = %i[zone zone_default find_zone find_zone!].freeze - - DANGEROUS_METHODS = %i[now local new parse at].freeze - - ACCEPTED_METHODS = %i[in_time_zone utc getlocal xmlschema iso8601 jisx0301 rfc3339 httpdate to_i to_f].freeze - - TIMEZONE_SPECIFIER = /([A-z]|[+-]\d{2}:?\d{2})\z/.freeze - - def on_const(node) - mod, klass = *node - # we should only check core classes - # (`Time` or `::Time`) - return unless (mod.nil? || mod.cbase_type?) && method_send?(node) - - check_time_node(klass, node.parent) if klass == :Time - end - - private - - def autocorrect(corrector, node) - # add `.zone`: `Time.at` => `Time.zone.at` - corrector.insert_after(node.children[0], '.zone') - - case node.method_name - when :current - # replace `Time.zone.current` => `Time.zone.now` - corrector.replace(node.loc.selector, 'now') - when :new - autocorrect_time_new(node, corrector) - end - - # prefer `Time` over `DateTime` class - corrector.replace(node.children.first, 'Time') if strict? - remove_redundant_in_time_zone(corrector, node) - end - - def autocorrect_time_new(node, corrector) - if node.arguments? - corrector.replace(node.loc.selector, 'local') - else - corrector.replace(node.loc.selector, 'now') - end - end - - # remove redundant `.in_time_zone` from `Time.zone.now.in_time_zone` - def remove_redundant_in_time_zone(corrector, node) - time_methods_called = extract_method_chain(node) - return unless time_methods_called.include?(:in_time_zone) || time_methods_called.include?(:zone) - - while node&.send_type? - if node.children.last == :in_time_zone - in_time_zone_with_dot = node.loc.selector.adjust(begin_pos: -1) - corrector.remove(in_time_zone_with_dot) - end - node = node.parent - end - end - - def check_time_node(klass, node) - return if attach_timezone_specifier?(node.first_argument) - - chain = extract_method_chain(node) - return if not_danger_chain?(chain) - return check_localtime(node) if need_check_localtime?(chain) - - method_name = (chain & DANGEROUS_METHODS).join('.') - - return if offset_provided?(node) - - message = build_message(klass, method_name, node) - - add_offense(node.loc.selector, message: message) do |corrector| - autocorrect(corrector, node) - end - end - - def attach_timezone_specifier?(date) - date.respond_to?(:value) && TIMEZONE_SPECIFIER.match?(date.value.to_s) - end - - def build_message(klass, method_name, node) - if flexible? - format( - MSG_ACCEPTABLE, - current: "#{klass}.#{method_name}", - prefer: acceptable_methods(klass, method_name, node).join(', ') - ) - else - safe_method_name = safe_method(method_name, node) - format(MSG, current: "#{klass}.#{method_name}", prefer: "Time.zone.#{safe_method_name}") - end - end - - def extract_method_chain(node) - chain = [] - while !node.nil? && node.send_type? - chain << node.method_name if method_from_time_class?(node) - node = node.parent - end - chain - end - - # Only add the method to the chain if the method being - # called is part of the time class. - def method_from_time_class?(node) - receiver, method_name, *_args = *node - if (receiver.is_a? RuboCop::AST::Node) && !receiver.cbase_type? - method_from_time_class?(receiver) - else - method_name == :Time - end - end - - # checks that parent node of send_type - # and receiver is the given node - def method_send?(node) - return false unless node.parent&.send_type? - - node.parent.receiver == node - end - - def safe_method(method_name, node) - if %w[new current].include?(method_name) - node.arguments? ? 'local' : 'now' - else - method_name - end - end - - def check_localtime(node) - selector_node = node - - while node&.send_type? - break if node.method?(:localtime) - - node = node.parent - end - - return if node.arguments? - - add_offense(selector_node.loc.selector, message: MSG_LOCALTIME) do |corrector| - autocorrect(corrector, selector_node) - end - end - - def not_danger_chain?(chain) - (chain & DANGEROUS_METHODS).empty? || !(chain & good_methods).empty? - end - - def need_check_localtime?(chain) - flexible? && chain.include?(:localtime) - end - - def flexible? - style == :flexible - end - - def strict? - style == :strict - end - - def good_methods - if strict? - GOOD_METHODS - else - GOOD_METHODS + [:current] + ACCEPTED_METHODS - end - end - - def acceptable_methods(klass, method_name, node) - acceptable = ["`Time.zone.#{safe_method(method_name, node)}`", "`#{klass}.current`"] - - ACCEPTED_METHODS.each do |am| - acceptable << "`#{klass}.#{method_name}.#{am}`" - end - - acceptable - end - - # Time.new, Time.at, and Time.now can be called with a time zone offset - # When it is, that should be considered safe - # Example: - # Time.new(1988, 3, 15, 3, 0, 0, "-05:00") - def offset_provided?(node) - case node.method_name - when :new - node.arguments.size == 7 || offset_option_provided?(node) - when :at, :now - offset_option_provided?(node) - end - end - - def offset_option_provided?(node) - options = node.last_argument - options&.hash_type? && - options.each_pair.any? do |pair| - pair.key.sym_type? && pair.key.value == :in && !pair.value.nil_type? - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/time_zone_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/time_zone_assignment.rb deleted file mode 100644 index fe16fa3d22c110..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/time_zone_assignment.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for the use of `Time.zone=` method. - # - # The `zone` attribute persists for the rest of the Ruby runtime, potentially causing - # unexpected behavior at a later time. - # Using `Time.use_zone` ensures the code passed in the block is the only place Time.zone is affected. - # It eliminates the possibility of a `zone` sticking around longer than intended. - # - # @example - # # bad - # Time.zone = 'EST' - # - # # good - # Time.use_zone('EST') do - # end - # - class TimeZoneAssignment < Base - MSG = 'Use `Time.use_zone` with block instead of `Time.zone=`.' - RESTRICT_ON_SEND = %i[zone=].freeze - - def_node_matcher :time_zone_assignment?, <<~PATTERN - (send (const {nil? cbase} :Time) :zone= ...) - PATTERN - - def on_send(node) - return unless time_zone_assignment?(node) - - add_offense(node) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/to_formatted_s.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/to_formatted_s.rb deleted file mode 100644 index fbad7de7872fc7..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/to_formatted_s.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for consistent uses of `to_fs` or `to_formatted_s`, - # depending on the cop's configuration. - # - # @example EnforcedStyle: to_fs (default) - # - # # bad - # time.to_formatted_s(:db) - # - # # good - # time.to_fs(:db) - # - # @example EnforcedStyle: to_formatted_s - # - # # bad - # time.to_fs(:db) - # - # # good - # time.to_formatted_s(:db) - # - class ToFormattedS < Base - include ConfigurableEnforcedStyle - extend AutoCorrector - extend TargetRailsVersion - - minimum_target_rails_version 7.0 - - MSG = 'Use `%s` instead.' - RESTRICT_ON_SEND = %i[to_formatted_s to_fs].freeze - - def on_send(node) - return if node.method?(style) - - add_offense(node.loc.selector, message: format(MSG, prefer: style)) do |corrector| - corrector.replace(node.loc.selector, style) - end - end - alias on_csend on_send - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/to_s_with_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/to_s_with_argument.rb deleted file mode 100644 index d4aefab7d88e45..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/to_s_with_argument.rb +++ /dev/null @@ -1,78 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Identifies passing any argument to `#to_s`. - # - # @safety - # This cop is marked as unsafe because it may detect `#to_s` calls - # that are not related to Active Support implementation. - # - # @example - # - # # bad - # obj.to_s(:delimited) - # - # # good - # obj.to_formatted_s(:delimited) - # - class ToSWithArgument < Base - extend AutoCorrector - extend TargetRailsVersion - - # These types are defined by the following files in ActiveSupport: - # lib/active_support/core_ext/array/conversions.rb - # lib/active_support/core_ext/date/conversions.rb - # lib/active_support/core_ext/date_time/conversions.rb - # lib/active_support/core_ext/numeric/conversions.rb - # lib/active_support/core_ext/range/conversions.rb - # lib/active_support/core_ext/time/conversions.rb - # lib/active_support/time_with_zone.rb - EXTENDED_FORMAT_TYPES = Set.new( - %i[ - currency - db - delimited - human - human_size - inspect - iso8601 - long - long_ordinal - nsec - number - percentage - phone - rfc822 - rounded - short - time - usec - ] - ) - - MSG = 'Use `to_formatted_s` instead.' - - RESTRICT_ON_SEND = %i[to_s].freeze - - minimum_target_rails_version 7.0 - - def on_send(node) - return unless rails_extended_to_s?(node) - - add_offense(node.loc.selector) do |corrector| - corrector.replace(node.loc.selector, 'to_formatted_s') - end - end - alias on_csend on_send - - private - - def rails_extended_to_s?(node) - node.first_argument&.sym_type? && EXTENDED_FORMAT_TYPES.include?(node.first_argument.value) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb deleted file mode 100644 index 4e950e490a8aef..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb +++ /dev/null @@ -1,49 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Identifies top-level `HashWithIndifferentAccess`. - # This has been soft-deprecated since Rails 5.1. - # - # @example - # # bad - # HashWithIndifferentAccess.new(foo: 'bar') - # - # # good - # ActiveSupport::HashWithIndifferentAccess.new(foo: 'bar') - # - class TopLevelHashWithIndifferentAccess < Base - extend AutoCorrector - extend TargetRailsVersion - - minimum_target_rails_version 5.1 - - MSG = 'Avoid top-level `HashWithIndifferentAccess`.' - - # @!method top_level_hash_with_indifferent_access?(node) - # @param [RuboCop::AST::ConstNode] node - # @return [Boolean] - def_node_matcher :top_level_hash_with_indifferent_access?, <<~PATTERN - (const {nil? cbase} :HashWithIndifferentAccess) - PATTERN - - # @param [RuboCop::AST::ConstNode] node - def on_const(node) - return unless top_level_hash_with_indifferent_access?(node) - return if node.parent&.class_type? && node.parent.ancestors.any?(&:module_type?) - - add_offense(node) do |corrector| - autocorrect(corrector, node) - end - end - - private - - def autocorrect(corrector, node) - corrector.insert_before(node.location.name, 'ActiveSupport::') - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/transaction_exit_statement.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/transaction_exit_statement.rb deleted file mode 100644 index d5f22cfb822343..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/transaction_exit_statement.rb +++ /dev/null @@ -1,99 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for the use of exit statements (namely `return`, - # `break` and `throw`) in transactions. This is due to the eventual - # unexpected behavior when using ActiveRecord >= 7, where transactions - # exited using these statements are being rollbacked rather than - # committed (pre ActiveRecord 7 behavior). - # - # As alternatives, it would be more intuitive to explicitly raise an - # error when rollback is desired, and to use `next` when commit is - # desired. - # - # @example - # # bad - # ApplicationRecord.transaction do - # return if user.active? - # end - # - # # bad - # ApplicationRecord.transaction do - # break if user.active? - # end - # - # # bad - # ApplicationRecord.transaction do - # throw if user.active? - # end - # - # # bad, as `with_lock` implicitly opens a transaction too - # user.with_lock do - # throw if user.active? - # end - # - # # good - # ApplicationRecord.transaction do - # # Rollback - # raise "User is active" if user.active? - # end - # - # # good - # ApplicationRecord.transaction do - # # Commit - # next if user.active? - # end - class TransactionExitStatement < Base - MSG = <<~MSG.chomp - Exit statement `%s` is not allowed. Use `raise` (rollback) or `next` (commit). - MSG - - RESTRICT_ON_SEND = %i[transaction with_lock].freeze - - def_node_search :exit_statements, <<~PATTERN - ({return | break | send nil? :throw} ...) - PATTERN - - def_node_matcher :rescue_body_return_node?, <<~PATTERN - (:resbody ... - ... - ({return | break | send nil? :throw} ...) - ... - ) - PATTERN - - def on_send(node) - return unless (parent = node.parent) - return unless parent.block_type? && parent.body - - exit_statements(parent.body).each do |statement_node| - next if statement_node.break_type? && nested_block?(statement_node) - - statement = statement(statement_node) - message = format(MSG, statement: statement) - - add_offense(statement_node, message: message) - end - end - - private - - def statement(statement_node) - if statement_node.return_type? - 'return' - elsif statement_node.break_type? - 'break' - else - statement_node.method_name - end - end - - def nested_block?(statement_node) - !statement_node.ancestors.find(&:block_type?).method?(:transaction) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/uniq_before_pluck.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/uniq_before_pluck.rb deleted file mode 100644 index 91caf5506d3a14..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/uniq_before_pluck.rb +++ /dev/null @@ -1,96 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Prefer using `distinct` before `pluck` instead of `uniq` after `pluck`. - # - # The use of distinct before pluck is preferred because it executes by - # the database. - # - # This cop has two different enforcement modes. When the EnforcedStyle - # is `conservative` (the default), then only calls to `pluck` on a constant - # (i.e. a model class) before `uniq` are added as offenses. - # - # When the EnforcedStyle is `aggressive` then all calls to `pluck` before - # distinct are added as offenses. This may lead to false positives - # as the cop cannot distinguish between calls to `pluck` on an - # ActiveRecord::Relation vs a call to pluck on an - # ActiveRecord::Associations::CollectionProxy. - # - # @safety - # This cop is unsafe for autocorrection because the behavior may change - # depending on the database collation. - # - # @example EnforcedStyle: conservative (default) - # # bad - redundantly fetches duplicate values - # Album.pluck(:band_name).uniq - # - # # good - # Album.distinct.pluck(:band_name) - # - # @example EnforcedStyle: aggressive - # # bad - redundantly fetches duplicate values - # Album.pluck(:band_name).uniq - # - # # bad - redundantly fetches duplicate values - # Album.where(year: 1985).pluck(:band_name).uniq - # - # # bad - redundantly fetches duplicate values - # customer.favourites.pluck(:color).uniq - # - # # good - # Album.distinct.pluck(:band_name) - # Album.distinct.where(year: 1985).pluck(:band_name) - # customer.favourites.distinct.pluck(:color) - # - class UniqBeforePluck < Base - include ConfigurableEnforcedStyle - include RangeHelp - extend AutoCorrector - - MSG = 'Use `distinct` before `pluck`.' - RESTRICT_ON_SEND = %i[uniq].freeze - NEWLINE = "\n" - PATTERN = '[!^block (send (send %s :pluck ...) :uniq ...)]' - - def_node_matcher :conservative_node_match, format(PATTERN, type: 'const') - - def_node_matcher :aggressive_node_match, format(PATTERN, type: '_') - - def on_send(node) - uniq = if style == :conservative - conservative_node_match(node) - else - aggressive_node_match(node) - end - - return unless uniq - - add_offense(node.loc.selector) do |corrector| - method = node.method_name - - corrector.remove(dot_method_with_whitespace(method, node)) - corrector.insert_before(node.receiver.loc.dot.begin, '.distinct') - end - end - - private - - def dot_method_with_whitespace(method, node) - range_between(dot_method_begin_pos(method, node), node.loc.selector.end_pos) - end - - def dot_method_begin_pos(method, node) - lines = node.source.split(NEWLINE) - - if lines.last.strip == ".#{method}" - node.source.rindex(NEWLINE) - else - node.loc.dot.begin_pos - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/unique_validation_without_index.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/unique_validation_without_index.rb deleted file mode 100644 index 4a5d3d1cf00d2f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/unique_validation_without_index.rb +++ /dev/null @@ -1,172 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # When you define a uniqueness validation in Active Record model, - # you also should add a unique index for the column. There are two reasons. - # First, duplicated records may occur even if Active Record's validation - # is defined. - # Second, it will cause slow queries. The validation executes a `SELECT` - # statement with the target column when inserting/updating a record. - # If the column does not have an index and the table is large, - # the query will be heavy. - # - # Note that the cop does nothing if db/schema.rb does not exist. - # - # @example - # # bad - if the schema does not have a unique index - # validates :account, uniqueness: true - # - # # good - if the schema has a unique index - # validates :account, uniqueness: true - # - # # good - even if the schema does not have a unique index - # validates :account, length: { minimum: MIN_LENGTH } - # - class UniqueValidationWithoutIndex < Base - include ActiveRecordHelper - - MSG = 'Uniqueness validation should have a unique index on the database column.' - RESTRICT_ON_SEND = %i[validates].freeze - - def on_send(node) - return unless uniqueness_part(node) - return if condition_part?(node) - return unless schema - - klass, table, names = find_schema_information(node) - return unless names - return if with_index?(klass, table, names) - - add_offense(node) - end - - private - - def find_schema_information(node) - klass = class_node(node) - return unless klass - - table = schema.table_by(name: table_name(klass)) - names = column_names(node) - - [klass, table, names] - end - - def with_index?(klass, table, names) - # Compatibility for Rails 4.2. - add_indices = schema.add_indices_by(table_name: table_name(klass)) - - (table.indices + add_indices).any? do |index| - index.unique && (index.columns.to_set == names || include_column_names_in_expression_index?(index, names)) - end - end - - def include_column_names_in_expression_index?(index, column_names) - return false unless (expression_index = index.expression) - - column_names.all? do |column_name| - expression_index.include?(column_name) - end - end - - def column_names(node) - arg = node.first_argument - return unless arg.str_type? || arg.sym_type? - - ret = [arg.value] - names_from_scope = column_names_from_scope(node) - ret.concat(names_from_scope) if names_from_scope - - ret = ret.flat_map do |name| - klass = class_node(node) - resolve_relation_into_column( - name: name.to_s, - class_node: klass, - table: schema.table_by(name: table_name(klass)) - ) - end - ret.include?(nil) ? nil : ret.to_set - end - - def column_names_from_scope(node) - uniq = uniqueness_part(node) - return unless uniq.hash_type? - - scope = find_scope(uniq) - return unless scope - - scope = unfreeze_scope(scope) - - case scope.type - when :sym, :str - [scope.value] - when :array - array_node_to_array(scope) - end - end - - def find_scope(pairs) - pairs.each_pair.find do |pair| - key = pair.key - next unless key.sym_type? && key.value == :scope - - break pair.value - end - end - - def unfreeze_scope(scope) - scope.send_type? && scope.method?(:freeze) ? scope.children.first : scope - end - - def class_node(node) - node.each_ancestor.find(&:class_type?) - end - - def uniqueness_part(node) - pairs = node.arguments.last - return unless pairs.hash_type? - - pairs.each_pair.find do |pair| - next unless pair.key.sym_type? && pair.key.value == :uniqueness - - break pair.value - end - end - - def condition_part?(node) - pairs = node.arguments.last - return unless pairs.hash_type? - - return true if condition_hash_part?(pairs, keys: %i[if unless]) - - uniqueness_node = uniqueness_part(node) - return unless uniqueness_node&.hash_type? - - condition_hash_part?(uniqueness_node, keys: %i[if unless conditions]) - end - - def condition_hash_part?(pairs, keys:) - pairs.each_pair.any? do |pair| - key = pair.key - next unless key.sym_type? - - keys.include?(key.value) - end - end - - def array_node_to_array(node) - node.values.map do |elm| - case elm.type - when :str, :sym - elm.value - else - return nil - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/unknown_env.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/unknown_env.rb deleted file mode 100644 index c3d8d467ebce36..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/unknown_env.rb +++ /dev/null @@ -1,94 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks that environments called with `Rails.env` predicates - # exist. - # By default the cop allows three environments which Rails ships with: - # `development`, `test`, and `production`. - # More can be added to the `Environments` config parameter. - # - # @example - # # bad - # Rails.env.proudction? - # Rails.env == 'proudction' - # - # # good - # Rails.env.production? - # Rails.env == 'production' - class UnknownEnv < Base - MSG = 'Unknown environment `%s`.' - MSG_SIMILAR = 'Unknown environment `%s`. Did you mean `%s`?' - - def_node_matcher :rails_env?, <<~PATTERN - (send - {(const nil? :Rails) (const (cbase) :Rails)} - :env) - PATTERN - - def_node_matcher :unknown_environment_predicate?, <<~PATTERN - (send #rails_env? $#unknown_env_predicate?) - PATTERN - - def_node_matcher :unknown_environment_equal?, <<~PATTERN - { - (send #rails_env? {:== :===} $(str #unknown_env_name?)) - (send $(str #unknown_env_name?) {:== :===} #rails_env?) - } - PATTERN - - def on_send(node) - unknown_environment_predicate?(node) do |name| - add_offense(node.loc.selector, message: message(name)) - end - - unknown_environment_equal?(node) do |str_node| - name = str_node.value - add_offense(str_node, message: message(name)) - end - end - - private - - def collect_variable_like_names(_scope) - environments - end - - def message(name) - name = name.to_s.chomp('?') - - # DidYouMean::SpellChecker is not available in all versions of Ruby, - # and even on versions where it *is* available (>= 2.3), it is not - # always required correctly. So we do a feature check first. See: - # https://github.com/rubocop/rubocop/issues/7979 - similar_names = if defined?(DidYouMean::SpellChecker) - spell_checker = DidYouMean::SpellChecker.new(dictionary: environments) - spell_checker.correct(name) - else - [] - end - - if similar_names.empty? - format(MSG, name: name) - else - format(MSG_SIMILAR, name: name, similar: similar_names.join(', ')) - end - end - - def unknown_env_predicate?(name) - name = name.to_s - name.end_with?('?') && !environments.include?(name[0..-2]) - end - - def unknown_env_name?(name) - !environments.include?(name) - end - - def environments - cop_config['Environments'] - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/unused_ignored_columns.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/unused_ignored_columns.rb deleted file mode 100644 index c099b97a4dc774..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/unused_ignored_columns.rb +++ /dev/null @@ -1,76 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Suggests you remove a column that does not exist in the schema from `ignored_columns`. - # `ignored_columns` is necessary to drop a column from RDBMS, but you don't need it after the migration - # to drop the column. You avoid forgetting to remove `ignored_columns` by this cop. - # - # @example - # # bad - # class User < ApplicationRecord - # self.ignored_columns = [:already_removed_column] - # end - # - # # good - # class User < ApplicationRecord - # self.ignored_columns = [:still_existing_column] - # end - # - class UnusedIgnoredColumns < Base - include ActiveRecordHelper - - MSG = 'Remove `%s` from `ignored_columns` because the column does not exist.' - RESTRICT_ON_SEND = %i[ignored_columns=].freeze - - def_node_matcher :ignored_columns, <<~PATTERN - (send self :ignored_columns= $array) - PATTERN - - def_node_matcher :appended_ignored_columns, <<~PATTERN - (op-asgn (send self :ignored_columns) :+ $array) - PATTERN - - def_node_matcher :column_name, <<~PATTERN - ({str sym} $_) - PATTERN - - def on_send(node) - return unless (columns = ignored_columns(node) || appended_ignored_columns(node)) - return unless schema - - table = table(node) - return unless table - - columns.children.each do |column_node| - check_column_existence(column_node, table) - end - end - alias on_op_asgn on_send - - private - - def check_column_existence(column_node, table) - column_name = column_name(column_node) - return unless column_name - return if table.with_column?(name: column_name.to_s) - - message = format(MSG, column_name: column_name) - add_offense(column_node, message: message) - end - - def class_node(node) - node.each_ancestor.find(&:class_type?) - end - - def table(node) - klass = class_node(node) - return unless klass - - schema.table_by(name: table_name(klass)) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/validation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/validation.rb deleted file mode 100644 index f250d5d8a4150a..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/validation.rb +++ /dev/null @@ -1,140 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Checks for the use of old-style attribute validation macros. - # - # @example - # # bad - # validates_acceptance_of :foo - # validates_confirmation_of :foo - # validates_exclusion_of :foo - # validates_format_of :foo - # validates_inclusion_of :foo - # validates_length_of :foo - # validates_numericality_of :foo - # validates_presence_of :foo - # validates_absence_of :foo - # validates_size_of :foo - # validates_uniqueness_of :foo - # - # # good - # validates :foo, acceptance: true - # validates :foo, confirmation: true - # validates :foo, exclusion: true - # validates :foo, format: true - # validates :foo, inclusion: true - # validates :foo, length: true - # validates :foo, numericality: true - # validates :foo, presence: true - # validates :foo, absence: true - # validates :foo, size: true - # validates :foo, uniqueness: true - # - class Validation < Base - extend AutoCorrector - - MSG = 'Prefer the new style validations `%s` over `%s`.' - - TYPES = %w[ - acceptance - confirmation - exclusion - format - inclusion - length - numericality - presence - absence - size - uniqueness - ].freeze - - RESTRICT_ON_SEND = TYPES.map { |p| "validates_#{p}_of".to_sym }.freeze - ALLOWLIST = TYPES.map { |p| "validates :column, #{p}: value" }.freeze - - def on_send(node) - return if node.receiver - - range = node.loc.selector - - add_offense(range, message: message(node)) do |corrector| - last_argument = node.arguments.last - return if !last_argument.literal? && !last_argument.splat_type? && !frozen_array_argument?(last_argument) - - corrector.replace(range, 'validates') - correct_validate_type(corrector, node) - end - end - - private - - def message(node) - method_name = node.method_name - - format(MSG, prefer: preferred_method(method_name), current: method_name) - end - - def preferred_method(method) - ALLOWLIST[RESTRICT_ON_SEND.index(method.to_sym)] - end - - def correct_validate_type(corrector, node) - last_argument = node.last_argument - - if last_argument.hash_type? - correct_validate_type_for_hash(corrector, node, last_argument) - elsif last_argument.array_type? - loc = last_argument.loc - - correct_validate_type_for_array(corrector, node, last_argument, loc) - elsif frozen_array_argument?(last_argument) - arguments = node.last_argument.receiver - loc = arguments.parent.loc - - correct_validate_type_for_array(corrector, node, arguments, loc) - else - range = last_argument.source_range - - corrector.insert_after(range, ", #{validate_type(node)}: true") - end - end - - def correct_validate_type_for_hash(corrector, node, arguments) - corrector.replace(arguments, "#{validate_type(node)}: #{braced_options(arguments)}") - end - - def correct_validate_type_for_array(corrector, node, arguments, loc) - attributes = [] - - arguments.each_child_node do |child_node| - attributes << if arguments.percent_literal? - ":#{child_node.source}" - else - child_node.source - end - end - - corrector.replace(loc.expression, "#{attributes.join(', ')}, #{validate_type(node)}: true") - end - - def validate_type(node) - node.method_name.to_s.split('_')[1] - end - - def frozen_array_argument?(argument) - argument.send_type? && argument.method?(:freeze) - end - - def braced_options(options) - if options.braces? - options.source - else - "{ #{options.source} }" - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_equals.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_equals.rb deleted file mode 100644 index db9072d8671274..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_equals.rb +++ /dev/null @@ -1,102 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Identifies places where manually constructed SQL - # in `where` can be replaced with `where(attribute: value)`. - # - # @safety - # This cop's autocorrection is unsafe because is may change SQL. - # See: https://github.com/rubocop/rubocop-rails/issues/403 - # - # @example - # # bad - # User.where('name = ?', 'Gabe') - # User.where('name = :name', name: 'Gabe') - # User.where('name IS NULL') - # User.where('name IN (?)', ['john', 'jane']) - # User.where('name IN (:names)', names: ['john', 'jane']) - # User.where('users.name = :name', name: 'Gabe') - # - # # good - # User.where(name: 'Gabe') - # User.where(name: nil) - # User.where(name: ['john', 'jane']) - # User.where(users: { name: 'Gabe' }) - class WhereEquals < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Use `%s` instead of manually constructing SQL.' - RESTRICT_ON_SEND = %i[where].freeze - - def_node_matcher :where_method_call?, <<~PATTERN - { - (send _ :where (array $str_type? $_ ?)) - (send _ :where $str_type? $_ ?) - } - PATTERN - - def on_send(node) - where_method_call?(node) do |template_node, value_node| - value_node = value_node.first - - range = offense_range(node) - - column_and_value = extract_column_and_value(template_node, value_node) - return unless column_and_value - - good_method = build_good_method(*column_and_value) - message = format(MSG, good_method: good_method) - - add_offense(range, message: message) do |corrector| - corrector.replace(range, good_method) - end - end - end - - EQ_ANONYMOUS_RE = /\A([\w.]+)\s+=\s+\?\z/.freeze # column = ? - IN_ANONYMOUS_RE = /\A([\w.]+)\s+IN\s+\(\?\)\z/i.freeze # column IN (?) - EQ_NAMED_RE = /\A([\w.]+)\s+=\s+:(\w+)\z/.freeze # column = :column - IN_NAMED_RE = /\A([\w.]+)\s+IN\s+\(:(\w+)\)\z/i.freeze # column IN (:column) - IS_NULL_RE = /\A([\w.]+)\s+IS\s+NULL\z/i.freeze # column IS NULL - - private - - def offense_range(node) - range_between(node.loc.selector.begin_pos, node.source_range.end_pos) - end - - def extract_column_and_value(template_node, value_node) - value = - case template_node.value - when EQ_ANONYMOUS_RE, IN_ANONYMOUS_RE - value_node.source - when EQ_NAMED_RE, IN_NAMED_RE - return unless value_node&.hash_type? - - pair = value_node.pairs.find { |p| p.key.value.to_sym == Regexp.last_match(2).to_sym } - pair.value.source - when IS_NULL_RE - 'nil' - else - return - end - - [Regexp.last_match(1), value] - end - - def build_good_method(column, value) - if column.include?('.') - table, column = column.split('.') - - "where(#{table}: { #{column}: #{value} })" - else - "where(#{column}: #{value})" - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_exists.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_exists.rb deleted file mode 100644 index 766988f4ed5df4..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_exists.rb +++ /dev/null @@ -1,138 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Enforces consistent style when using `exists?`. - # - # Two styles are supported for this cop. When EnforcedStyle is 'exists' - # then the cop enforces `exists?(...)` over `where(...).exists?`. - # - # When EnforcedStyle is 'where' then the cop enforces - # `where(...).exists?` over `exists?(...)`. - # - # @safety - # This cop is unsafe for autocorrection because the behavior may change on the following case: - # - # [source,ruby] - # ---- - # Author.includes(:articles).where(articles: {id: id}).exists? - # #=> Perform `eager_load` behavior (`LEFT JOIN` query) and get result. - # - # Author.includes(:articles).exists?(articles: {id: id}) - # #=> Perform `preload` behavior and `ActiveRecord::StatementInvalid` error occurs. - # ---- - # - # @example EnforcedStyle: exists (default) - # # bad - # User.where(name: 'john').exists? - # User.where(['name = ?', 'john']).exists? - # User.where('name = ?', 'john').exists? - # user.posts.where(published: true).exists? - # - # # good - # User.exists?(name: 'john') - # User.where('length(name) > 10').exists? - # user.posts.exists?(published: true) - # - # @example EnforcedStyle: where - # # bad - # User.exists?(name: 'john') - # User.exists?(['name = ?', 'john']) - # User.exists?('name = ?', 'john') - # user.posts.exists?(published: true) - # - # # good - # User.where(name: 'john').exists? - # User.where(['name = ?', 'john']).exists? - # User.where('name = ?', 'john').exists? - # user.posts.where(published: true).exists? - # User.where('length(name) > 10').exists? - class WhereExists < Base - include ConfigurableEnforcedStyle - extend AutoCorrector - - MSG = 'Prefer `%s` over `%s`.' - RESTRICT_ON_SEND = %i[exists?].freeze - - def_node_matcher :where_exists_call?, <<~PATTERN - (send (send _ :where $...) :exists?) - PATTERN - - def_node_matcher :exists_with_args?, <<~PATTERN - (send _ :exists? $...) - PATTERN - - def on_send(node) - find_offenses(node) do |args| - return unless convertable_args?(args) - - range = correction_range(node) - good_method = build_good_method(args) - message = format(MSG, good_method: good_method, bad_method: range.source) - - add_offense(range, message: message) do |corrector| - corrector.replace(range, good_method) - end - end - end - - private - - def where_style? - style == :where - end - - def exists_style? - style == :exists - end - - def find_offenses(node, &block) - if exists_style? - where_exists_call?(node, &block) - elsif where_style? - exists_with_args?(node, &block) - end - end - - def convertable_args?(args) - return false if args.empty? - - args.size > 1 || args[0].hash_type? || args[0].array_type? - end - - def correction_range(node) - if exists_style? - node.receiver.loc.selector.join(node.loc.selector) - elsif where_style? - node.loc.selector.with(end_pos: node.source_range.end_pos) - end - end - - def build_good_method(args) - if exists_style? - build_good_method_exists(args) - elsif where_style? - build_good_method_where(args) - end - end - - def build_good_method_exists(args) - if args.size > 1 - "exists?([#{args.map(&:source).join(', ')}])" - else - "exists?(#{args[0].source})" - end - end - - def build_good_method_where(args) - if args.size > 1 - "where(#{args.map(&:source).join(', ')}).exists?" - else - "where(#{args[0].source}).exists?" - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_missing.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_missing.rb deleted file mode 100644 index 168d2516d1637c..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_missing.rb +++ /dev/null @@ -1,118 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Use `where.missing(...)` to find missing relationship records. - # - # This cop is enabled in Rails 6.1 or higher. - # - # @example - # # bad - # Post.left_joins(:author).where(authors: { id: nil }) - # - # # good - # Post.where.missing(:author) - # - class WhereMissing < Base - include RangeHelp - extend AutoCorrector - extend TargetRailsVersion - - MSG = 'Use `where.missing(:%s)` instead of ' \ - '`%s(:%s).where(%s: { id: nil })`.' - RESTRICT_ON_SEND = %i[left_joins left_outer_joins].freeze - - minimum_target_rails_version 6.1 - - # @!method where_node_and_argument(node) - def_node_search :where_node_and_argument, <<~PATTERN - $(send ... :where (hash <(pair $(sym _) (hash (pair (sym :id) (nil))))...> )) - PATTERN - - # @!method missing_relationship(node) - def_node_search :missing_relationship, <<~PATTERN - (pair (sym _) (hash (pair (sym :id) (nil)))) - PATTERN - - def on_send(node) - return unless node.first_argument.sym_type? - - root_receiver = root_receiver(node) - where_node_and_argument(root_receiver) do |where_node, where_argument| - next unless root_receiver == root_receiver(where_node) - next unless same_relationship?(where_argument, node.first_argument) - - range = range_between(node.loc.selector.begin_pos, node.source_range.end_pos) - register_offense(node, where_node, where_argument, range) - break - end - end - - private - - def root_receiver(node) - parent = node.parent - if !parent&.send_type? || parent.method?(:or) || parent.method?(:and) - node - else - root_receiver(parent) - end - end - - def same_relationship?(where, left_joins) - where.value.to_s.match?(/^#{left_joins.value}s?$/) - end - - def register_offense(node, where_node, where_argument, range) - add_offense(range, message: message(node, where_argument)) do |corrector| - corrector.replace(node.loc.selector, 'where.missing') - if multi_condition?(where_node.first_argument) - replace_where_method(corrector, where_node) - else - remove_where_method(corrector, node, where_node) - end - end - end - - def replace_where_method(corrector, where_node) - missing_relationship(where_node) do |where_clause| - corrector.remove(replace_range(where_clause)) - end - end - - def replace_range(child) - if (right_sibling = child.right_sibling) - range_between(child.source_range.begin_pos, right_sibling.source_range.begin_pos) - else - range_between(child.left_sibling.source_range.end_pos, child.source_range.end_pos) - end - end - - def remove_where_method(corrector, node, where_node) - range = range_between(where_node.loc.selector.begin_pos, where_node.loc.end.end_pos) - if node.multiline? && !same_line?(node, where_node) - range = range_by_whole_lines(range, include_final_newline: true) - else - corrector.remove(where_node.loc.dot) - end - - corrector.remove(range) - end - - def same_line?(left_joins_node, where_node) - left_joins_node.loc.selector.line == where_node.loc.selector.line - end - - def multi_condition?(where_arg) - where_arg.children.count > 1 - end - - def message(node, where_argument) - format(MSG, left_joins_association: node.first_argument.value, left_joins_method: node.method_name, - where_association: where_argument.value) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_not.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_not.rb deleted file mode 100644 index 1e2aab2b65150a..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_not.rb +++ /dev/null @@ -1,101 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Identifies places where manually constructed SQL - # in `where` can be replaced with `where.not(...)`. - # - # @example - # # bad - # User.where('name != ?', 'Gabe') - # User.where('name != :name', name: 'Gabe') - # User.where('name <> ?', 'Gabe') - # User.where('name <> :name', name: 'Gabe') - # User.where('name IS NOT NULL') - # User.where('name NOT IN (?)', ['john', 'jane']) - # User.where('name NOT IN (:names)', names: ['john', 'jane']) - # User.where('users.name != :name', name: 'Gabe') - # - # # good - # User.where.not(name: 'Gabe') - # User.where.not(name: nil) - # User.where.not(name: ['john', 'jane']) - # User.where.not(users: { name: 'Gabe' }) - # - class WhereNot < Base - include RangeHelp - extend AutoCorrector - - MSG = 'Use `%s` instead of manually constructing negated SQL in `where`.' - RESTRICT_ON_SEND = %i[where].freeze - - def_node_matcher :where_method_call?, <<~PATTERN - { - (send _ :where (array $str_type? $_ ?)) - (send _ :where $str_type? $_ ?) - } - PATTERN - - def on_send(node) - where_method_call?(node) do |template_node, value_node| - value_node = value_node.first - - range = offense_range(node) - - column_and_value = extract_column_and_value(template_node, value_node) - return unless column_and_value - - good_method = build_good_method(*column_and_value) - message = format(MSG, good_method: good_method) - - add_offense(range, message: message) do |corrector| - corrector.replace(range, good_method) - end - end - end - - NOT_EQ_ANONYMOUS_RE = /\A([\w.]+)\s+(?:!=|<>)\s+\?\z/.freeze # column != ?, column <> ? - NOT_IN_ANONYMOUS_RE = /\A([\w.]+)\s+NOT\s+IN\s+\(\?\)\z/i.freeze # column NOT IN (?) - NOT_EQ_NAMED_RE = /\A([\w.]+)\s+(?:!=|<>)\s+:(\w+)\z/.freeze # column != :column, column <> :column - NOT_IN_NAMED_RE = /\A([\w.]+)\s+NOT\s+IN\s+\(:(\w+)\)\z/i.freeze # column NOT IN (:column) - IS_NOT_NULL_RE = /\A([\w.]+)\s+IS\s+NOT\s+NULL\z/i.freeze # column IS NOT NULL - - private - - def offense_range(node) - range_between(node.loc.selector.begin_pos, node.source_range.end_pos) - end - - def extract_column_and_value(template_node, value_node) - value = - case template_node.value - when NOT_EQ_ANONYMOUS_RE, NOT_IN_ANONYMOUS_RE - value_node.source - when NOT_EQ_NAMED_RE, NOT_IN_NAMED_RE - return unless value_node.hash_type? - - pair = value_node.pairs.find { |p| p.key.value.to_sym == Regexp.last_match(2).to_sym } - pair.value.source - when IS_NOT_NULL_RE - 'nil' - else - return - end - - [Regexp.last_match(1), value] - end - - def build_good_method(column, value) - if column.include?('.') - table, column = column.split('.') - - "where.not(#{table}: { #{column}: #{value} })" - else - "where.not(#{column}: #{value})" - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb deleted file mode 100644 index 5b0dfb7b23dc0b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Rails - # Identifies calls to `where.not` with multiple hash arguments. - # - # The behavior of `where.not` changed in Rails 6.1. Prior to the change, - # `.where.not(trashed: true, role: 'admin')` evaluated to - # `WHERE trashed != TRUE AND role != 'admin'`. - # From Rails 6.1 onwards, this executes the query - # `WHERE NOT (trashed == TRUE AND roles == 'admin')`. - # - # @example - # # bad - # User.where.not(trashed: true, role: 'admin') - # User.where.not(trashed: true, role: ['moderator', 'admin']) - # User.joins(:posts).where.not(posts: { trashed: true, title: 'Rails' }) - # - # # good - # User.where.not(trashed: true) - # User.where.not(role: ['moderator', 'admin']) - # User.where.not(trashed: true).where.not(role: ['moderator', 'admin']) - # User.where.not('trashed = ? OR role = ?', true, 'admin') - class WhereNotWithMultipleConditions < Base - MSG = 'Use a SQL statement instead of `where.not` with multiple conditions.' - RESTRICT_ON_SEND = %i[not].freeze - - def_node_matcher :where_not_call?, <<~PATTERN - (send (send _ :where) :not $...) - PATTERN - - def on_send(node) - where_not_call?(node) do |args| - next unless args[0]&.hash_type? - next unless multiple_arguments_hash? args[0] - - range = node.receiver.loc.selector.with(end_pos: node.source_range.end_pos) - - add_offense(range) - end - end - - private - - def multiple_arguments_hash?(hash) - return true if hash.pairs.size >= 2 - return false unless hash.values[0]&.hash_type? - - multiple_arguments_hash?(hash.values[0]) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails_cops.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails_cops.rb deleted file mode 100644 index 5e0db983d68082..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/cop/rails_cops.rb +++ /dev/null @@ -1,134 +0,0 @@ -# frozen_string_literal: true - -require_relative 'mixin/active_record_helper' -require_relative 'mixin/active_record_migrations_helper' -require_relative 'mixin/class_send_node_helper' -require_relative 'mixin/enforce_superclass' -require_relative 'mixin/index_method' -require_relative 'mixin/migrations_helper' -require_relative 'mixin/target_rails_version' - -require_relative 'rails/action_controller_flash_before_render' -require_relative 'rails/action_controller_test_case' -require_relative 'rails/action_filter' -require_relative 'rails/action_order' -require_relative 'rails/active_record_aliases' -require_relative 'rails/active_record_callbacks_order' -require_relative 'rails/active_record_override' -require_relative 'rails/active_support_aliases' -require_relative 'rails/active_support_on_load' -require_relative 'rails/add_column_index' -require_relative 'rails/after_commit_override' -require_relative 'rails/application_controller' -require_relative 'rails/application_job' -require_relative 'rails/application_mailer' -require_relative 'rails/application_record' -require_relative 'rails/arel_star' -require_relative 'rails/assert_not' -require_relative 'rails/attribute_default_block_value' -require_relative 'rails/belongs_to' -require_relative 'rails/blank' -require_relative 'rails/bulk_change_table' -require_relative 'rails/compact_blank' -require_relative 'rails/content_tag' -require_relative 'rails/create_table_with_timestamps' -require_relative 'rails/date' -require_relative 'rails/default_scope' -require_relative 'rails/delegate' -require_relative 'rails/delegate_allow_blank' -require_relative 'rails/deprecated_active_model_errors_methods' -require_relative 'rails/dot_separated_keys' -require_relative 'rails/duplicate_association' -require_relative 'rails/duplicate_scope' -require_relative 'rails/duration_arithmetic' -require_relative 'rails/dynamic_find_by' -require_relative 'rails/eager_evaluation_log_message' -require_relative 'rails/enum_hash' -require_relative 'rails/enum_uniqueness' -require_relative 'rails/environment_comparison' -require_relative 'rails/environment_variable_access' -require_relative 'rails/exit' -require_relative 'rails/expanded_date_range' -require_relative 'rails/file_path' -require_relative 'rails/find_by' -require_relative 'rails/find_by_id' -require_relative 'rails/find_each' -require_relative 'rails/freeze_time' -require_relative 'rails/has_and_belongs_to_many' -require_relative 'rails/has_many_or_has_one_dependent' -require_relative 'rails/helper_instance_variable' -require_relative 'rails/http_positional_arguments' -require_relative 'rails/http_status' -require_relative 'rails/i18n_lazy_lookup' -require_relative 'rails/i18n_locale_assignment' -require_relative 'rails/i18n_locale_texts' -require_relative 'rails/ignored_columns_assignment' -require_relative 'rails/ignored_skip_action_filter_option' -require_relative 'rails/index_by' -require_relative 'rails/index_with' -require_relative 'rails/inquiry' -require_relative 'rails/inverse_of' -require_relative 'rails/lexically_scoped_action_filter' -require_relative 'rails/link_to_blank' -require_relative 'rails/mailer_name' -require_relative 'rails/match_route' -require_relative 'rails/migration_class_name' -require_relative 'rails/negate_include' -require_relative 'rails/not_null_column' -require_relative 'rails/order_by_id' -require_relative 'rails/output' -require_relative 'rails/output_safety' -require_relative 'rails/pick' -require_relative 'rails/pluck' -require_relative 'rails/pluck_id' -require_relative 'rails/pluck_in_where' -require_relative 'rails/pluralization_grammar' -require_relative 'rails/presence' -require_relative 'rails/present' -require_relative 'rails/rake_environment' -require_relative 'rails/read_write_attribute' -require_relative 'rails/redundant_allow_nil' -require_relative 'rails/redundant_foreign_key' -require_relative 'rails/redundant_presence_validation_on_belongs_to' -require_relative 'rails/redundant_receiver_in_with_options' -require_relative 'rails/redundant_travel_back' -require_relative 'rails/reflection_class_name' -require_relative 'rails/refute_methods' -require_relative 'rails/relative_date_constant' -require_relative 'rails/render_inline' -require_relative 'rails/render_plain_text' -require_relative 'rails/request_referer' -require_relative 'rails/require_dependency' -require_relative 'rails/response_parsed_body' -require_relative 'rails/reversible_migration' -require_relative 'rails/reversible_migration_method_definition' -require_relative 'rails/root_join_chain' -require_relative 'rails/root_pathname_methods' -require_relative 'rails/root_public_path' -require_relative 'rails/safe_navigation' -require_relative 'rails/safe_navigation_with_blank' -require_relative 'rails/save_bang' -require_relative 'rails/schema_comment' -require_relative 'rails/scope_args' -require_relative 'rails/short_i18n' -require_relative 'rails/skips_model_validations' -require_relative 'rails/squished_sql_heredocs' -require_relative 'rails/strip_heredoc' -require_relative 'rails/table_name_assignment' -require_relative 'rails/three_state_boolean_column' -require_relative 'rails/time_zone' -require_relative 'rails/time_zone_assignment' -require_relative 'rails/to_formatted_s' -require_relative 'rails/to_s_with_argument' -require_relative 'rails/top_level_hash_with_indifferent_access' -require_relative 'rails/transaction_exit_statement' -require_relative 'rails/uniq_before_pluck' -require_relative 'rails/unique_validation_without_index' -require_relative 'rails/unknown_env' -require_relative 'rails/unused_ignored_columns' -require_relative 'rails/validation' -require_relative 'rails/where_equals' -require_relative 'rails/where_exists' -require_relative 'rails/where_missing' -require_relative 'rails/where_not' -require_relative 'rails/where_not_with_multiple_conditions' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails.rb deleted file mode 100644 index 3a7f79350a46ba..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - # RuboCop Rails project namespace - module Rails - PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze - CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze - CONFIG = YAML.safe_load(CONFIG_DEFAULT.read, permitted_classes: [Regexp, Symbol]).freeze - - private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT) - - ::RuboCop::ConfigObsoletion.files << PROJECT_ROOT.join('config', 'obsoletion.yml') - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails/inject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails/inject.rb deleted file mode 100644 index da7ead5ea2e734..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails/inject.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Rails - # Because RuboCop doesn't yet support plugins, we have to monkey patch in a - # bit of our configuration. - module Inject - def self.defaults! - path = CONFIG_DEFAULT.to_s - hash = ConfigLoader.send(:load_yaml_configuration, path) - config = Config.new(hash, path).tap(&:make_excludes_absolute) - puts "configuration from #{path}" if ConfigLoader.debug? - config = ConfigLoader.merge_with_default(config, path, unset_nil: false) - ConfigLoader.instance_variable_set(:@default_configuration, config) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails/schema_loader.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails/schema_loader.rb deleted file mode 100644 index 86041d69310b59..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails/schema_loader.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Rails - # It loads db/schema.rb and return Schema object. - # Cops refers database schema information with this module. - module SchemaLoader - extend self - - # It parses `db/schema.rb` and return it. - # It returns `nil` if it can't find `db/schema.rb`. - # So a cop that uses the loader should handle `nil` properly. - # - # @return [Schema, nil] - def load(target_ruby_version) - return @load if defined?(@load) - - @load = load!(target_ruby_version) - end - - def reset! - return unless instance_variable_defined?(:@load) - - remove_instance_variable(:@load) - end - - def db_schema_path - path = Pathname.pwd - until path.root? - schema_path = path.join('db/schema.rb') - return schema_path if schema_path.exist? - - path = path.join('../').cleanpath - end - - nil - end - - private - - def load!(target_ruby_version) - path = db_schema_path - return unless path - - ast = parse(path, target_ruby_version) - Schema.new(ast) - end - - def parse(path, target_ruby_version) - klass_name = :"Ruby#{target_ruby_version.to_s.sub('.', '')}" - klass = ::Parser.const_get(klass_name) - parser = klass.new(RuboCop::AST::Builder.new) - - buffer = Parser::Source::Buffer.new(path, 1) - buffer.source = path.read - - parser.parse(buffer) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails/schema_loader/schema.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails/schema_loader/schema.rb deleted file mode 100644 index 60a77213663afb..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails/schema_loader/schema.rb +++ /dev/null @@ -1,191 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Rails - module SchemaLoader - # Represent db/schema.rb - class Schema - attr_reader :tables, :add_indices - - def initialize(ast) - @tables = [] - @add_indices = [] - - build!(ast) - end - - def table_by(name:) - tables.find do |table| - table.name == name - end - end - - def add_indices_by(table_name:) - add_indices.select do |add_index| - add_index.table_name == table_name - end - end - - private - - def build!(ast) - raise "Unexpected type: #{ast.type}" unless ast.block_type? - - each_table(ast) do |table_def| - next unless table_def.method?(:create_table) - - @tables << Table.new(table_def) - end - - # Compatibility for Rails 4.2. - each_add_index(ast) do |add_index_def| - @add_indices << AddIndex.new(add_index_def) - end - end - - def each_table(ast) - case ast.body.type - when :begin - ast.body.children.each do |node| - next unless node.block_type? && node.method?(:create_table) - - yield(node) - end - else - yield ast.body - end - end - - def each_add_index(ast) - ast.body.children.each do |node| - next unless node.respond_to?(:send_type?) - next if !node&.send_type? || !node.method?(:add_index) - - yield(node) - end - end - end - - # Represent a table - class Table - attr_reader :name, :columns, :indices - - def initialize(node) - @name = node.send_node.first_argument.value - @columns = build_columns(node) - @indices = build_indices(node) - end - - def with_column?(name:) - @columns.any? { |c| c.name == name } - end - - private - - def build_columns(node) - each_content(node).map do |child| - next unless child&.send_type? - next if child.method?(:index) - - Column.new(child) - end.compact - end - - def build_indices(node) - each_content(node).map do |child| - next unless child&.send_type? - next unless child.method?(:index) - - Index.new(child) - end.compact - end - - def each_content(node, &block) - return enum_for(__method__, node) unless block - - case node.body&.type - when :begin - node.body.children.each(&block) - else - yield(node.body) - end - end - end - - # Represent a column - class Column - attr_reader :name, :type, :not_null - - def initialize(node) - @name = node.first_argument.str_content - @type = node.method_name - @not_null = nil - - analyze_keywords!(node) - end - - private - - def analyze_keywords!(node) - pairs = node.arguments.last - return unless pairs.hash_type? - - pairs.each_pair do |k, v| - @not_null = !v.true_type? if k.value == :null - end - end - end - - # Represent an index - class Index - attr_reader :name, :columns, :expression, :unique - - def initialize(node) - @columns, @expression = build_columns_or_expr(node.first_argument) - @unique = nil - - analyze_keywords!(node) - end - - private - - def build_columns_or_expr(columns) - if columns.array_type? - [columns.values.map(&:value), nil] - else - [[], columns.value] - end - end - - def analyze_keywords!(node) - pairs = node.arguments.last - return unless pairs.hash_type? - - pairs.each_pair do |k, v| - case k.value - when :name - @name = v.value - when :unique - @unique = true - end - end - end - end - - # Represent an `add_index` - class AddIndex < Index - attr_reader :table_name - - def initialize(node) - super(node) - - @table_name = node.first_argument.value - @columns, @expression = build_columns_or_expr(node.arguments[1]) - @unique = nil - - analyze_keywords!(node) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails/version.rb deleted file mode 100644 index c2ea8c7a714432..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.1/lib/rubocop/rails/version.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Rails - # This module holds the RuboCop Rails version information. - module Version - STRING = '2.19.1' - - def self.document_version - STRING.match('\d+\.\d+').to_s - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/config/default.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/config/default.yml deleted file mode 100644 index 942273bc9c55a1..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/config/default.yml +++ /dev/null @@ -1,1103 +0,0 @@ ---- -RSpec: - Enabled: true - StyleGuideBaseURL: https://rspec.rubystyle.guide - DocumentationBaseURL: https://docs.rubocop.org/rubocop-rspec - Include: &1 - - "**/*_spec.rb" - - "**/spec/**/*" - Language: &2 - inherit_mode: - merge: - - Expectations - - Helpers - - Hooks - - Subjects - ExampleGroups: - inherit_mode: - merge: - - Regular - - Skipped - - Focused - Regular: - - describe - - context - - feature - - example_group - Skipped: - - xdescribe - - xcontext - - xfeature - Focused: - - fdescribe - - fcontext - - ffeature - Examples: - inherit_mode: - merge: - - Regular - - Skipped - - Focused - - Pending - Regular: - - it - - specify - - example - - scenario - - its - Focused: - - fit - - fspecify - - fexample - - fscenario - - focus - Skipped: - - xit - - xspecify - - xexample - - xscenario - - skip - Pending: - - pending - Expectations: - - are_expected - - expect - - expect_any_instance_of - - is_expected - - should - - should_not - - should_not_receive - - should_receive - Helpers: - - let - - let! - Hooks: - - prepend_before - - before - - append_before - - around - - prepend_after - - after - - append_after - Includes: - inherit_mode: - merge: - - Examples - - Context - Examples: - - it_behaves_like - - it_should_behave_like - - include_examples - Context: - - include_context - SharedGroups: - inherit_mode: - merge: - - Examples - - Context - Examples: - - shared_examples - - shared_examples_for - Context: - - shared_context - Subjects: - - subject - - subject! - -Metrics/BlockLength: - inherit_mode: - merge: - - Exclude - Exclude: - - "**/*_spec.rb" - - "**/spec/**/*" - -RSpec/AlignLeftLetBrace: - Description: Checks that left braces for adjacent single line lets are aligned. - Enabled: false - VersionAdded: '1.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignLeftLetBrace - -RSpec/AlignRightLetBrace: - Description: Checks that right braces for adjacent single line lets are aligned. - Enabled: false - VersionAdded: '1.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignRightLetBrace - -RSpec/AnyInstance: - Description: Check that instances are not being stubbed globally. - Enabled: true - VersionAdded: '1.4' - StyleGuide: https://rspec.rubystyle.guide/#any_instance_of - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AnyInstance - -RSpec/AroundBlock: - Description: Checks that around blocks actually run the test. - Enabled: true - VersionAdded: '1.11' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AroundBlock - -RSpec/Be: - Description: Check for expectations where `be` is used without argument. - Enabled: true - VersionAdded: '1.25' - StyleGuide: https://rspec.rubystyle.guide/#be-matcher - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be - -RSpec/BeEmpty: - Description: Prefer using `be_empty` when checking for an empty array. - Enabled: pending - VersionAdded: '2.20' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEmpty - -RSpec/BeEq: - Description: Check for expectations where `be(...)` can replace `eq(...)`. - Enabled: pending - Safe: false - VersionAdded: 2.9.0 - VersionChanged: '2.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEq - -RSpec/BeEql: - Description: Check for expectations where `be(...)` can replace `eql(...)`. - Enabled: true - Safe: false - VersionAdded: '1.7' - VersionChanged: '2.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql - -RSpec/BeNil: - Description: Ensures a consistent style is used when matching `nil`. - Enabled: pending - EnforcedStyle: be_nil - SupportedStyles: - - be - - be_nil - VersionAdded: 2.9.0 - VersionChanged: 2.10.0 - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeNil - -RSpec/BeforeAfterAll: - Description: Check that before/after(:all) isn't being used. - Enabled: true - Exclude: - - spec/spec_helper.rb - - spec/rails_helper.rb - - spec/support/**/*.rb - VersionAdded: '1.12' - StyleGuide: https://rspec.rubystyle.guide/#avoid-hooks-with-context-scope - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll - -RSpec/ChangeByZero: - Description: Prefer negated matchers over `to change.by(0)`. - Enabled: pending - VersionAdded: '2.11' - VersionChanged: '2.14' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ChangeByZero - NegatedMatcher: ~ - -RSpec/ClassCheck: - Description: Enforces consistent use of `be_a` or `be_kind_of`. - StyleGuide: "#is-a-vs-kind-of" - Enabled: pending - VersionAdded: '2.13' - EnforcedStyle: be_a - SupportedStyles: - - be_a - - be_kind_of - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ClassCheck - -RSpec/ContainExactly: - Description: Checks where `contain_exactly` is used. - Enabled: pending - VersionAdded: '2.19' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContainExactly - -RSpec/ContextMethod: - Description: "`context` should not be used for specifying methods." - Enabled: true - VersionAdded: '1.36' - StyleGuide: https://rspec.rubystyle.guide/#example-group-naming - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextMethod - -RSpec/ContextWording: - Description: Checks that `context` docstring starts with an allowed prefix. - Enabled: true - Prefixes: - - when - - with - - without - AllowedPatterns: [] - VersionAdded: '1.20' - VersionChanged: '2.13' - StyleGuide: https://rspec.rubystyle.guide/#context-descriptions - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording - -RSpec/DescribeClass: - Description: Check that the first argument to the top-level describe is a constant. - Enabled: true - Exclude: - - "**/spec/features/**/*" - - "**/spec/requests/**/*" - - "**/spec/routing/**/*" - - "**/spec/system/**/*" - - "**/spec/views/**/*" - IgnoredMetadata: - type: - - channel - - controller - - helper - - job - - mailer - - model - - request - - routing - - view - - feature - - system - - mailbox - - aruba - - task - VersionAdded: '1.0' - VersionChanged: '2.7' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass - -RSpec/DescribeMethod: - Description: Checks that the second argument to `describe` specifies a method. - Enabled: true - VersionAdded: '1.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeMethod - -RSpec/DescribeSymbol: - Description: Avoid describing symbols. - Enabled: true - VersionAdded: '1.15' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeSymbol - -RSpec/DescribedClass: - Description: Checks that tests use `described_class`. - Enabled: true - SkipBlocks: false - EnforcedStyle: described_class - SupportedStyles: - - described_class - - explicit - SafeAutoCorrect: false - VersionAdded: '1.0' - VersionChanged: '1.11' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass - -RSpec/DescribedClassModuleWrapping: - Description: Avoid opening modules and defining specs within them. - Enabled: false - VersionAdded: '1.37' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClassModuleWrapping - -RSpec/Dialect: - Description: Enforces custom RSpec dialects. - Enabled: false - PreferredMethods: {} - VersionAdded: '1.33' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect - -RSpec/DuplicatedMetadata: - Description: Avoid duplicated metadata. - Enabled: pending - VersionAdded: '2.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DuplicatedMetadata - -RSpec/EmptyExampleGroup: - Description: Checks if an example group does not include any tests. - Enabled: true - SafeAutoCorrect: false - VersionAdded: '1.7' - VersionChanged: '2.13' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup - -RSpec/EmptyHook: - Description: Checks for empty before and after hooks. - Enabled: true - VersionAdded: '1.39' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook - -RSpec/EmptyLineAfterExample: - Description: Checks if there is an empty line after example blocks. - Enabled: true - AllowConsecutiveOneLiners: true - VersionAdded: '1.36' - StyleGuide: https://rspec.rubystyle.guide/#empty-lines-around-examples - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample - -RSpec/EmptyLineAfterExampleGroup: - Description: Checks if there is an empty line after example group blocks. - Enabled: true - VersionAdded: '1.27' - StyleGuide: https://rspec.rubystyle.guide/#empty-lines-between-describes - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup - -RSpec/EmptyLineAfterFinalLet: - Description: Checks if there is an empty line after the last let block. - Enabled: true - VersionAdded: '1.14' - StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet - -RSpec/EmptyLineAfterHook: - Description: Checks if there is an empty line after hook blocks. - Enabled: true - VersionAdded: '1.27' - VersionChanged: '2.13' - StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook - AllowConsecutiveOneLiners: true - -RSpec/EmptyLineAfterSubject: - Description: Checks if there is an empty line after subject block. - Enabled: true - VersionAdded: '1.14' - StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject - -RSpec/ExampleLength: - Description: Checks for long examples. - Enabled: true - Max: 5 - CountAsOne: [] - VersionAdded: '1.5' - VersionChanged: '2.3' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength - -RSpec/ExampleWithoutDescription: - Description: Checks for examples without a description. - Enabled: true - EnforcedStyle: always_allow - SupportedStyles: - - always_allow - - single_line_only - - disallow - VersionAdded: '1.22' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription - -RSpec/ExampleWording: - Description: Checks for common mistakes in example descriptions. - Enabled: true - CustomTransform: - be: is - BE: IS - have: has - HAVE: HAS - IgnoredWords: [] - DisallowedExamples: - - works - VersionAdded: '1.0' - VersionChanged: '2.13' - StyleGuide: https://rspec.rubystyle.guide/#should-in-example-docstrings - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording - -RSpec/ExcessiveDocstringSpacing: - Description: Checks for excessive whitespace in example descriptions. - Enabled: pending - VersionAdded: '2.5' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing - -RSpec/ExpectActual: - Description: Checks for `expect(...)` calls containing literal values. - Enabled: true - Exclude: - - spec/routing/**/* - VersionAdded: '1.7' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual - -RSpec/ExpectChange: - Description: Checks for consistent style of change matcher. - Enabled: true - EnforcedStyle: method_call - SupportedStyles: - - method_call - - block - SafeAutoCorrect: false - VersionAdded: '1.22' - VersionChanged: '2.5' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange - -RSpec/ExpectInHook: - Description: Do not use `expect` in hooks such as `before`. - Enabled: true - VersionAdded: '1.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook - -RSpec/ExpectOutput: - Description: Checks for opportunities to use `expect { ... }.to output`. - Enabled: true - VersionAdded: '1.10' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput - -RSpec/FilePath: - Description: Checks that spec file paths are consistent and well-formed. - Enabled: true - Include: - - "**/*_spec*rb*" - - "**/spec/**/*" - CustomTransform: - RuboCop: rubocop - RSpec: rspec - IgnoreMethods: false - SpecSuffixOnly: false - VersionAdded: '1.2' - VersionChanged: '1.40' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath - -RSpec/Focus: - Description: Checks if examples are focused. - Enabled: true - VersionAdded: '1.5' - VersionChanged: '2.1' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus - -RSpec/HookArgument: - Description: Checks the arguments passed to `before`, `around`, and `after`. - Enabled: true - EnforcedStyle: implicit - SupportedStyles: - - implicit - - each - - example - VersionAdded: '1.7' - StyleGuide: https://rspec.rubystyle.guide/#redundant-beforeeach - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument - -RSpec/HooksBeforeExamples: - Description: Checks for before/around/after hooks that come after an example. - Enabled: true - VersionAdded: '1.29' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples - -RSpec/IdenticalEqualityAssertion: - Description: Checks for equality assertions with identical expressions on both sides. - Enabled: pending - VersionAdded: '2.4' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IdenticalEqualityAssertion - -RSpec/ImplicitBlockExpectation: - Description: Check that implicit block expectation syntax is not used. - Enabled: true - VersionAdded: '1.35' - StyleGuide: https://rspec.rubystyle.guide/#implicit-block-expectations - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitBlockExpectation - -RSpec/ImplicitExpect: - Description: Check that a consistent implicit expectation style is used. - Enabled: true - EnforcedStyle: is_expected - SupportedStyles: - - is_expected - - should - VersionAdded: '1.8' - StyleGuide: https://rspec.rubystyle.guide/#use-expect - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitExpect - -RSpec/ImplicitSubject: - Description: Checks for usage of implicit subject (`is_expected` / `should`). - Enabled: true - EnforcedStyle: single_line_only - SupportedStyles: - - single_line_only - - single_statement_only - - disallow - - require_implicit - VersionAdded: '1.29' - VersionChanged: '2.13' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitSubject - -RSpec/IndexedLet: - Description: Do not set up test data using indexes (e.g., `item_1`, `item_2`). - Enabled: pending - VersionAdded: '2.20' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IndexedLet - Max: 1 - -RSpec/InstanceSpy: - Description: Checks for `instance_double` used with `have_received`. - Enabled: true - VersionAdded: '1.12' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceSpy - -RSpec/InstanceVariable: - Description: Checks for instance variable usage in specs. - Enabled: true - AssignmentOnly: false - VersionAdded: '1.0' - VersionChanged: '1.7' - StyleGuide: https://rspec.rubystyle.guide/#instance-variables - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable - -RSpec/ItBehavesLike: - Description: Checks that only one `it_behaves_like` style is used. - Enabled: true - EnforcedStyle: it_behaves_like - SupportedStyles: - - it_behaves_like - - it_should_behave_like - VersionAdded: '1.13' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ItBehavesLike - -RSpec/IteratedExpectation: - Description: Check that `all` matcher is used instead of iterating over an array. - Enabled: true - VersionAdded: '1.14' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IteratedExpectation - -RSpec/LeadingSubject: - Description: Enforce that subject is the first definition in the test. - Enabled: true - VersionAdded: '1.7' - VersionChanged: '1.14' - StyleGuide: https://rspec.rubystyle.guide/#leading-subject - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeadingSubject - -RSpec/LeakyConstantDeclaration: - Description: Checks that no class, module, or constant is declared. - Enabled: true - VersionAdded: '1.35' - StyleGuide: https://rspec.rubystyle.guide/#declare-constants - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeakyConstantDeclaration - -RSpec/LetBeforeExamples: - Description: Checks for `let` definitions that come after an example. - Enabled: true - VersionAdded: '1.16' - VersionChanged: '1.22' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples - -RSpec/LetSetup: - Description: Checks unreferenced `let!` calls being used for test setup. - Enabled: true - VersionAdded: '1.7' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup - -RSpec/MatchArray: - Description: Checks where `match_array` is used. - Enabled: pending - VersionAdded: '2.19' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MatchArray - -RSpec/MessageChain: - Description: Check that chains of messages are not being stubbed. - Enabled: true - VersionAdded: '1.7' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageChain - -RSpec/MessageExpectation: - Description: Checks for consistent message expectation style. - Enabled: false - EnforcedStyle: allow - SupportedStyles: - - allow - - expect - VersionAdded: '1.7' - VersionChanged: '1.8' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation - -RSpec/MessageSpies: - Description: Checks that message expectations are set using spies. - Enabled: true - EnforcedStyle: have_received - SupportedStyles: - - have_received - - receive - VersionAdded: '1.9' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies - -RSpec/MissingExampleGroupArgument: - Description: Checks that the first argument to an example group is not empty. - Enabled: true - VersionAdded: '1.28' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument - -RSpec/MultipleDescribes: - Description: Checks for multiple top-level example groups. - Enabled: true - VersionAdded: '1.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes - -RSpec/MultipleExpectations: - Description: Checks if examples contain too many `expect` calls. - Enabled: true - Max: 1 - VersionAdded: '1.7' - VersionChanged: '1.21' - StyleGuide: https://rspec.rubystyle.guide/#expectation-per-example - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations - -RSpec/MultipleMemoizedHelpers: - Description: Checks if example groups contain too many `let` and `subject` calls. - Enabled: true - AllowSubject: true - Max: 5 - VersionAdded: '1.43' - StyleGuide: https://rspec.rubystyle.guide/#let-blocks - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleMemoizedHelpers - -RSpec/MultipleSubjects: - Description: Checks if an example group defines `subject` multiple times. - Enabled: true - VersionAdded: '1.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleSubjects - -RSpec/NamedSubject: - Description: Checks for explicitly referenced test subjects. - Enabled: true - EnforcedStyle: always - SupportedStyles: - - always - - named_only - IgnoreSharedExamples: true - VersionAdded: 1.5.3 - VersionChanged: '2.15' - StyleGuide: https://rspec.rubystyle.guide/#use-subject - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NamedSubject - -RSpec/NestedGroups: - Description: Checks for nested example groups. - Enabled: true - Max: 3 - AllowedGroups: [] - VersionAdded: '1.7' - VersionChanged: '2.13' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups - -RSpec/NoExpectationExample: - Description: Checks if an example contains any expectation. - Enabled: pending - Safe: false - VersionAdded: '2.13' - VersionChanged: '2.14' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NoExpectationExample - AllowedPatterns: - - "^expect_" - - "^assert_" - -RSpec/NotToNot: - Description: Checks for consistent method usage for negating expectations. - Enabled: true - EnforcedStyle: not_to - SupportedStyles: - - not_to - - to_not - VersionAdded: '1.4' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot - -RSpec/OverwritingSetup: - Description: Checks if there is a let/subject that overwrites an existing one. - Enabled: true - VersionAdded: '1.14' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/OverwritingSetup - -RSpec/Pending: - Description: Checks for any pending or skipped examples. - Enabled: false - VersionAdded: '1.25' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending - -RSpec/PendingWithoutReason: - Description: Checks for pending or skipped examples without reason. - Enabled: pending - VersionAdded: '2.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PendingWithoutReason - -RSpec/PredicateMatcher: - Description: Prefer using predicate matcher over using predicate method directly. - Enabled: true - Strict: true - EnforcedStyle: inflected - AllowedExplicitMatchers: [] - SupportedStyles: - - inflected - - explicit - SafeAutoCorrect: false - VersionAdded: '1.16' - StyleGuide: https://rspec.rubystyle.guide/#predicate-matchers - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher - -RSpec/ReceiveCounts: - Description: Check for `once` and `twice` receive counts matchers usage. - Enabled: true - VersionAdded: '1.26' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts - -RSpec/ReceiveNever: - Description: Prefer `not_to receive(...)` over `receive(...).never`. - Enabled: true - VersionAdded: '1.28' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveNever - -RSpec/RedundantAround: - Description: Remove redundant `around` hook. - Enabled: pending - VersionAdded: '2.19' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RedundantAround - -RSpec/RepeatedDescription: - Description: Check for repeated description strings in example groups. - Enabled: true - VersionAdded: '1.9' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription - -RSpec/RepeatedExample: - Description: Check for repeated examples within example groups. - Enabled: true - VersionAdded: '1.10' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample - -RSpec/RepeatedExampleGroupBody: - Description: Check for repeated describe and context block body. - Enabled: true - VersionAdded: '1.38' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupBody - -RSpec/RepeatedExampleGroupDescription: - Description: Check for repeated example group descriptions. - Enabled: true - VersionAdded: '1.38' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription - -RSpec/RepeatedIncludeExample: - Description: Check for repeated include of shared examples. - Enabled: true - VersionAdded: '1.44' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedIncludeExample - -RSpec/ReturnFromStub: - Description: Checks for consistent style of stub's return setting. - Enabled: true - EnforcedStyle: and_return - SupportedStyles: - - and_return - - block - VersionAdded: '1.16' - VersionChanged: '1.22' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub - -RSpec/ScatteredLet: - Description: Checks for let scattered across the example group. - Enabled: true - VersionAdded: '1.14' - VersionChanged: '1.39' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet - -RSpec/ScatteredSetup: - Description: Checks for setup scattered across multiple hooks in an example group. - Enabled: true - VersionAdded: '1.10' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup - -RSpec/SharedContext: - Description: Checks for proper shared_context and shared_examples usage. - Enabled: true - VersionAdded: '1.13' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext - -RSpec/SharedExamples: - Description: Enforces use of string to titleize shared examples. - Enabled: true - VersionAdded: '1.25' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples - -RSpec/SingleArgumentMessageChain: - Description: Checks that chains of messages contain more than one element. - Enabled: true - VersionAdded: '1.9' - VersionChanged: '1.10' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain - -RSpec/SkipBlockInsideExample: - Description: Checks for passing a block to `skip` within examples. - Enabled: pending - VersionAdded: '2.19' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SkipBlockInsideExample - -RSpec/SortMetadata: - Description: Sort RSpec metadata alphabetically. - Enabled: pending - VersionAdded: '2.14' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SortMetadata - -RSpec/StubbedMock: - Description: Checks that message expectations do not have a configured response. - Enabled: true - VersionAdded: '1.44' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/StubbedMock - -RSpec/SubjectDeclaration: - Description: Ensure that subject is defined using subject helper. - Enabled: pending - VersionAdded: '2.5' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectDeclaration - -RSpec/SubjectStub: - Description: Checks for stubbed test subjects. - Enabled: true - VersionAdded: '1.7' - VersionChanged: '2.8' - StyleGuide: https://rspec.rubystyle.guide/#dont-stub-subject - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub - -RSpec/UnspecifiedException: - Description: Checks for a specified error in checking raised errors. - Enabled: true - VersionAdded: '1.30' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UnspecifiedException - -RSpec/VariableDefinition: - Description: Checks that memoized helpers names are symbols or strings. - Enabled: true - EnforcedStyle: symbols - SupportedStyles: - - symbols - - strings - VersionAdded: '1.40' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableDefinition - -RSpec/VariableName: - Description: Checks that memoized helper names use the configured style. - Enabled: true - EnforcedStyle: snake_case - SupportedStyles: - - snake_case - - camelCase - AllowedPatterns: [] - VersionAdded: '1.40' - VersionChanged: '2.13' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName - -RSpec/VerifiedDoubleReference: - Description: Checks for consistent verified double reference style. - Enabled: pending - SafeAutoCorrect: false - EnforcedStyle: constant - SupportedStyles: - - constant - - string - VersionAdded: 2.10.0 - VersionChanged: '2.12' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubleReference - -RSpec/VerifiedDoubles: - Description: Prefer using verifying doubles over normal doubles. - Enabled: true - IgnoreNameless: true - IgnoreSymbolicNames: false - VersionAdded: 1.2.1 - VersionChanged: '1.5' - StyleGuide: https://rspec.rubystyle.guide/#doubles - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles - -RSpec/VoidExpect: - Description: Checks void `expect()`. - Enabled: true - VersionAdded: '1.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect - -RSpec/Yield: - Description: Checks for calling a block within a stub. - Enabled: true - VersionAdded: '1.32' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield - -RSpec/Capybara: - Enabled: true - Include: *1 - Language: *2 - -RSpec/Capybara/CurrentPathExpectation: - Description: Checks that no expectations are set on Capybara's `current_path`. - Enabled: true - VersionAdded: '1.18' - VersionChanged: '2.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation - -RSpec/Capybara/FeatureMethods: - Description: Checks for consistent method usage in feature specs. - Enabled: true - EnabledMethods: [] - VersionAdded: '1.17' - VersionChanged: '2.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods - -RSpec/Capybara/MatchStyle: - Description: Checks for usage of deprecated style methods. - Enabled: pending - VersionAdded: '2.17' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/MatchStyle - -RSpec/Capybara/NegationMatcher: - Description: Enforces use of `have_no_*` or `not_to` for negated expectations. - Enabled: pending - VersionAdded: '2.14' - EnforcedStyle: not_to - SupportedStyles: - - have_no - - not_to - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/NegationMatcher - -RSpec/Capybara/SpecificActions: - Description: Checks for there is a more specific actions offered by Capybara. - Enabled: pending - VersionAdded: '2.14' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificActions - -RSpec/Capybara/SpecificFinders: - Description: Checks if there is a more specific finder offered by Capybara. - Enabled: pending - VersionAdded: '2.13' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificFinders - -RSpec/Capybara/SpecificMatcher: - Description: Checks for there is a more specific matcher offered by Capybara. - Enabled: pending - VersionAdded: '2.12' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificMatcher - -RSpec/Capybara/VisibilityMatcher: - Description: Checks for boolean visibility in Capybara finders. - Enabled: true - VersionAdded: '1.39' - VersionChanged: '2.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher - -RSpec/FactoryBot: - Enabled: true - Include: *1 - Language: *2 - -RSpec/FactoryBot/AttributeDefinedStatically: - Description: Always declare attribute values as blocks. - Enabled: true - Include: - - spec/factories.rb - - spec/factories/**/*.rb - - features/support/factories/**/*.rb - VersionAdded: '1.28' - VersionChanged: '2.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically - -RSpec/FactoryBot/ConsistentParenthesesStyle: - Description: Use a consistent style for parentheses in factory bot calls. - Enabled: pending - EnforcedStyle: require_parentheses - SupportedStyles: - - require_parentheses - - omit_parentheses - VersionAdded: '2.14' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/ConsistentParenthesesStyle - -RSpec/FactoryBot/CreateList: - Description: Checks for create_list usage. - Enabled: true - Include: - - "**/*_spec.rb" - - "**/spec/**/*" - - spec/factories.rb - - spec/factories/**/*.rb - - features/support/factories/**/*.rb - EnforcedStyle: create_list - SupportedStyles: - - create_list - - n_times - VersionAdded: '1.25' - VersionChanged: '2.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList - -RSpec/FactoryBot/FactoryClassName: - Description: Use string value when setting the class attribute explicitly. - Enabled: true - Include: - - spec/factories.rb - - spec/factories/**/*.rb - - features/support/factories/**/*.rb - VersionAdded: '1.37' - VersionChanged: '2.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName - -RSpec/FactoryBot/FactoryNameStyle: - Description: Checks for name style for argument of FactoryBot::Syntax::Methods. - Enabled: pending - VersionAdded: '2.16' - EnforcedStyle: symbol - SupportedStyles: - - symbol - - string - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryNameStyle - -RSpec/FactoryBot/SyntaxMethods: - Description: Use shorthands from `FactoryBot::Syntax::Methods` in your specs. - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '2.7' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/SyntaxMethods - -RSpec/Rails: - Enabled: true - Include: *1 - Language: *2 - -RSpec/Rails/AvoidSetupHook: - Description: Checks that tests use RSpec `before` hook over Rails `setup` method. - Enabled: pending - VersionAdded: '2.4' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/AvoidSetupHook - -RSpec/Rails/HaveHttpStatus: - Description: Checks that tests use `have_http_status` instead of equality matchers. - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '2.12' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HaveHttpStatus - -RSpec/Rails/HttpStatus: - Description: Enforces use of symbolic or numeric value to describe HTTP status. - Enabled: true - EnforcedStyle: symbolic - SupportedStyles: - - numeric - - symbolic - - be_status - VersionAdded: '1.23' - VersionChanged: '2.20' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus - -RSpec/Rails/InferredSpecType: - Description: Identifies redundant spec type. - Enabled: pending - Safe: false - VersionAdded: '2.14' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/InferredSpecType - Inferences: - channels: channel - controllers: controller - features: feature - generator: generator - helpers: helper - jobs: job - mailboxes: mailbox - mailers: mailer - models: model - requests: request - integration: request - api: request - routing: routing - system: system - views: view - -RSpec/Rails/MinitestAssertions: - Description: Check if using Minitest matchers. - Enabled: pending - VersionAdded: '2.17' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/MinitestAssertions - -RSpec/Rails/TravelAround: - Description: Prefer to travel in `before` rather than `around`. - Enabled: pending - Safe: false - VersionAdded: '2.19' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/TravelAround diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/config/obsoletion.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/config/obsoletion.yml deleted file mode 100644 index c2f02f8f745ca2..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/config/obsoletion.yml +++ /dev/null @@ -1,23 +0,0 @@ -# -# Configuration of obsolete/deprecated cops used by `ConfigObsoletion`. -# -# See: https://docs.rubocop.org/rubocop/extensions.html#config-obsoletions -# - -# Cop parameters that have been changed -# Can be treated as a warning instead of a failure with `severity: warning` -changed_parameters: - - cops: - - RSpec/VariableName - parameters: IgnoredPatterns - alternative: AllowedPatterns - severity: warning - -renamed: - RSpec/Capybara/CurrentPathExpectation: Capybara/CurrentPathExpectation - RSpec/Capybara/MatchStyle: Capybara/MatchStyle - RSpec/Capybara/NegationMatcher: Capybara/NegationMatcher - RSpec/Capybara/SpecificActions: Capybara/SpecificActions - RSpec/Capybara/SpecificFinders: Capybara/SpecificFinders - RSpec/Capybara/SpecificMatcher: Capybara/SpecificMatcher - RSpec/Capybara/VisibilityMatcher: Capybara/VisibilityMatcher diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop-rspec.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop-rspec.rb deleted file mode 100644 index 500426939ace90..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop-rspec.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -require 'pathname' -require 'yaml' - -require 'rubocop' -require 'rubocop-capybara' - -require_relative 'rubocop/rspec' -require_relative 'rubocop/rspec/inject' -require_relative 'rubocop/rspec/language/node_pattern' -require_relative 'rubocop/rspec/node' -require_relative 'rubocop/rspec/version' -require_relative 'rubocop/rspec/wording' - -# Dependent on `RuboCop::RSpec::Language::NodePattern`. -require_relative 'rubocop/rspec/language' - -require_relative 'rubocop/rspec/factory_bot/language' - -require_relative 'rubocop/cop/rspec/mixin/final_end_location' -require_relative 'rubocop/cop/rspec/mixin/inside_example_group' -require_relative 'rubocop/cop/rspec/mixin/location_help' -require_relative 'rubocop/cop/rspec/mixin/metadata' -require_relative 'rubocop/cop/rspec/mixin/namespace' -require_relative 'rubocop/cop/rspec/mixin/skip_or_pending' -require_relative 'rubocop/cop/rspec/mixin/top_level_group' -require_relative 'rubocop/cop/rspec/mixin/variable' - -# Dependent on `RuboCop::Cop::RSpec::FinalEndLocation`. -require_relative 'rubocop/cop/rspec/mixin/comments_help' -require_relative 'rubocop/cop/rspec/mixin/empty_line_separation' - -require_relative 'rubocop/cop/rspec/base' -require_relative 'rubocop/rspec/align_let_brace' -require_relative 'rubocop/rspec/concept' -require_relative 'rubocop/rspec/corrector/move_node' -require_relative 'rubocop/rspec/example' -require_relative 'rubocop/rspec/example_group' -require_relative 'rubocop/rspec/factory_bot' -require_relative 'rubocop/rspec/hook' - -RuboCop::RSpec::Inject.defaults! - -require_relative 'rubocop/cop/rspec_cops' - -# We have to register our autocorrect incompatibilities in RuboCop's cops -# as well so we do not hit infinite loops - -RuboCop::Cop::Layout::ExtraSpacing.singleton_class.prepend( - Module.new do - def autocorrect_incompatible_with - super.push(RuboCop::Cop::RSpec::AlignLeftLetBrace) - .push(RuboCop::Cop::RSpec::AlignRightLetBrace) - end - end -) - -RuboCop::Cop::Style::TrailingCommaInArguments.singleton_class.prepend( - Module.new do - def autocorrect_incompatible_with - super.push(RuboCop::Cop::RSpec::Capybara::CurrentPathExpectation) - end - end -) - -RuboCop::AST::Node.include(RuboCop::RSpec::Node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/align_left_let_brace.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/align_left_let_brace.rb deleted file mode 100644 index 990222a686af8f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/align_left_let_brace.rb +++ /dev/null @@ -1,49 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks that left braces for adjacent single line lets are aligned. - # - # @example - # # bad - # let(:foobar) { blahblah } - # let(:baz) { bar } - # let(:a) { b } - # - # # good - # let(:foobar) { blahblah } - # let(:baz) { bar } - # let(:a) { b } - # - class AlignLeftLetBrace < Base - extend AutoCorrector - - MSG = 'Align left let brace' - - def self.autocorrect_incompatible_with - [Layout::ExtraSpacing] - end - - def on_new_investigation - super - return if processed_source.blank? - - token_aligner.offending_tokens.each do |let| - add_offense(let.loc.begin) do |corrector| - corrector.insert_before( - let.loc.begin, token_aligner.indent_for(let) - ) - end - end - end - - private - - def token_aligner - RuboCop::RSpec::AlignLetBrace.new(processed_source.ast, :begin) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/align_right_let_brace.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/align_right_let_brace.rb deleted file mode 100644 index cd33e6d8ef206f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/align_right_let_brace.rb +++ /dev/null @@ -1,49 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks that right braces for adjacent single line lets are aligned. - # - # @example - # # bad - # let(:foobar) { blahblah } - # let(:baz) { bar } - # let(:a) { b } - # - # # good - # let(:foobar) { blahblah } - # let(:baz) { bar } - # let(:a) { b } - # - class AlignRightLetBrace < Base - extend AutoCorrector - - MSG = 'Align right let brace' - - def self.autocorrect_incompatible_with - [Layout::ExtraSpacing] - end - - def on_new_investigation - super - return if processed_source.blank? - - token_aligner.offending_tokens.each do |let| - add_offense(let.loc.end) do |corrector| - corrector.insert_before( - let.loc.end, token_aligner.indent_for(let) - ) - end - end - end - - private - - def token_aligner - RuboCop::RSpec::AlignLetBrace.new(processed_source.ast, :end) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/any_instance.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/any_instance.rb deleted file mode 100644 index 6c0e5bb8e10421..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/any_instance.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Check that instances are not being stubbed globally. - # - # Prefer instance doubles over stubbing any instance of a class - # - # @example - # # bad - # describe MyClass do - # before { allow_any_instance_of(MyClass).to receive(:foo) } - # end - # - # # good - # describe MyClass do - # let(:my_instance) { instance_double(MyClass) } - # - # before do - # allow(MyClass).to receive(:new).and_return(my_instance) - # allow(my_instance).to receive(:foo) - # end - # end - # - class AnyInstance < Base - MSG = 'Avoid stubbing using `%s`.' - RESTRICT_ON_SEND = %i[ - any_instance - allow_any_instance_of - expect_any_instance_of - ].freeze - - def on_send(node) - add_offense(node, message: format(MSG, method: node.method_name)) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/around_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/around_block.rb deleted file mode 100644 index 4bf38ebd25e11a..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/around_block.rb +++ /dev/null @@ -1,97 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks that around blocks actually run the test. - # - # @example - # # bad - # around do - # some_method - # end - # - # around do |test| - # some_method - # end - # - # # good - # around do |test| - # some_method - # test.call - # end - # - # around do |test| - # some_method - # test.run - # end - # - class AroundBlock < Base - MSG_NO_ARG = 'Test object should be passed to around block.' - MSG_UNUSED_ARG = 'You should call `%s.call` ' \ - 'or `%s.run`.' - - # @!method hook_block(node) - def_node_matcher :hook_block, <<-PATTERN - (block (send nil? :around sym ?) (args $...) ...) - PATTERN - - # @!method hook_numblock(node) - def_node_matcher :hook_numblock, <<-PATTERN - (numblock (send nil? :around sym ?) ...) - PATTERN - - # @!method find_arg_usage(node) - def_node_search :find_arg_usage, <<-PATTERN - {(send $... {:call :run}) (send _ _ $...) (yield $...) (block-pass $...)} - PATTERN - - def on_block(node) - hook_block(node) do |(example_proxy)| - if example_proxy.nil? - add_no_arg_offense(node) - else - check_for_unused_proxy(node, example_proxy) - end - end - end - - def on_numblock(node) - hook_numblock(node) do - check_for_numblock(node) - end - end - - private - - def add_no_arg_offense(node) - add_offense(node, message: MSG_NO_ARG) - end - - def check_for_unused_proxy(block, proxy) - name, = *proxy - - find_arg_usage(block) do |usage| - return if usage.include?(s(:lvar, name)) - end - - add_offense( - proxy, - message: format(MSG_UNUSED_ARG, arg: name) - ) - end - - def check_for_numblock(block) - find_arg_usage(block) do |usage| - return if usage.include?(s(:lvar, :_1)) - end - - add_offense( - block.children.last, - message: format(MSG_UNUSED_ARG, arg: :_1) - ) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/base.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/base.rb deleted file mode 100644 index 93c174a7e9d2f5..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/base.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # @abstract parent class to RSpec cops - class Base < ::RuboCop::Cop::Base - include RuboCop::RSpec::Language - extend RuboCop::RSpec::Language::NodePattern - - exclude_from_registry - - # Invoke the original inherited hook so our cops are recognized - def self.inherited(subclass) # rubocop:disable Lint/MissingSuper - RuboCop::Cop::Base.inherited(subclass) - end - - # Set the config for dynamic DSL configuration-aware helpers - # that have no other means of accessing the configuration. - def on_new_investigation - super - RuboCop::RSpec::Language.config = config['RSpec']['Language'] - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be.rb deleted file mode 100644 index 4fbf3e8c60591f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Check for expectations where `be` is used without argument. - # - # The `be` matcher is too generic, as it pass on everything that is not - # nil or false. If that is the exact intend, use `be_truthy`. In all other - # cases it's better to specify what exactly is the expected value. - # - # @example - # # bad - # expect(foo).to be - # - # # good - # expect(foo).to be_truthy - # expect(foo).to be 1.0 - # expect(foo).to be(true) - # - class Be < Base - MSG = "Don't use `be` without an argument." - - RESTRICT_ON_SEND = Runners.all - - # @!method be_without_args(node) - def_node_matcher :be_without_args, <<-PATTERN - (send _ #Runners.all $(send nil? :be)) - PATTERN - - def on_send(node) - be_without_args(node) do |matcher| - add_offense(matcher.loc.selector) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be_empty.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be_empty.rb deleted file mode 100644 index 68d3cd69d029dd..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be_empty.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Prefer using `be_empty` when checking for an empty array. - # - # @example - # # bad - # expect(array).to contain_exactly - # expect(array).to match_array([]) - # - # # good - # expect(array).to be_empty - # - class BeEmpty < Base - extend AutoCorrector - - MSG = 'Use `be_empty` matchers for checking an empty array.' - RESTRICT_ON_SEND = %i[contain_exactly match_array].freeze - - # @!method expect_array_matcher?(node) - def_node_matcher :expect_array_matcher?, <<~PATTERN - (send - (send nil? :expect _) - #Runners.all - ${ - (send nil? :match_array (array)) - (send nil? :contain_exactly) - } - ) - PATTERN - - def on_send(node) - expect_array_matcher?(node.parent) do |expect| - add_offense(expect) do |corrector| - corrector.replace(expect, 'be_empty') - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be_eq.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be_eq.rb deleted file mode 100644 index 770e49efb86f11..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be_eq.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Check for expectations where `be(...)` can replace `eq(...)`. - # - # The `be` matcher compares by identity while the `eq` matcher compares - # using `==`. Booleans and nil can be compared by identity and therefore - # the `be` matcher is preferable as it is a more strict test. - # - # @safety - # This cop is unsafe because it changes how values are compared. - # - # @example - # # bad - # expect(foo).to eq(true) - # expect(foo).to eq(false) - # expect(foo).to eq(nil) - # - # # good - # expect(foo).to be(true) - # expect(foo).to be(false) - # expect(foo).to be(nil) - # - class BeEq < Base - extend AutoCorrector - - MSG = 'Prefer `be` over `eq`.' - RESTRICT_ON_SEND = %i[eq].freeze - - # @!method eq_type_with_identity?(node) - def_node_matcher :eq_type_with_identity?, <<-PATTERN - (send nil? :eq {true false nil}) - PATTERN - - def on_send(node) - return unless eq_type_with_identity?(node) - - add_offense(node.loc.selector) do |corrector| - corrector.replace(node.loc.selector, 'be') - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be_eql.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be_eql.rb deleted file mode 100644 index ea81989e498abb..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be_eql.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Check for expectations where `be(...)` can replace `eql(...)`. - # - # The `be` matcher compares by identity while the `eql` matcher - # compares using `eql?`. Integers, floats, booleans, symbols, and nil - # can be compared by identity and therefore the `be` matcher is - # preferable as it is a more strict test. - # - # @safety - # This cop is unsafe because it changes how values are compared. - # - # @example - # # bad - # expect(foo).to eql(1) - # expect(foo).to eql(1.0) - # expect(foo).to eql(true) - # expect(foo).to eql(false) - # expect(foo).to eql(:bar) - # expect(foo).to eql(nil) - # - # # good - # expect(foo).to be(1) - # expect(foo).to be(1.0) - # expect(foo).to be(true) - # expect(foo).to be(false) - # expect(foo).to be(:bar) - # expect(foo).to be(nil) - # - # This cop only looks for instances of `expect(...).to eql(...)`. We - # do not check `to_not` or `not_to` since `!eql?` is more strict - # than `!equal?`. We also do not try to flag `eq` because if - # `a == b`, and `b` is comparable by identity, `a` is still not - # necessarily the same type as `b` since the `#==` operator can - # coerce objects for comparison. - # - class BeEql < Base - extend AutoCorrector - - MSG = 'Prefer `be` over `eql`.' - RESTRICT_ON_SEND = %i[to].freeze - - # @!method eql_type_with_identity(node) - def_node_matcher :eql_type_with_identity, <<-PATTERN - (send _ :to $(send nil? :eql {true false int float sym nil})) - PATTERN - - def on_send(node) - eql_type_with_identity(node) do |eql| - add_offense(eql.loc.selector) do |corrector| - corrector.replace(eql.loc.selector, 'be') - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be_nil.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be_nil.rb deleted file mode 100644 index 12208feea7daa4..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/be_nil.rb +++ /dev/null @@ -1,74 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Ensures a consistent style is used when matching `nil`. - # - # You can either use the more specific `be_nil` matcher, or the more - # generic `be` matcher with a `nil` argument. - # - # This cop can be configured using the `EnforcedStyle` option - # - # @example `EnforcedStyle: be_nil` (default) - # # bad - # expect(foo).to be(nil) - # - # # good - # expect(foo).to be_nil - # - # @example `EnforcedStyle: be` - # # bad - # expect(foo).to be_nil - # - # # good - # expect(foo).to be(nil) - # - class BeNil < Base - extend AutoCorrector - include ConfigurableEnforcedStyle - - BE_MSG = 'Prefer `be(nil)` over `be_nil`.' - BE_NIL_MSG = 'Prefer `be_nil` over `be(nil)`.' - RESTRICT_ON_SEND = %i[be be_nil].freeze - - # @!method be_nil_matcher?(node) - def_node_matcher :be_nil_matcher?, <<-PATTERN - (send nil? :be_nil) - PATTERN - - # @!method nil_value_expectation?(node) - def_node_matcher :nil_value_expectation?, <<-PATTERN - (send nil? :be nil) - PATTERN - - def on_send(node) - case style - when :be - check_be_style(node) - when :be_nil - check_be_nil_style(node) - end - end - - private - - def check_be_style(node) - return unless be_nil_matcher?(node) - - add_offense(node, message: BE_MSG) do |corrector| - corrector.replace(node, 'be(nil)') - end - end - - def check_be_nil_style(node) - return unless nil_value_expectation?(node) - - add_offense(node, message: BE_NIL_MSG) do |corrector| - corrector.replace(node, 'be_nil') - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/before_after_all.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/before_after_all.rb deleted file mode 100644 index 7c3298c8fb3a67..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/before_after_all.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Check that before/after(:all) isn't being used. - # - # @example - # # bad - # # - # # Faster but risk of state leaking between examples - # # - # describe MyClass do - # before(:all) { Widget.create } - # after(:all) { Widget.delete_all } - # end - # - # # good - # # - # # Slower but examples are properly isolated - # # - # describe MyClass do - # before(:each) { Widget.create } - # after(:each) { Widget.delete_all } - # end - # - class BeforeAfterAll < Base - MSG = 'Beware of using `%s` as it may cause state to leak ' \ - 'between tests. If you are using `rspec-rails`, and ' \ - '`use_transactional_fixtures` is enabled, then records created ' \ - 'in `%s` are not automatically rolled back.' - - RESTRICT_ON_SEND = %i[before after].freeze - - # @!method before_or_after_all(node) - def_node_matcher :before_or_after_all, <<-PATTERN - $(send _ {:before :after} (sym {:all :context})) - PATTERN - - def on_send(node) - before_or_after_all(node) do |hook| - add_offense( - node, - message: format(MSG, hook: hook.source) - ) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb deleted file mode 100644 index 41fcd2170ac355..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - module Capybara - # @!parse - # # Checks that no expectations are set on Capybara's `current_path`. - # # - # # The - # # https://www.rubydoc.info/github/teamcapybara/capybara/master/Capybara/RSpecMatchers#have_current_path-instance_method[`have_current_path` matcher] - # # should be used on `page` to set expectations on Capybara's - # # current path, since it uses - # # https://github.com/teamcapybara/capybara/blob/master/README.md#asynchronous-javascript-ajax-and-friends[Capybara's waiting functionality] - # # which ensures that preceding actions (like `click_link`) have - # # completed. - # # - # # This cop does not support autocorrection in some cases. - # # - # # @example - # # # bad - # # expect(current_path).to eq('/callback') - # # - # # # good - # # expect(page).to have_current_path('/callback') - # # - # # # bad (does not support autocorrection) - # # expect(page.current_path).to match(variable) - # # - # # # good - # # expect(page).to have_current_path('/callback') - # # - # class CurrentPathExpectation < ::RuboCop::Cop::Base; end - CurrentPathExpectation = - ::RuboCop::Cop::Capybara::CurrentPathExpectation - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/feature_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/feature_methods.rb deleted file mode 100644 index 5fe49758ed7b96..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/feature_methods.rb +++ /dev/null @@ -1,104 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - module Capybara - # Checks for consistent method usage in feature specs. - # - # By default, the cop disables all Capybara-specific methods that have - # the same native RSpec method (e.g. are just aliases). Some teams - # however may prefer using some of the Capybara methods (like `feature`) - # to make it obvious that the test uses Capybara, while still disable - # the rest of the methods, like `given` (alias for `let`), `background` - # (alias for `before`), etc. You can configure which of the methods to - # be enabled by using the EnabledMethods configuration option. - # - # @example - # # bad - # feature 'User logs in' do - # given(:user) { User.new } - # - # background do - # visit new_session_path - # end - # - # scenario 'with OAuth' do - # # ... - # end - # end - # - # # good - # describe 'User logs in' do - # let(:user) { User.new } - # - # before do - # visit new_session_path - # end - # - # it 'with OAuth' do - # # ... - # end - # end - # - class FeatureMethods < Base - extend AutoCorrector - include InsideExampleGroup - - MSG = 'Use `%s` instead of `%s`.' - - # https://github.com/teamcapybara/capybara/blob/e283c1aeaa72441f5403963577e16333bf111a81/lib/capybara/rspec/features.rb#L31-L36 - MAP = { - background: :before, - scenario: :it, - xscenario: :xit, - given: :let, - given!: :let!, - feature: :describe - }.freeze - - # @!method capybara_speak(node) - def_node_matcher :capybara_speak, <<-PATTERN - {#{MAP.keys.map(&:inspect).join(' ')}} - PATTERN - - # @!method feature_method(node) - def_node_matcher :feature_method, <<-PATTERN - (block - $(send #rspec? $#capybara_speak ...) - ...) - PATTERN - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - return unless inside_example_group?(node) - - feature_method(node) do |send_node, match| - next if enabled?(match) - - add_offense(send_node.loc.selector) do |corrector| - corrector.replace(send_node.loc.selector, MAP[match].to_s) - end - end - end - - def message(range) - name = range.source.to_sym - format(MSG, method: name, replacement: MAP[name]) - end - - private - - def enabled?(method_name) - enabled_methods.include?(method_name) - end - - def enabled_methods - cop_config - .fetch('EnabledMethods', []) - .map(&:to_sym) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/match_style.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/match_style.rb deleted file mode 100644 index b18102d45827cc..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/match_style.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - module Capybara - # @!parse - # # Checks for usage of deprecated style methods. - # # - # # @example when using `assert_style` - # # # bad - # # page.find(:css, '#first').assert_style(display: 'block') - # # - # # # good - # # page.find(:css, '#first').assert_matches_style(display: 'block') - # # - # # @example when using `has_style?` - # # # bad - # # expect(page.find(:css, 'first') - # # .has_style?(display: 'block')).to be true - # # - # # # good - # # expect(page.find(:css, 'first') - # # .matches_style?(display: 'block')).to be true - # # - # # @example when using `have_style` - # # # bad - # # expect(page).to have_style(display: 'block') - # # - # # # good - # # expect(page).to match_style(display: 'block') - # # - # class MatchStyle < ::RuboCop::Cop::Base; end - MatchStyle = ::RuboCop::Cop::Capybara::MatchStyle - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/negation_matcher.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/negation_matcher.rb deleted file mode 100644 index 7c9c5170265acc..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/negation_matcher.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - module Capybara - # @!parse - # # Enforces use of `have_no_*` or `not_to` for negated expectations. - # # - # # @example EnforcedStyle: not_to (default) - # # # bad - # # expect(page).to have_no_selector - # # expect(page).to have_no_css('a') - # # - # # # good - # # expect(page).not_to have_selector - # # expect(page).not_to have_css('a') - # # - # # @example EnforcedStyle: have_no - # # # bad - # # expect(page).not_to have_selector - # # expect(page).not_to have_css('a') - # # - # # # good - # # expect(page).to have_no_selector - # # expect(page).to have_no_css('a') - # # - # class NegationMatcher < ::RuboCop::Cop::Base; end - NegationMatcher = ::RuboCop::Cop::Capybara::NegationMatcher - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/specific_actions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/specific_actions.rb deleted file mode 100644 index 93cea5a7f6f294..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/specific_actions.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - module Capybara - # @!parse - # # Checks for there is a more specific actions offered by Capybara. - # # - # # @example - # # - # # # bad - # # find('a').click - # # find('button.cls').click - # # find('a', exact_text: 'foo').click - # # find('div button').click - # # - # # # good - # # click_link - # # click_button(class: 'cls') - # # click_link(exact_text: 'foo') - # # find('div').click_button - # # - # class SpecificActions < ::RuboCop::Cop::Base; end - SpecificActions = ::RuboCop::Cop::Capybara::SpecificActions - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/specific_finders.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/specific_finders.rb deleted file mode 100644 index 41c346e5a99afa..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/specific_finders.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - module Capybara - # @!parse - # # Checks if there is a more specific finder offered by Capybara. - # # - # # @example - # # # bad - # # find('#some-id') - # # find('[visible][id=some-id]') - # # - # # # good - # # find_by_id('some-id') - # # find_by_id('some-id', visible: true) - # # - # class SpecificFinders < ::RuboCop::Cop::Base; end - SpecificFinders = ::RuboCop::Cop::Capybara::SpecificFinders - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/specific_matcher.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/specific_matcher.rb deleted file mode 100644 index e6f5fa4d61eaa0..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/specific_matcher.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - module Capybara - # @!parse - # # Checks for there is a more specific matcher offered by Capybara. - # # - # # @example - # # - # # # bad - # # expect(page).to have_selector('button') - # # expect(page).to have_no_selector('button.cls') - # # expect(page).to have_css('button') - # # expect(page).to have_no_css('a.cls', href: 'http://example.com') - # # expect(page).to have_css('table.cls') - # # expect(page).to have_css('select') - # # expect(page).to have_css('input', exact_text: 'foo') - # # - # # # good - # # expect(page).to have_button - # # expect(page).to have_no_button(class: 'cls') - # # expect(page).to have_button - # # expect(page).to have_no_link('foo', class: 'cls', href: 'http://example.com') - # # expect(page).to have_table(class: 'cls') - # # expect(page).to have_select - # # expect(page).to have_field('foo') - # # - # class SpecificMatcher < ::RuboCop::Cop::Base; end - SpecificMatcher = ::RuboCop::Cop::Capybara::SpecificMatcher - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb deleted file mode 100644 index bb63f8b7333918..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - module Capybara - # @!parse - # # Checks for boolean visibility in Capybara finders. - # # - # # Capybara lets you find elements that match a certain visibility - # # using the `:visible` option. `:visible` accepts both boolean and - # # symbols as values, however using booleans can have unwanted - # # effects. `visible: false` does not find just invisible elements, - # # but both visible and invisible elements. For expressiveness and - # # clarity, use one of the # symbol values, `:all`, `:hidden` or - # # `:visible`. - # # Read more in - # # https://www.rubydoc.info/gems/capybara/Capybara%2FNode%2FFinders:all[the documentation]. - # # - # # @example - # # # bad - # # expect(page).to have_selector('.foo', visible: false) - # # expect(page).to have_css('.foo', visible: true) - # # expect(page).to have_link('my link', visible: false) - # # - # # # good - # # expect(page).to have_selector('.foo', visible: :visible) - # # expect(page).to have_css('.foo', visible: :all) - # # expect(page).to have_link('my link', visible: :hidden) - # # - # class VisibilityMatcher < ::RuboCop::Cop::Base; end - VisibilityMatcher = ::RuboCop::Cop::Capybara::VisibilityMatcher - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/change_by_zero.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/change_by_zero.rb deleted file mode 100644 index 8e38a8c15b7f10..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/change_by_zero.rb +++ /dev/null @@ -1,148 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Prefer negated matchers over `to change.by(0)`. - # - # In the case of composite expectations, cop suggest using the - # negation matchers of `RSpec::Matchers#change`. - # - # By default the cop does not support autocorrect of - # compound expectations, but if you set the - # negated matcher for `change`, e.g. `not_change` with - # the `NegatedMatcher` option, the cop will perform the autocorrection. - # - # @example NegatedMatcher: ~ (default) - # # bad - # expect { run }.to change(Foo, :bar).by(0) - # expect { run }.to change { Foo.bar }.by(0) - # - # # bad - compound expectations (does not support autocorrection) - # expect { run } - # .to change(Foo, :bar).by(0) - # .and change(Foo, :baz).by(0) - # expect { run } - # .to change { Foo.bar }.by(0) - # .and change { Foo.baz }.by(0) - # - # # good - # expect { run }.not_to change(Foo, :bar) - # expect { run }.not_to change { Foo.bar } - # - # # good - compound expectations - # define_negated_matcher :not_change, :change - # expect { run } - # .to not_change(Foo, :bar) - # .and not_change(Foo, :baz) - # expect { run } - # .to not_change { Foo.bar } - # .and not_change { Foo.baz } - # - # @example NegatedMatcher: not_change - # # bad (support autocorrection to good case) - # expect { run } - # .to change(Foo, :bar).by(0) - # .and change(Foo, :baz).by(0) - # expect { run } - # .to change { Foo.bar }.by(0) - # .and change { Foo.baz }.by(0) - # - # # good - # define_negated_matcher :not_change, :change - # expect { run } - # .to not_change(Foo, :bar) - # .and not_change(Foo, :baz) - # expect { run } - # .to not_change { Foo.bar } - # .and not_change { Foo.baz } - # - class ChangeByZero < Base - extend AutoCorrector - MSG = 'Prefer `not_to change` over `to change.by(0)`.' - MSG_COMPOUND = 'Prefer %s with compound expectations ' \ - 'over `change.by(0)`.' - RESTRICT_ON_SEND = %i[change].freeze - - # @!method expect_change_with_arguments(node) - def_node_matcher :expect_change_with_arguments, <<-PATTERN - (send - (send nil? :change ...) :by - (int 0)) - PATTERN - - # @!method expect_change_with_block(node) - def_node_matcher :expect_change_with_block, <<-PATTERN - (send - (block - (send nil? :change) - (args) - (send (...) $_)) :by - (int 0)) - PATTERN - - # @!method change_nodes(node) - def_node_search :change_nodes, <<-PATTERN - $(send nil? :change ...) - PATTERN - - def on_send(node) - expect_change_with_arguments(node.parent) do - check_offense(node.parent) - end - - expect_change_with_block(node.parent.parent) do - check_offense(node.parent.parent) - end - end - - private - - def check_offense(node) - expression = node.source_range - if compound_expectations?(node) - add_offense(expression, message: message_compound) do |corrector| - autocorrect_compound(corrector, node) - end - else - add_offense(expression) do |corrector| - autocorrect(corrector, node) - end - end - end - - def compound_expectations?(node) - %i[and or & |].include?(node.parent.method_name) - end - - def autocorrect(corrector, node) - corrector.replace(node.parent.loc.selector, 'not_to') - range = node.loc.dot.with(end_pos: node.source_range.end_pos) - corrector.remove(range) - end - - def autocorrect_compound(corrector, node) - return unless negated_matcher - - change_nodes(node) do |change_node| - corrector.replace(change_node.loc.selector, negated_matcher) - range = node.loc.dot.with(end_pos: node.source_range.end_pos) - corrector.remove(range) - end - end - - def negated_matcher - cop_config['NegatedMatcher'] - end - - def message_compound - format(MSG_COMPOUND, preferred: preferred_method) - end - - def preferred_method - negated_matcher ? "`#{negated_matcher}`" : 'negated matchers' - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/class_check.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/class_check.rb deleted file mode 100644 index 5e426d5d2398d3..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/class_check.rb +++ /dev/null @@ -1,101 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Enforces consistent use of `be_a` or `be_kind_of`. - # - # @example EnforcedStyle: be_a (default) - # # bad - # expect(object).to be_kind_of(String) - # expect(object).to be_a_kind_of(String) - # - # # good - # expect(object).to be_a(String) - # expect(object).to be_an(String) - # - # @example EnforcedStyle: be_kind_of - # # bad - # expect(object).to be_a(String) - # expect(object).to be_an(String) - # - # # good - # expect(object).to be_kind_of(String) - # expect(object).to be_a_kind_of(String) - # - class ClassCheck < Base - extend AutoCorrector - include ConfigurableEnforcedStyle - - MSG = 'Prefer `%s` over `%s`.' - - METHOD_NAMES_FOR_BE_A = ::Set[ - :be_a, - :be_an - ].freeze - - METHOD_NAMES_FOR_KIND_OF = ::Set[ - :be_a_kind_of, - :be_kind_of - ].freeze - - PREFERRED_METHOD_NAME_BY_STYLE = { - be_a: :be_a, - be_kind_of: :be_kind_of - }.freeze - - RESTRICT_ON_SEND = %i[ - be_a - be_a_kind_of - be_an - be_kind_of - ].freeze - - def on_send(node) - return unless offending?(node) - - add_offense( - node.loc.selector, - message: format_message(node) - ) do |corrector| - autocorrect(corrector, node) - end - end - - private - - def autocorrect(corrector, node) - corrector.replace(node.loc.selector, preferred_method_name) - end - - def format_message(node) - format( - MSG, - current: node.method_name, - preferred: preferred_method_name - ) - end - - def offending?(node) - !node.receiver && !preferred_method_name?(node.method_name) - end - - def preferred_method_name?(method_name) - preferred_method_names.include?(method_name) - end - - def preferred_method_name - PREFERRED_METHOD_NAME_BY_STYLE[style] - end - - def preferred_method_names - if style == :be_a - METHOD_NAMES_FOR_BE_A - else - METHOD_NAMES_FOR_KIND_OF - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/contain_exactly.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/contain_exactly.rb deleted file mode 100644 index 65eb8742f9710a..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/contain_exactly.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks where `contain_exactly` is used. - # - # This cop checks for the following: - # - Prefer `match_array` when matching array values. - # - Prefer `be_empty` when using `contain_exactly` with no arguments. - # - # @example - # # bad - # it { is_expected.to contain_exactly(*array1, *array2) } - # - # # good - # it { is_expected.to match_array(array1 + array2) } - # - # # good - # it { is_expected.to contain_exactly(content, *array) } - # - class ContainExactly < Base - extend AutoCorrector - - MSG = 'Prefer `match_array` when matching array values.' - RESTRICT_ON_SEND = %i[contain_exactly].freeze - - def on_send(node) - return if node.arguments.empty? - - check_populated_collection(node) - end - - private - - def check_populated_collection(node) - return unless node.each_child_node.all?(&:splat_type?) - - add_offense(node) do |corrector| - autocorrect_for_populated_array(node, corrector) - end - end - - def autocorrect_for_populated_array(node, corrector) - arrays = node.arguments.map do |splat_node| - splat_node.children.first - end - corrector.replace( - node, - "match_array(#{arrays.map(&:source).join(' + ')})" - ) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/context_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/context_method.rb deleted file mode 100644 index f0f743608efeae..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/context_method.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # `context` should not be used for specifying methods. - # - # @example - # # bad - # context '#foo_bar' do - # # ... - # end - # - # context '.foo_bar' do - # # ... - # end - # - # # good - # describe '#foo_bar' do - # # ... - # end - # - # describe '.foo_bar' do - # # ... - # end - # - class ContextMethod < Base - extend AutoCorrector - - MSG = 'Use `describe` for testing methods.' - - # @!method context_method(node) - def_node_matcher :context_method, <<-PATTERN - (block - (send #rspec? :context - ${(str #method_name?) (dstr (str #method_name?) ...)} - ...) - ...) - PATTERN - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - context_method(node) do |context| - add_offense(context) do |corrector| - corrector.replace(node.send_node.loc.selector, 'describe') - end - end - end - - private - - def method_name?(description) - description.start_with?('.', '#') - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/context_wording.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/context_wording.rb deleted file mode 100644 index 3eed1058f63ae5..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/context_wording.rb +++ /dev/null @@ -1,117 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks that `context` docstring starts with an allowed prefix. - # - # The default list of prefixes is minimal. Users are encouraged to tailor - # the configuration to meet project needs. Other acceptable prefixes may - # include `if`, `unless`, `for`, `before`, `after`, or `during`. - # They may consist of multiple words if desired. - # - # @see http://www.betterspecs.org/#contexts - # - # @example `Prefixes` configuration - # # .rubocop.yml - # # RSpec/ContextWording: - # # Prefixes: - # # - when - # # - with - # # - without - # # - if - # # - unless - # # - for - # - # @example - # # bad - # context 'the display name not present' do - # # ... - # end - # - # # good - # context 'when the display name is not present' do - # # ... - # end - # - # This cop can be customized allowed context description pattern - # with `AllowedPatterns`. By default, there are no checking by pattern. - # - # @example `AllowedPatterns` configuration - # - # # .rubocop.yml - # # RSpec/ContextWording: - # # AllowedPatterns: - # # - とき$ - # - # @example - # # bad - # context '条件を満たす' do - # # ... - # end - # - # # good - # context '条件を満たすとき' do - # # ... - # end - # - class ContextWording < Base - include AllowedPattern - - MSG = 'Context description should match %s.' - - # @!method context_wording(node) - def_node_matcher :context_wording, <<-PATTERN - (block (send #rspec? { :context :shared_context } $({str dstr xstr} ...) ...) ...) - PATTERN - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - context_wording(node) do |context| - if bad_pattern?(context) - message = format(MSG, patterns: expect_patterns) - add_offense(context, message: message) - end - end - end - - private - - def allowed_patterns - super + prefix_regexes - end - - def prefix_regexes - @prefix_regexes ||= prefixes.map { |pre| /^#{Regexp.escape(pre)}\b/ } - end - - def bad_pattern?(node) - return false if allowed_patterns.empty? - - !matches_allowed_pattern?(description(node)) - end - - def description(context) - if context.xstr_type? - context.value.value - else - context.value - end - end - - def expect_patterns - inspected = allowed_patterns.map do |pattern| - pattern.inspect.gsub(/\A"|"\z/, '/') - end - return inspected.first if inspected.size == 1 - - inspected << "or #{inspected.pop}" - inspected.join(', ') - end - - def prefixes - Array(cop_config.fetch('Prefixes', [])) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/describe_class.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/describe_class.rb deleted file mode 100644 index ab358678a2b0da..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/describe_class.rb +++ /dev/null @@ -1,85 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Check that the first argument to the top-level describe is a constant. - # - # It can be configured to ignore strings when certain metadata is passed. - # - # Ignores Rails and Aruba `type` metadata by default. - # - # @example `IgnoredMetadata` configuration - # # .rubocop.yml - # # RSpec/DescribeClass: - # # IgnoredMetadata: - # # type: - # # - request - # # - controller - # - # @example - # # bad - # describe 'Do something' do - # end - # - # # good - # describe TestedClass do - # subject { described_class } - # end - # - # describe 'TestedClass::VERSION' do - # subject { Object.const_get(self.class.description) } - # end - # - # describe "A feature example", type: :feature do - # end - # - class DescribeClass < Base - include TopLevelGroup - - MSG = 'The first argument to describe should be ' \ - 'the class or module being tested.' - - # @!method example_group_with_ignored_metadata?(node) - def_node_matcher :example_group_with_ignored_metadata?, <<~PATTERN - (send #rspec? :describe ... (hash <#ignored_metadata? ...>)) - PATTERN - - # @!method not_a_const_described(node) - def_node_matcher :not_a_const_described, <<~PATTERN - (send #rspec? :describe $[!const !#string_constant?] ...) - PATTERN - - # @!method sym_pair(node) - def_node_matcher :sym_pair, <<~PATTERN - (pair $sym $sym) - PATTERN - - def on_top_level_group(node) - return if example_group_with_ignored_metadata?(node.send_node) - - not_a_const_described(node.send_node) do |described| - add_offense(described) - end - end - - private - - def ignored_metadata?(node) - sym_pair(node) do |key, value| - ignored_metadata[key.value.to_s].to_a.include?(value.value.to_s) - end - end - - def string_constant?(described) - described.str_type? && - described.value.match?(/^(?:(?:::)?[A-Z]\w*)+$/) - end - - def ignored_metadata - cop_config['IgnoredMetadata'] || {} - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/describe_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/describe_method.rb deleted file mode 100644 index eecc763af44390..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/describe_method.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks that the second argument to `describe` specifies a method. - # - # @example - # # bad - # describe MyClass, 'do something' do - # end - # - # # good - # describe MyClass, '#my_instance_method' do - # end - # - # describe MyClass, '.my_class_method' do - # end - # - class DescribeMethod < Base - include TopLevelGroup - - MSG = 'The second argument to describe should be the method ' \ - "being tested. '#instance' or '.class'." - - # @!method second_string_literal_argument(node) - def_node_matcher :second_string_literal_argument, <<~PATTERN - (block - (send #rspec? :describe _first_argument ${str dstr} ...) - ...) - PATTERN - - # @!method method_name?(node) - def_node_matcher :method_name?, <<~PATTERN - {(str #method_name_prefix?) (dstr (str #method_name_prefix?) ...)} - PATTERN - - def on_top_level_group(node) - second_string_literal_argument(node) do |argument| - add_offense(argument) unless method_name?(argument) - end - end - - private - - def method_name_prefix?(description) - description.start_with?('.', '#') - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/describe_symbol.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/describe_symbol.rb deleted file mode 100644 index 09c8220ac549c2..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/describe_symbol.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Avoid describing symbols. - # - # @example - # # bad - # describe :my_method do - # # ... - # end - # - # # good - # describe '#my_method' do - # # ... - # end - # - # @see https://github.com/rspec/rspec-core/issues/1610 - class DescribeSymbol < Base - MSG = 'Avoid describing symbols.' - RESTRICT_ON_SEND = %i[describe].freeze - - # @!method describe_symbol?(node) - def_node_matcher :describe_symbol?, <<-PATTERN - (send #rspec? :describe $sym ...) - PATTERN - - def on_send(node) - describe_symbol?(node) do |match| - add_offense(match) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/described_class.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/described_class.rb deleted file mode 100644 index 1e4efaac7ddfc9..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/described_class.rb +++ /dev/null @@ -1,209 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks that tests use `described_class`. - # - # If the first argument of describe is a class, the class is exposed to - # each example via described_class. - # - # This cop can be configured using the `EnforcedStyle` and `SkipBlocks` - # options. - # - # @example `EnforcedStyle: described_class` (default) - # # bad - # describe MyClass do - # subject { MyClass.do_something } - # end - # - # # good - # describe MyClass do - # subject { described_class.do_something } - # end - # - # @example `EnforcedStyle: explicit` - # # bad - # describe MyClass do - # subject { described_class.do_something } - # end - # - # # good - # describe MyClass do - # subject { MyClass.do_something } - # end - # - # There's a known caveat with rspec-rails's `controller` helper that - # runs its block in a different context, and `described_class` is not - # available to it. `SkipBlocks` option excludes detection in all - # non-RSpec related blocks. - # - # To narrow down this setting to only a specific directory, it is - # possible to use an overriding configuration file local to that - # directory. - # - # @example `SkipBlocks: true` - # # spec/controllers/.rubocop.yml - # # RSpec/DescribedClass: - # # SkipBlocks: true - # - # # acceptable - # describe MyConcern do - # controller(ApplicationController) do - # include MyConcern - # end - # end - # - class DescribedClass < Base - extend AutoCorrector - include ConfigurableEnforcedStyle - include Namespace - - DESCRIBED_CLASS = 'described_class' - MSG = 'Use `%s` instead of `%s`.' - - # @!method common_instance_exec_closure?(node) - def_node_matcher :common_instance_exec_closure?, <<-PATTERN - (block (send (const nil? {:Class :Module :Struct}) :new ...) ...) - PATTERN - - # @!method rspec_block?(node) - def_node_matcher :rspec_block?, - '({block numblock} (send #rspec? #ALL.all ...) ...)' - - # @!method scope_changing_syntax?(node) - def_node_matcher :scope_changing_syntax?, '{def class module}' - - # @!method described_constant(node) - def_node_matcher :described_constant, <<-PATTERN - (block (send _ :describe $(const ...) ...) (args) $_) - PATTERN - - # @!method contains_described_class?(node) - def_node_search :contains_described_class?, - '(send nil? :described_class)' - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - # In case the explicit style is used, we need to remember what's - # being described. - @described_class, body = described_constant(node) - - return unless body - - find_usage(body) do |match| - msg = message(match.const_name) - add_offense(match, message: msg) do |corrector| - autocorrect(corrector, match) - end - end - end - - private - - def autocorrect(corrector, match) - replacement = if style == :described_class - DESCRIBED_CLASS - else - @described_class.const_name - end - - corrector.replace(match, replacement) - end - - def find_usage(node, &block) - yield(node) if offensive?(node) - - return if scope_change?(node) || node.const_type? - - node.each_child_node do |child| - find_usage(child, &block) - end - end - - def message(offense) - if style == :described_class - format(MSG, replacement: DESCRIBED_CLASS, src: offense) - else - format(MSG, replacement: @described_class.const_name, - src: DESCRIBED_CLASS) - end - end - - def scope_change?(node) - scope_changing_syntax?(node) || - common_instance_exec_closure?(node) || - skippable_block?(node) - end - - def skippable_block?(node) - node.block_type? && !rspec_block?(node) && cop_config['SkipBlocks'] - end - - def offensive?(node) - if style == :described_class - offensive_described_class?(node) - else - node.send_type? && node.method?(:described_class) - end - end - - def offensive_described_class?(node) - return unless node.const_type? - - # E.g. `described_class::CONSTANT` - return if contains_described_class?(node) - - nearest_described_class, = node.each_ancestor(:block) - .map { |ancestor| described_constant(ancestor) }.find(&:itself) - - return if nearest_described_class.equal?(node) - - full_const_name(nearest_described_class) == full_const_name(node) - end - - def full_const_name(node) - symbolized_namespace = namespace(node).map(&:to_sym) - collapse_namespace(symbolized_namespace, const_name(node)) - end - - # @param namespace [Array] - # @param const [Array] - # @return [Array] - # @example - # # nil represents base constant - # collapse_namespace([], [:C]) # => [:C] - # collapse_namespace([:A, :B], [:C]) # => [:A, :B, :C] - # collapse_namespace([:A, :B], [:B, :C]) # => [:A, :B, :C] - # collapse_namespace([:A, :B], [nil, :C]) # => [nil, :C] - # collapse_namespace([:A, :B], [nil, :B, :C]) # => [nil, :B, :C] - def collapse_namespace(namespace, const) - return const if namespace.empty? || const.first.nil? - - start = [0, (namespace.length - const.length)].max - max = namespace.length - intersection = (start..max).find do |shift| - namespace[shift, max - shift] == const[0, max - shift] - end - [*namespace[0, intersection], *const] - end - - # @param node [RuboCop::AST::Node] - # @return [Array] - # @example - # const_name(s(:const, nil, :C)) # => [:C] - # const_name(s(:const, s(:const, nil, :M), :C)) # => [:M, :C] - # const_name(s(:const, s(:cbase), :C)) # => [nil, :C] - def const_name(node) - namespace, name = *node # rubocop:disable InternalAffairs/NodeDestructuring - if !namespace - [name] - elsif namespace.const_type? - [*const_name(namespace), name] - elsif %i[lvar cbase send].include?(namespace.type) - [nil, name] - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/described_class_module_wrapping.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/described_class_module_wrapping.rb deleted file mode 100644 index 263bec6731cf56..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/described_class_module_wrapping.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Avoid opening modules and defining specs within them. - # - # @example - # # bad - # module MyModule - # RSpec.describe MyClass do - # # ... - # end - # end - # - # # good - # RSpec.describe MyModule::MyClass do - # # ... - # end - # - # @see https://github.com/rubocop/rubocop-rspec/issues/735 - class DescribedClassModuleWrapping < Base - MSG = 'Avoid opening modules and defining specs within them.' - - # @!method include_rspec_blocks?(node) - def_node_search :include_rspec_blocks?, <<~PATTERN - ({block numblock} (send #explicit_rspec? #ExampleGroups.all ...) ...) - PATTERN - - def on_module(node) - return unless include_rspec_blocks?(node) - - add_offense(node) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/dialect.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/dialect.rb deleted file mode 100644 index 7140541c4a25d0..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/dialect.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Enforces custom RSpec dialects. - # - # A dialect can be based on the following RSpec methods: - # - # - describe, context, feature, example_group - # - xdescribe, xcontext, xfeature - # - fdescribe, fcontext, ffeature - # - shared_examples, shared_examples_for, shared_context - # - it, specify, example, scenario, its - # - fit, fspecify, fexample, fscenario, focus - # - xit, xspecify, xexample, xscenario, skip - # - pending - # - prepend_before, before, append_before, - # - around - # - prepend_after, after, append_after - # - let, let! - # - subject, subject! - # - expect, is_expected, expect_any_instance_of - # - # By default all of the RSpec methods and aliases are allowed. By setting - # a config like: - # - # RSpec/Dialect: - # PreferredMethods: - # context: describe - # - # You can expect the following behavior: - # - # @example - # # bad - # context 'display name presence' do - # # ... - # end - # - # # good - # describe 'display name presence' do - # # ... - # end - # - class Dialect < Base - extend AutoCorrector - include MethodPreference - - MSG = 'Prefer `%s` over `%s`.' - - # @!method rspec_method?(node) - def_node_matcher :rspec_method?, '(send #rspec? #ALL.all ...)' - - def on_send(node) - return unless rspec_method?(node) - return unless preferred_methods[node.method_name] - - msg = format(MSG, prefer: preferred_method(node.method_name), - current: node.method_name) - - add_offense(node, message: msg) do |corrector| - current = node.loc.selector - preferred = preferred_method(current.source) - - corrector.replace(current, preferred) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/duplicated_metadata.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/duplicated_metadata.rb deleted file mode 100644 index 1c58dd60ce2f8e..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/duplicated_metadata.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Avoid duplicated metadata. - # - # @example - # # bad - # describe 'Something', :a, :a - # - # # good - # describe 'Something', :a - class DuplicatedMetadata < Base - extend AutoCorrector - - include Metadata - include RangeHelp - - MSG = 'Avoid duplicated metadata.' - - def on_metadata(symbols, _pairs) - symbols.each do |symbol| - on_metadata_symbol(symbol) - end - end - - private - - def on_metadata_symbol(node) - return unless duplicated?(node) - - add_offense(node) do |corrector| - autocorrect(corrector, node) - end - end - - def autocorrect(corrector, node) - corrector.remove( - range_with_surrounding_comma( - range_with_surrounding_space( - node.source_range, - side: :left - ), - :left - ) - ) - end - - def duplicated?(node) - node.left_siblings.any? do |sibling| - sibling.eql?(node) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_example_group.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_example_group.rb deleted file mode 100644 index b626b23d654c73..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_example_group.rb +++ /dev/null @@ -1,184 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks if an example group does not include any tests. - # - # @example usage - # # bad - # describe Bacon do - # let(:bacon) { Bacon.new(chunkiness) } - # let(:chunkiness) { false } - # - # context 'extra chunky' do # flagged by rubocop - # let(:chunkiness) { true } - # end - # - # it 'is chunky' do - # expect(bacon.chunky?).to be_truthy - # end - # end - # - # # good - # describe Bacon do - # let(:bacon) { Bacon.new(chunkiness) } - # let(:chunkiness) { false } - # - # it 'is chunky' do - # expect(bacon.chunky?).to be_truthy - # end - # end - # - # # good - # describe Bacon do - # pending 'will add tests later' - # end - # - class EmptyExampleGroup < Base - extend AutoCorrector - - include RangeHelp - - MSG = 'Empty example group detected.' - - # @!method example_group_body(node) - # Match example group blocks and yield their body - # - # @example source that matches - # describe 'example group' do - # it { is_expected.to be } - # end - # - # @param node [RuboCop::AST::Node] - # @yield [RuboCop::AST::Node] example group body - def_node_matcher :example_group_body, <<~PATTERN - (block (send #rspec? #ExampleGroups.all ...) args $_) - PATTERN - - # @!method example_or_group_or_include?(node) - # Match examples, example groups and includes - # - # @example source that matches - # it { is_expected.to fly } - # describe('non-empty example groups too') { } - # it_behaves_like 'an animal' - # it_behaves_like('a cat') { let(:food) { 'milk' } } - # it_has_root_access - # skip - # it 'will be implemented later' - # - # @param node [RuboCop::AST::Node] - # @return [Array] matching nodes - def_node_matcher :example_or_group_or_include?, <<~PATTERN - { - (block - (send #rspec? {#Examples.all #ExampleGroups.all #Includes.all} ...) - ...) - (send nil? {#Examples.all #Includes.all} ...) - } - PATTERN - - # @!method examples_inside_block?(node) - # Match examples defined inside a block which is not a hook - # - # @example source that matches - # %w(r g b).each do |color| - # it { is_expected.to have_color(color) } - # end - # - # @example source that does not match - # before do - # it { is_expected.to fall_into_oblivion } - # end - # - # @param node [RuboCop::AST::Node] - # @return [Array] matching nodes - def_node_matcher :examples_inside_block?, <<~PATTERN - (block !(send nil? #Hooks.all ...) _ #examples?) - PATTERN - - # @!method examples_directly_or_in_block?(node) - # Match examples or examples inside blocks - # - # @example source that matches - # it { expect(drink).to be_cold } - # context('when winter') { it { expect(drink).to be_hot } } - # (1..5).each { |divisor| it { is_expected.to divide_by(divisor) } } - # - # @param node [RuboCop::AST::Node] - # @return [Array] matching nodes - def_node_matcher :examples_directly_or_in_block?, <<~PATTERN - { - #example_or_group_or_include? - #examples_inside_block? - } - PATTERN - - # @!method examples?(node) - # Matches examples defined in scopes where they could run - # - # @example source that matches - # it { expect(myself).to be_run } - # describe { it { i_run_as_well } } - # - # @example source that does not match - # before { it { whatever here won't run anyway } } - # - # @param node [RuboCop::AST::Node] - # @return [Array] matching nodes - def_node_matcher :examples?, <<~PATTERN - { - #examples_directly_or_in_block? - (begin <#examples_directly_or_in_block? ...>) - } - PATTERN - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - return if node.each_ancestor(:def, :defs).any? - return if node.each_ancestor(:block).any? { |block| example?(block) } - - example_group_body(node) do |body| - next unless offensive?(body) - - add_offense(node.send_node) do |corrector| - corrector.remove(removed_range(node)) - end - end - end - - private - - def offensive?(body) - return true unless body - return false if conditionals_with_examples?(body) - - if body.if_type? || body.case_type? - !examples_in_branches?(body) - else - !examples?(body) - end - end - - def conditionals_with_examples?(body) - return unless body.begin_type? || body.case_type? - - body.each_descendant(:if, :case).any? do |condition_node| - examples_in_branches?(condition_node) - end - end - - def examples_in_branches?(condition_node) - condition_node.branches.any? { |branch| examples?(branch) } - end - - def removed_range(node) - range_by_whole_lines( - node.source_range, - include_final_newline: true - ) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_hook.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_hook.rb deleted file mode 100644 index fa6c63884f3dc9..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_hook.rb +++ /dev/null @@ -1,49 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks for empty before and after hooks. - # - # @example - # # bad - # before {} - # after do; end - # before(:all) do - # end - # after(:all) { } - # - # # good - # before { create_users } - # after do - # cleanup_users - # end - # before(:all) do - # create_feed - # end - # after(:all) { cleanup_feed } - # - class EmptyHook < Base - extend AutoCorrector - include RuboCop::Cop::RangeHelp - - MSG = 'Empty hook detected.' - - # @!method empty_hook?(node) - def_node_matcher :empty_hook?, <<~PATTERN - (block $(send nil? #Hooks.all ...) _ nil?) - PATTERN - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - empty_hook?(node) do |hook| - add_offense(hook) do |corrector| - corrector.remove( - range_with_surrounding_space(node.source_range, side: :left) - ) - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_example.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_example.rb deleted file mode 100644 index caf4a5eee4eb51..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_example.rb +++ /dev/null @@ -1,82 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks if there is an empty line after example blocks. - # - # @example - # # bad - # RSpec.describe Foo do - # it 'does this' do - # end - # it 'does that' do - # end - # end - # - # # good - # RSpec.describe Foo do - # it 'does this' do - # end - # - # it 'does that' do - # end - # end - # - # # fair - it's ok to have non-separated one-liners - # RSpec.describe Foo do - # it { one } - # it { two } - # end - # - # @example with AllowConsecutiveOneLiners configuration - # # rubocop.yml - # # RSpec/EmptyLineAfterExample: - # # AllowConsecutiveOneLiners: false - # - # # bad - # RSpec.describe Foo do - # it { one } - # it { two } - # end - # - class EmptyLineAfterExample < Base - extend AutoCorrector - include EmptyLineSeparation - - MSG = 'Add an empty line after `%s`.' - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - return unless example?(node) - return if allowed_one_liner?(node) - - missing_separating_line_offense(node) do |method| - format(MSG, example: method) - end - end - - private - - def allowed_one_liner?(node) - consecutive_one_liner?(node) && allow_consecutive_one_liners? - end - - def allow_consecutive_one_liners? - cop_config['AllowConsecutiveOneLiners'] - end - - def consecutive_one_liner?(node) - node.single_line? && next_one_line_example?(node) - end - - def next_one_line_example?(node) - next_sibling = node.right_sibling - return unless next_sibling - return unless example?(next_sibling) - - next_sibling.single_line? - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_example_group.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_example_group.rb deleted file mode 100644 index d7dadc35a9ba06..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_example_group.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks if there is an empty line after example group blocks. - # - # @example - # # bad - # RSpec.describe Foo do - # describe '#bar' do - # end - # describe '#baz' do - # end - # end - # - # # good - # RSpec.describe Foo do - # describe '#bar' do - # end - # - # describe '#baz' do - # end - # end - # - class EmptyLineAfterExampleGroup < Base - extend AutoCorrector - include EmptyLineSeparation - - MSG = 'Add an empty line after `%s`.' - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - return unless spec_group?(node) - - missing_separating_line_offense(node) do |method| - format(MSG, example_group: method) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_final_let.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_final_let.rb deleted file mode 100644 index 72f0fc18564d98..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_final_let.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks if there is an empty line after the last let block. - # - # @example - # # bad - # let(:foo) { bar } - # let(:something) { other } - # it { does_something } - # - # # good - # let(:foo) { bar } - # let(:something) { other } - # - # it { does_something } - # - class EmptyLineAfterFinalLet < Base - extend AutoCorrector - include EmptyLineSeparation - - MSG = 'Add an empty line after the last `%s`.' - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - return unless example_group_with_body?(node) - - final_let = node.body.child_nodes.reverse.find { |child| let?(child) } - - return if final_let.nil? - - missing_separating_line_offense(final_let) do |method| - format(MSG, let: method) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_hook.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_hook.rb deleted file mode 100644 index cfcd8d30af105e..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_hook.rb +++ /dev/null @@ -1,82 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks if there is an empty line after hook blocks. - # - # `AllowConsecutiveOneLiners` configures whether adjacent - # one-line definitions are considered an offense. - # - # @example - # # bad - # before { do_something } - # it { does_something } - # - # # bad - # after { do_something } - # it { does_something } - # - # # bad - # around { |test| test.run } - # it { does_something } - # - # # good - # after { do_something } - # - # it { does_something } - # - # # fair - it's ok to have non-separated one-liners hooks - # around { |test| test.run } - # after { do_something } - # - # it { does_something } - # - # @example with AllowConsecutiveOneLiners configuration - # # rubocop.yml - # # RSpec/EmptyLineAfterHook: - # # AllowConsecutiveOneLiners: false - # - # # bad - # around { |test| test.run } - # after { do_something } - # - # it { does_something } - # - # # good - # around { |test| test.run } - # - # after { do_something } - # - # it { does_something } - # - class EmptyLineAfterHook < Base - extend AutoCorrector - include ConfigurableEnforcedStyle - include EmptyLineSeparation - - MSG = 'Add an empty line after `%s`.' - - def on_block(node) - return unless hook?(node) - return if cop_config['AllowConsecutiveOneLiners'] && - chained_single_line_hooks?(node) - - missing_separating_line_offense(node) do |method| - format(MSG, hook: method) - end - end - - alias on_numblock on_block - - private - - def chained_single_line_hooks?(node) - next_node = node.right_sibling - - hook?(next_node) && node.single_line? && next_node.single_line? - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_subject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_subject.rb deleted file mode 100644 index f232e3fa5609d8..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/empty_line_after_subject.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks if there is an empty line after subject block. - # - # @example - # # bad - # subject(:obj) { described_class } - # let(:foo) { bar } - # - # # good - # subject(:obj) { described_class } - # - # let(:foo) { bar } - # - class EmptyLineAfterSubject < Base - extend AutoCorrector - include EmptyLineSeparation - include InsideExampleGroup - - MSG = 'Add an empty line after `%s`.' - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - return unless subject?(node) - return unless inside_example_group?(node) - - missing_separating_line_offense(node) do |method| - format(MSG, subject: method) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/example_length.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/example_length.rb deleted file mode 100644 index 2796ef042044bb..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/example_length.rb +++ /dev/null @@ -1,70 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks for long examples. - # - # A long example is usually more difficult to understand. Consider - # extracting out some behavior, e.g. with a `let` block, or a helper - # method. - # - # @example - # # bad - # it do - # service = described_class.new - # more_setup - # more_setup - # result = service.call - # expect(result).to be(true) - # end - # - # # good - # it do - # service = described_class.new - # result = service.call - # expect(result).to be(true) - # end - # - # You can set literals you want to fold with `CountAsOne`. - # Available are: 'array', 'hash', and 'heredoc'. Each literal - # will be counted as one line regardless of its actual size. - # - # @example CountAsOne: ['array', 'heredoc'] - # - # it do - # array = [ # +1 - # 1, - # 2 - # ] - # - # hash = { # +3 - # key: 'value' - # } - # - # msg = <<~HEREDOC # +1 - # Heredoc - # content. - # HEREDOC - # end # 5 points - # - class ExampleLength < Base - include CodeLength - - LABEL = 'Example' - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - return unless example?(node) - - check_code_length(node) - end - - private - - def cop_label - LABEL - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/example_without_description.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/example_without_description.rb deleted file mode 100644 index 8d52098491cfa2..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/example_without_description.rb +++ /dev/null @@ -1,89 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks for examples without a description. - # - # RSpec allows for auto-generated example descriptions when there is no - # description provided or the description is an empty one. - # - # This cop removes empty descriptions. - # It also defines whether auto-generated description is allowed, based - # on the configured style. - # - # This cop can be configured using the `EnforcedStyle` option - # - # @example `EnforcedStyle: always_allow` (default) - # # bad - # it('') { is_expected.to be_good } - # it '' do - # result = service.call - # expect(result).to be(true) - # end - # - # # good - # it { is_expected.to be_good } - # it do - # result = service.call - # expect(result).to be(true) - # end - # - # @example `EnforcedStyle: single_line_only` - # # bad - # it('') { is_expected.to be_good } - # it do - # result = service.call - # expect(result).to be(true) - # end - # - # # good - # it { is_expected.to be_good } - # - # @example `EnforcedStyle: disallow` - # # bad - # it { is_expected.to be_good } - # it do - # result = service.call - # expect(result).to be(true) - # end - # - class ExampleWithoutDescription < Base - include ConfigurableEnforcedStyle - - MSG_DEFAULT_ARGUMENT = 'Omit the argument when you want to ' \ - 'have auto-generated description.' - MSG_ADD_DESCRIPTION = 'Add a description.' - - # @!method example_description(node) - def_node_matcher :example_description, '(send nil? _ $(str $_))' - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - return unless example?(node) - - check_example_without_description(node.send_node) - - example_description(node.send_node) do |message_node, message| - return unless message.to_s.empty? - - add_offense(message_node, message: MSG_DEFAULT_ARGUMENT) - end - end - - private - - def check_example_without_description(node) - return if node.arguments? - return unless disallow_empty_description?(node) - - add_offense(node, message: MSG_ADD_DESCRIPTION) - end - - def disallow_empty_description?(node) - style == :disallow || - (style == :single_line_only && node.parent.multiline?) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/example_wording.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/example_wording.rb deleted file mode 100644 index 80207f6bbb8242..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/example_wording.rb +++ /dev/null @@ -1,150 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks for common mistakes in example descriptions. - # - # This cop will correct docstrings that begin with 'should' and 'it'. - # This cop will also look for insufficient examples and call them out. - # - # @see http://betterspecs.org/#should - # - # The autocorrect is experimental - use with care! It can be configured - # with CustomTransform (e.g. have => has) and IgnoredWords (e.g. only). - # - # Use the DisallowedExamples setting to prevent unclear or insufficient - # descriptions. Please note that this config will not be treated as - # case sensitive. - # - # @example - # # bad - # it 'should find nothing' do - # end - # - # # good - # it 'finds nothing' do - # end - # - # @example - # # bad - # it 'it does things' do - # end - # - # # good - # it 'does things' do - # end - # - # @example `DisallowedExamples: ['works']` (default) - # # bad - # it 'works' do - # end - # - # # good - # it 'marks the task as done' do - # end - class ExampleWording < Base - extend AutoCorrector - - MSG_SHOULD = 'Do not use should when describing your tests.' - MSG_IT = "Do not repeat 'it' when describing your tests." - MSG_INSUFFICIENT_DESCRIPTION = 'Your example description is ' \ - 'insufficient.' - - SHOULD_PREFIX = /\Ashould(?:n't)?\b/i.freeze - IT_PREFIX = /\Ait /i.freeze - - # @!method it_description(node) - def_node_matcher :it_description, <<-PATTERN - (block (send _ :it ${ - (str $_) - (dstr (str $_ ) ...) - } ...) ...) - PATTERN - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - it_description(node) do |description_node, message| - if message.match?(SHOULD_PREFIX) - add_wording_offense(description_node, MSG_SHOULD) - elsif message.match?(IT_PREFIX) - add_wording_offense(description_node, MSG_IT) - elsif insufficient_docstring?(description_node) - add_offense(docstring(description_node), - message: MSG_INSUFFICIENT_DESCRIPTION) - end - end - end - - private - - def add_wording_offense(node, message) - docstring = docstring(node) - - add_offense(docstring, message: message) do |corrector| - next if node.heredoc? - - corrector.replace(docstring, replacement_text(node)) - end - end - - def docstring(node) - expr = node.source_range - - Parser::Source::Range.new( - expr.source_buffer, - expr.begin_pos + 1, - expr.end_pos - 1 - ) - end - - def replacement_text(node) - text = text(node) - - if text.match?(SHOULD_PREFIX) - RuboCop::RSpec::Wording.new( - text, - ignore: ignored_words, - replace: custom_transform - ).rewrite - else - text.sub(IT_PREFIX, '') - end - end - - # Recursive processing is required to process nested dstr nodes - # that is the case for \-separated multiline strings with interpolation. - def text(node) - case node.type - when :dstr - node.node_parts.map { |child_node| text(child_node) }.join - when :str - node.value - when :begin - node.source - end - end - - def custom_transform - cop_config.fetch('CustomTransform', {}) - end - - def ignored_words - cop_config.fetch('IgnoredWords', []) - end - - def insufficient_docstring?(description_node) - insufficient_examples.include?(preprocess(text(description_node))) - end - - def insufficient_examples - examples = cop_config.fetch('DisallowedExamples', []) - examples.map! { |example| preprocess(example) } - end - - def preprocess(message) - message.strip.squeeze(' ').downcase - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb deleted file mode 100644 index b4f48c370ce60c..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb +++ /dev/null @@ -1,101 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks for excessive whitespace in example descriptions. - # - # @example - # # bad - # it ' has excessive spacing ' do - # end - # - # # good - # it 'has excessive spacing' do - # end - # - # @example - # # bad - # context ' when a condition is met ' do - # end - # - # # good - # context 'when a condition is met' do - # end - # - class ExcessiveDocstringSpacing < Base - extend AutoCorrector - - MSG = 'Excessive whitespace.' - - # @!method example_description(node) - def_node_matcher :example_description, <<-PATTERN - (send _ {#Examples.all #ExampleGroups.all} ${ - $str - $(dstr ({str dstr `sym} ...) ...) - } ...) - PATTERN - - def on_send(node) - example_description(node) do |description_node, message| - return if description_node.heredoc? - - text = text(message) - - return unless excessive_whitespace?(text) - - add_whitespace_offense(description_node, text) - end - end - - private - - # @param text [String] - def excessive_whitespace?(text) - return true if text.start_with?(' ') || text.end_with?(' ') - - text.match?(/[^\n ] +[^ ]/) - end - - # @param text [String] - def strip_excessive_whitespace(text) - text.strip.gsub(/ +/, ' ') - end - - # @param node [RuboCop::AST::Node] - # @param text [String] - def add_whitespace_offense(node, text) - docstring = docstring(node) - corrected = strip_excessive_whitespace(text) - - add_offense(docstring) do |corrector| - corrector.replace(docstring, corrected) - end - end - - def docstring(node) - expr = node.source_range - - Parser::Source::Range.new( - expr.source_buffer, - expr.begin_pos + 1, - expr.end_pos - 1 - ) - end - - # Recursive processing is required to process nested dstr nodes - # that is the case for \-separated multiline strings with interpolation. - def text(node) - case node.type - when :dstr - node.node_parts.map { |child_node| text(child_node) }.join - when :str, :sym - node.value - when :begin - node.source - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/expect_actual.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/expect_actual.rb deleted file mode 100644 index dd368d3be199ce..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/expect_actual.rb +++ /dev/null @@ -1,102 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks for `expect(...)` calls containing literal values. - # - # Autocorrection is performed when the expected is not a literal. - # - # @example - # # bad - # expect(5).to eq(price) - # expect(/foo/).to eq(pattern) - # expect("John").to eq(name) - # - # # good - # expect(price).to eq(5) - # expect(pattern).to eq(/foo/) - # expect(name).to eq("John") - # - # # bad (not supported autocorrection) - # expect(false).to eq(true) - # - class ExpectActual < Base - extend AutoCorrector - - MSG = 'Provide the actual you are testing to `expect(...)`.' - - RESTRICT_ON_SEND = Runners.all - - SIMPLE_LITERALS = %i[ - true - false - nil - int - float - str - sym - complex - rational - regopt - ].freeze - - COMPLEX_LITERALS = %i[ - array - hash - pair - irange - erange - regexp - ].freeze - - SUPPORTED_MATCHERS = %i[eq eql equal be].freeze - - # @!method expect_literal(node) - def_node_matcher :expect_literal, <<~PATTERN - (send - (send nil? :expect $#literal?) - #Runners.all - { - (send (send nil? $:be) :== $_) - (send nil? $_ $_ ...) - } - ) - PATTERN - - def on_send(node) - expect_literal(node) do |actual, matcher, expected| - add_offense(actual.source_range) do |corrector| - next unless SUPPORTED_MATCHERS.include?(matcher) - next if literal?(expected) - - swap(corrector, actual, expected) - end - end - end - - private - - # This is not implement using a NodePattern because it seems - # to not be able to match against an explicit (nil) sexp - def literal?(node) - node && (simple_literal?(node) || complex_literal?(node)) - end - - def simple_literal?(node) - SIMPLE_LITERALS.include?(node.type) - end - - def complex_literal?(node) - COMPLEX_LITERALS.include?(node.type) && - node.each_child_node.all?(&method(:literal?)) - end - - def swap(corrector, actual, expected) - corrector.replace(actual, expected.source) - corrector.replace(expected, actual.source) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/expect_change.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/expect_change.rb deleted file mode 100644 index e723e033a8b262..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/expect_change.rb +++ /dev/null @@ -1,86 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks for consistent style of change matcher. - # - # Enforces either passing object and attribute as arguments to the matcher - # or passing a block that reads the attribute value. - # - # This cop can be configured using the `EnforcedStyle` option. - # - # @example `EnforcedStyle: method_call` (default) - # # bad - # expect { run }.to change { Foo.bar } - # expect { run }.to change { foo.baz } - # - # # good - # expect { run }.to change(Foo, :bar) - # expect { run }.to change(foo, :baz) - # # also good when there are arguments or chained method calls - # expect { run }.to change { Foo.bar(:count) } - # expect { run }.to change { user.reload.name } - # - # @example `EnforcedStyle: block` - # # bad - # expect { run }.to change(Foo, :bar) - # - # # good - # expect { run }.to change { Foo.bar } - # - class ExpectChange < Base - extend AutoCorrector - include ConfigurableEnforcedStyle - - MSG_BLOCK = 'Prefer `change(%s, :%s)`.' - MSG_CALL = 'Prefer `change { %s.%s }`.' - RESTRICT_ON_SEND = %i[change].freeze - - # @!method expect_change_with_arguments(node) - def_node_matcher :expect_change_with_arguments, <<-PATTERN - (send nil? :change $_ ({sym str} $_)) - PATTERN - - # @!method expect_change_with_block(node) - def_node_matcher :expect_change_with_block, <<-PATTERN - (block - (send nil? :change) - (args) - (send - ${ - (send nil? _) # change { user.name } - const # change { User.count } - } - $_ - ) - ) - PATTERN - - def on_send(node) - return unless style == :block - - expect_change_with_arguments(node) do |receiver, message| - msg = format(MSG_CALL, obj: receiver.source, attr: message) - add_offense(node, message: msg) do |corrector| - replacement = "change { #{receiver.source}.#{message} }" - corrector.replace(node, replacement) - end - end - end - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - return unless style == :method_call - - expect_change_with_block(node) do |receiver, message| - msg = format(MSG_BLOCK, obj: receiver.source, attr: message) - add_offense(node, message: msg) do |corrector| - replacement = "change(#{receiver.source}, :#{message})" - corrector.replace(node, replacement) - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/expect_in_hook.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/expect_in_hook.rb deleted file mode 100644 index adfcbeccf4aa12..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/expect_in_hook.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Do not use `expect` in hooks such as `before`. - # - # @example - # # bad - # before do - # expect(something).to eq 'foo' - # end - # - # # bad - # after do - # expect_any_instance_of(Something).to receive(:foo) - # end - # - # # good - # it do - # expect(something).to eq 'foo' - # end - # - class ExpectInHook < Base - MSG = 'Do not use `%s` in `%s` hook' - - # @!method expectation(node) - def_node_search :expectation, '(send nil? #Expectations.all ...)' - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - return unless hook?(node) - return if node.body.nil? - - expectation(node.body) do |expect| - add_offense(expect.loc.selector, - message: message(expect, node)) - end - end - - alias on_numblock on_block - - private - - def message(expect, hook) - format(MSG, expect: expect.method_name, hook: hook.method_name) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/expect_output.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/expect_output.rb deleted file mode 100644 index bc57dcdded3533..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/expect_output.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks for opportunities to use `expect { ... }.to output`. - # - # @example - # # bad - # $stdout = StringIO.new - # my_app.print_report - # $stdout = STDOUT - # expect($stdout.string).to eq('Hello World') - # - # # good - # expect { my_app.print_report }.to output('Hello World').to_stdout - # - class ExpectOutput < Base - MSG = 'Use `expect { ... }.to output(...).to_%s` ' \ - 'instead of mutating $%s.' - - def on_gvasgn(node) - return unless inside_example_scope?(node) - - # rubocop:disable InternalAffairs/NodeDestructuring - variable_name, _rhs = *node - # rubocop:enable InternalAffairs/NodeDestructuring - name = variable_name[1..] - return unless name.eql?('stdout') || name.eql?('stderr') - - add_offense(node.loc.name, message: format(MSG, name: name)) - end - - private - - # Detect if we are inside the scope of a single example - # - # We want to encourage using `expect { ... }.to output` so - # we only care about situations where you would replace with - # an expectation. Therefore, assignments to stderr or stdout - # within a `before(:all)` or otherwise outside of an example - # don't matter. - def inside_example_scope?(node) - return false if node.nil? || example_group?(node) - return true if example?(node) - return RuboCop::RSpec::Hook.new(node).example? if hook?(node) - - inside_example_scope?(node.parent) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb deleted file mode 100644 index 92989bdafd8489..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +++ /dev/null @@ -1,128 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - module FactoryBot - # Always declare attribute values as blocks. - # - # @example - # # bad - # kind [:active, :rejected].sample - # - # # good - # kind { [:active, :rejected].sample } - # - # # bad - # closed_at 1.day.from_now - # - # # good - # closed_at { 1.day.from_now } - # - # # bad - # count 1 - # - # # good - # count { 1 } - # - class AttributeDefinedStatically < ::RuboCop::Cop::Base - extend AutoCorrector - - MSG = 'Use a block to declare attribute values.' - - # @!method value_matcher(node) - def_node_matcher :value_matcher, <<-PATTERN - (send _ !#reserved_method? $...) - PATTERN - - # @!method factory_attributes(node) - def_node_matcher :factory_attributes, <<-PATTERN - (block (send _ #attribute_defining_method? ...) _ { (begin $...) $(send ...) } ) - PATTERN - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - attributes = factory_attributes(node) || [] - attributes = [attributes] unless attributes.is_a?(Array) # rubocop:disable Style/ArrayCoercion, Lint/RedundantCopDisableDirective - - attributes.each do |attribute| - next unless offensive_receiver?(attribute.receiver, node) - next if proc?(attribute) || association?(attribute.first_argument) - - add_offense(attribute) do |corrector| - autocorrect(corrector, attribute) - end - end - end - - private - - def autocorrect(corrector, node) - if node.parenthesized? - autocorrect_replacing_parens(corrector, node) - else - autocorrect_without_parens(corrector, node) - end - end - - def offensive_receiver?(receiver, node) - receiver.nil? || - receiver.self_type? || - receiver_matches_first_block_argument?(receiver, node) - end - - def receiver_matches_first_block_argument?(receiver, node) - first_block_argument = node.arguments.first - - !first_block_argument.nil? && - receiver.lvar_type? && - receiver.node_parts == first_block_argument.node_parts - end - - def proc?(attribute) - value_matcher(attribute).to_a.all?(&:block_pass_type?) - end - - # @!method association?(node) - def_node_matcher :association?, '(hash <(pair (sym :factory) _) ...>)' - - def autocorrect_replacing_parens(corrector, node) - left_braces, right_braces = braces(node) - - corrector.replace(node.location.begin, " #{left_braces}") - corrector.replace(node.location.end, right_braces) - end - - def autocorrect_without_parens(corrector, node) - left_braces, right_braces = braces(node) - - argument = node.first_argument - expression = argument.source_range - corrector.insert_before(expression, left_braces) - corrector.insert_after(expression, right_braces) - end - - def braces(node) - if value_hash_without_braces?(node.first_argument) - ['{ { ', ' } }'] - else - ['{ ', ' }'] - end - end - - def value_hash_without_braces?(node) - node.hash_type? && !node.braces? - end - - def reserved_method?(method_name) - RuboCop::RSpec::FactoryBot.reserved_methods.include?(method_name) - end - - def attribute_defining_method?(method_name) - RuboCop::RSpec::FactoryBot.attribute_defining_methods - .include?(method_name) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/consistent_parentheses_style.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/consistent_parentheses_style.rb deleted file mode 100644 index e015a9973e7f83..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/consistent_parentheses_style.rb +++ /dev/null @@ -1,117 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - module FactoryBot - # Use a consistent style for parentheses in factory bot calls. - # - # @example - # - # # bad - # create :user - # build(:user) - # create(:login) - # create :login - # - # @example `EnforcedStyle: require_parentheses` (default) - # - # # good - # create(:user) - # create(:user) - # create(:login) - # build(:login) - # - # @example `EnforcedStyle: omit_parentheses` - # - # # good - # create :user - # build :user - # create :login - # create :login - # - # # also good - # # when method name and first argument are not on same line - # create( - # :user - # ) - # build( - # :user, - # name: 'foo' - # ) - # - class ConsistentParenthesesStyle < ::RuboCop::Cop::Base - extend AutoCorrector - include ConfigurableEnforcedStyle - include RuboCop::RSpec::FactoryBot::Language - include RuboCop::Cop::Util - - def self.autocorrect_incompatible_with - [Style::MethodCallWithArgsParentheses] - end - - MSG_REQUIRE_PARENS = 'Prefer method call with parentheses' - MSG_OMIT_PARENS = 'Prefer method call without parentheses' - - FACTORY_CALLS = RuboCop::RSpec::FactoryBot::Language::METHODS - - RESTRICT_ON_SEND = FACTORY_CALLS - - # @!method factory_call(node) - def_node_matcher :factory_call, <<-PATTERN - (send - {#factory_bot? nil?} %FACTORY_CALLS - {sym str send lvar} _* - ) - PATTERN - - def on_send(node) - return if ambiguous_without_parentheses?(node) - - factory_call(node) do - return if node.method?(:generate) && node.arguments.count > 1 - - if node.parenthesized? - process_with_parentheses(node) - else - process_without_parentheses(node) - end - end - end - - private - - def process_with_parentheses(node) - return unless style == :omit_parentheses - return unless same_line?(node, node.first_argument) - - add_offense(node.loc.selector, - message: MSG_OMIT_PARENS) do |corrector| - remove_parentheses(corrector, node) - end - end - - def process_without_parentheses(node) - return unless style == :require_parentheses - - add_offense(node.loc.selector, - message: MSG_REQUIRE_PARENS) do |corrector| - add_parentheses(node, corrector) - end - end - - AMBIGUOUS_TYPES = %i[send pair array and or if].freeze - - def ambiguous_without_parentheses?(node) - node.parent && AMBIGUOUS_TYPES.include?(node.parent.type) - end - - def remove_parentheses(corrector, node) - corrector.replace(node.location.begin, ' ') - corrector.remove(node.location.end) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/create_list.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/create_list.rb deleted file mode 100644 index 996493992458ff..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/create_list.rb +++ /dev/null @@ -1,260 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - module FactoryBot - # Checks for create_list usage. - # - # This cop can be configured using the `EnforcedStyle` option - # - # @example `EnforcedStyle: create_list` (default) - # # bad - # 3.times { create :user } - # - # # good - # create_list :user, 3 - # - # # bad - # 3.times { create :user, age: 18 } - # - # # good - index is used to alter the created models attributes - # 3.times { |n| create :user, age: n } - # - # # good - contains a method call, may return different values - # 3.times { create :user, age: rand } - # - # @example `EnforcedStyle: n_times` - # # bad - # create_list :user, 3 - # - # # good - # 3.times { create :user } - # - class CreateList < ::RuboCop::Cop::Base - extend AutoCorrector - include ConfigurableEnforcedStyle - include RuboCop::RSpec::FactoryBot::Language - - MSG_CREATE_LIST = 'Prefer create_list.' - MSG_N_TIMES = 'Prefer %s.times.' - RESTRICT_ON_SEND = %i[create_list].freeze - - # @!method array_new_or_n_times_block?(node) - def_node_matcher :array_new_or_n_times_block?, <<-PATTERN - (block - { - (send (const {nil? | cbase} :Array) :new (int _)) | - (send (int _) :times) - } - ... - ) - PATTERN - - # @!method block_with_arg_and_used?(node) - def_node_matcher :block_with_arg_and_used?, <<-PATTERN - (block - _ - (args (arg _value)) - `_value - ) - PATTERN - - # @!method arguments_include_method_call?(node) - def_node_matcher :arguments_include_method_call?, <<-PATTERN - (send ${nil? #factory_bot?} :create (sym $_) `$(send ...)) - PATTERN - - # @!method factory_call(node) - def_node_matcher :factory_call, <<-PATTERN - (send ${nil? #factory_bot?} :create (sym $_) $...) - PATTERN - - # @!method factory_list_call(node) - def_node_matcher :factory_list_call, <<-PATTERN - (send {nil? #factory_bot?} :create_list (sym _) (int $_) ...) - PATTERN - - def on_block(node) # rubocop:todo InternalAffairs/NumblockHandler - return unless style == :create_list - - return unless array_new_or_n_times_block?(node) - return if block_with_arg_and_used?(node) - return unless node.body - return if arguments_include_method_call?(node.body) - return unless contains_only_factory?(node.body) - - add_offense(node.send_node, message: MSG_CREATE_LIST) do |corrector| - CreateListCorrector.new(node.send_node).call(corrector) - end - end - - def on_send(node) - return unless style == :n_times - - factory_list_call(node) do |count| - message = format(MSG_N_TIMES, number: count) - add_offense(node.loc.selector, message: message) do |corrector| - TimesCorrector.new(node).call(corrector) - end - end - end - - private - - def contains_only_factory?(node) - if node.block_type? - factory_call(node.send_node) - else - factory_call(node) - end - end - - # :nodoc - module Corrector - private - - def build_options_string(options) - options.map(&:source).join(', ') - end - - def format_method_call(node, method, arguments) - if node.block_type? || node.parenthesized? - "#{method}(#{arguments})" - else - "#{method} #{arguments}" - end - end - - def format_receiver(receiver) - return '' unless receiver - - "#{receiver.source}." - end - end - - # :nodoc - class TimesCorrector - include Corrector - - def initialize(node) - @node = node - end - - def call(corrector) - replacement = generate_n_times_block(node) - corrector.replace(node.block_node || node, replacement) - end - - private - - attr_reader :node - - def generate_n_times_block(node) - factory, count, *options = node.arguments - - arguments = factory.source - options = build_options_string(options) - arguments += ", #{options}" unless options.empty? - - replacement = format_receiver(node.receiver) - replacement += format_method_call(node, 'create', arguments) - replacement += " #{factory_call_block_source}" if node.block_node - "#{count.source}.times { #{replacement} }" - end - - def factory_call_block_source - node.block_node.location.begin.with( - end_pos: node.block_node.location.end.end_pos - ).source - end - end - - # :nodoc: - class CreateListCorrector - include Corrector - - def initialize(node) - @node = node.parent - end - - def call(corrector) - replacement = if node.body.block_type? - call_with_block_replacement(node) - else - call_replacement(node) - end - - corrector.replace(node, replacement) - end - - private - - attr_reader :node - - def call_with_block_replacement(node) - block = node.body - arguments = build_arguments(block, count_from(node)) - replacement = format_receiver(block.receiver) - replacement += format_method_call(block, 'create_list', arguments) - replacement += format_block(block) - replacement - end - - def build_arguments(node, count) - factory, *options = *node.send_node.arguments - - arguments = ":#{factory.value}, #{count}" - options = build_options_string(options) - arguments += ", #{options}" unless options.empty? - arguments - end - - def call_replacement(node) - block = node.body - factory, *options = *block.arguments - - arguments = "#{factory.source}, #{count_from(node)}" - options = build_options_string(options) - arguments += ", #{options}" unless options.empty? - - replacement = format_receiver(block.receiver) - replacement += format_method_call(block, 'create_list', arguments) - replacement - end - - def count_from(node) - count_node = - if node.receiver.int_type? - node.receiver - else - node.send_node.first_argument - end - count_node.source - end - - def format_block(node) - if node.body.begin_type? - format_multiline_block(node) - else - format_singleline_block(node) - end - end - - def format_multiline_block(node) - indent = ' ' * node.body.loc.column - indent_end = ' ' * node.parent.loc.column - " do #{node.arguments.source}\n" \ - "#{indent}#{node.body.source}\n" \ - "#{indent_end}end" - end - - def format_singleline_block(node) - " { #{node.arguments.source} #{node.body.source} }" - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb deleted file mode 100644 index 0ac4a451473136..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - module FactoryBot - # Use string value when setting the class attribute explicitly. - # - # This cop would promote faster tests by lazy-loading of - # application files. Also, this could help you suppress potential bugs - # in combination with external libraries by avoiding a preload of - # application files from the factory files. - # - # @example - # # bad - # factory :foo, class: Foo do - # end - # - # # good - # factory :foo, class: 'Foo' do - # end - # - class FactoryClassName < ::RuboCop::Cop::Base - extend AutoCorrector - - MSG = "Pass '%s' string instead of `%s` " \ - 'constant.' - ALLOWED_CONSTANTS = %w[Hash OpenStruct].freeze - RESTRICT_ON_SEND = %i[factory].freeze - - # @!method class_name(node) - def_node_matcher :class_name, <<~PATTERN - (send _ :factory _ (hash <(pair (sym :class) $(const ...)) ...>)) - PATTERN - - def on_send(node) - class_name(node) do |cn| - next if allowed?(cn.const_name) - - msg = format(MSG, class_name: cn.const_name) - add_offense(cn, message: msg) do |corrector| - corrector.replace(cn, "'#{cn.source}'") - end - end - end - - private - - def allowed?(const_name) - ALLOWED_CONSTANTS.include?(const_name) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/factory_name_style.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/factory_name_style.rb deleted file mode 100644 index 5708734963202a..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/factory_name_style.rb +++ /dev/null @@ -1,74 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - module FactoryBot - # Checks for name style for argument of FactoryBot::Syntax::Methods. - # - # @example EnforcedStyle: symbol (default) - # # bad - # create('user') - # build "user", username: "NAME" - # - # # good - # create(:user) - # build :user, username: "NAME" - # - # @example EnforcedStyle: string - # # bad - # create(:user) - # build :user, username: "NAME" - # - # # good - # create('user') - # build "user", username: "NAME" - # - class FactoryNameStyle < ::RuboCop::Cop::Base - extend AutoCorrector - include ConfigurableEnforcedStyle - include RuboCop::RSpec::FactoryBot::Language - - MSG = 'Use %s to refer to a factory.' - FACTORY_CALLS = RuboCop::RSpec::FactoryBot::Language::METHODS - RESTRICT_ON_SEND = FACTORY_CALLS - - # @!method factory_call(node) - def_node_matcher :factory_call, <<-PATTERN - (send - {#factory_bot? nil?} %FACTORY_CALLS - ${str sym} ... - ) - PATTERN - - def on_send(node) - factory_call(node) do |name| - if offense_for_symbol_style?(name) - register_offense(name, name.value.to_sym.inspect) - elsif offense_for_string_style?(name) - register_offense(name, name.value.to_s.inspect) - end - end - end - - private - - def offense_for_symbol_style?(name) - name.str_type? && style == :symbol - end - - def offense_for_string_style?(name) - name.sym_type? && style == :string - end - - def register_offense(name, prefer) - add_offense(name, - message: format(MSG, prefer: style.to_s)) do |corrector| - corrector.replace(name, prefer) - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb deleted file mode 100644 index 78fdd1bf1585a4..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb +++ /dev/null @@ -1,89 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - module FactoryBot - # Use shorthands from `FactoryBot::Syntax::Methods` in your specs. - # - # @safety - # The autocorrection is marked as unsafe because the cop - # cannot verify whether you already include - # `FactoryBot::Syntax::Methods` in your test suite. - # - # If you're using Rails, add the following configuration to - # `spec/support/factory_bot.rb` and be sure to require that file in - # `rails_helper.rb`: - # - # [source,ruby] - # ---- - # RSpec.configure do |config| - # config.include FactoryBot::Syntax::Methods - # end - # ---- - # - # If you're not using Rails: - # - # [source,ruby] - # ---- - # RSpec.configure do |config| - # config.include FactoryBot::Syntax::Methods - # - # config.before(:suite) do - # FactoryBot.find_definitions - # end - # end - # ---- - # - # @example - # # bad - # FactoryBot.create(:bar) - # FactoryBot.build(:bar) - # FactoryBot.attributes_for(:bar) - # - # # good - # create(:bar) - # build(:bar) - # attributes_for(:bar) - # - class SyntaxMethods < Base - extend AutoCorrector - include InsideExampleGroup - include RangeHelp - include RuboCop::RSpec::FactoryBot::Language - - MSG = 'Use `%s` from `FactoryBot::Syntax::Methods`.' - - RESTRICT_ON_SEND = RuboCop::RSpec::FactoryBot::Language::METHODS - - def on_send(node) - return unless factory_bot?(node.receiver) - return unless inside_example_group?(node) - - message = format(MSG, method: node.method_name) - - add_offense(crime_scene(node), message: message) do |corrector| - corrector.remove(offense(node)) - end - end - - private - - def crime_scene(node) - range_between( - node.source_range.begin_pos, - node.loc.selector.end_pos - ) - end - - def offense(node) - range_between( - node.source_range.begin_pos, - node.loc.selector.begin_pos - ) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/file_path.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/file_path.rb deleted file mode 100644 index aa1c19bb6af204..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/file_path.rb +++ /dev/null @@ -1,173 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks that spec file paths are consistent and well-formed. - # - # By default, this checks that spec file paths are consistent with the - # test subject and and enforces that it reflects the described - # class/module and its optionally called out method. - # - # With the configuration option `IgnoreMethods` the called out method will - # be ignored when determining the enforced path. - # - # With the configuration option `CustomTransform` modules or classes can - # be specified that should not as usual be transformed from CamelCase to - # snake_case (e.g. 'RuboCop' => 'rubocop' ). - # - # With the configuration option `SpecSuffixOnly` test files will only - # be checked to ensure they end in '_spec.rb'. This option disables - # checking for consistency in the test subject or test methods. - # - # @example - # # bad - # whatever_spec.rb # describe MyClass - # - # # bad - # my_class_spec.rb # describe MyClass, '#method' - # - # # good - # my_class_spec.rb # describe MyClass - # - # # good - # my_class_method_spec.rb # describe MyClass, '#method' - # - # # good - # my_class/method_spec.rb # describe MyClass, '#method' - # - # @example when configuration is `IgnoreMethods: true` - # # bad - # whatever_spec.rb # describe MyClass - # - # # good - # my_class_spec.rb # describe MyClass - # - # # good - # my_class_spec.rb # describe MyClass, '#method' - # - # @example when configuration is `SpecSuffixOnly: true` - # # good - # whatever_spec.rb # describe MyClass - # - # # good - # my_class_spec.rb # describe MyClass - # - # # good - # my_class_spec.rb # describe MyClass, '#method' - # - class FilePath < Base - include TopLevelGroup - include Namespace - - MSG = 'Spec path should end with `%s`.' - - # @!method example_group(node) - def_node_matcher :example_group, <<~PATTERN - (block - $(send #rspec? _example_group $_ $...) ... - ) - PATTERN - - # @!method routing_metadata?(node) - def_node_search :routing_metadata?, '(pair (sym :type) (sym :routing))' - - def on_top_level_example_group(node) - return unless top_level_groups.one? - - example_group(node) do |send_node, example_group, arguments| - ensure_correct_file_path(send_node, example_group, arguments) - end - end - - private - - def ensure_correct_file_path(send_node, example_group, arguments) - pattern = pattern_for(example_group, arguments) - return if filename_ends_with?(pattern) - - # For the suffix shown in the offense message, modify the regular - # expression pattern to resemble a glob pattern for clearer error - # messages. - offense_suffix = pattern.gsub('.*', '*').sub('[^/]', '') - .sub('\.', '.') - add_offense(send_node, message: format(MSG, suffix: offense_suffix)) - end - - def routing_spec?(args) - args.any?(&method(:routing_metadata?)) || routing_spec_path? - end - - def pattern_for(example_group, arguments) - method_name = arguments.first - if spec_suffix_only? || !example_group.const_type? || - routing_spec?(arguments) - return pattern_for_spec_suffix_only - end - - [ - expected_path(example_group), - name_pattern(method_name), - '[^/]*_spec\.rb' - ].join - end - - def pattern_for_spec_suffix_only - '.*_spec\.rb' - end - - def name_pattern(method_name) - return unless method_name&.str_type? - return if ignore_methods? - - ".*#{method_name.str_content.gsub(/\s/, '_').gsub(/\W/, '')}" - end - - def expected_path(constant) - constants = namespace(constant) + constant.const_name.split('::') - - File.join( - constants.map do |name| - custom_transform.fetch(name) { camel_to_snake_case(name) } - end - ) - end - - def camel_to_snake_case(string) - string - .gsub(/([^A-Z])([A-Z]+)/, '\1_\2') - .gsub(/([A-Z])([A-Z][^A-Z\d]+)/, '\1_\2') - .downcase - end - - def custom_transform - cop_config.fetch('CustomTransform', {}) - end - - def ignore_methods? - cop_config['IgnoreMethods'] - end - - def filename_ends_with?(pattern) - expanded_file_path.match?("#{pattern}$") - end - - def relevant_rubocop_rspec_file?(_file) - true - end - - def spec_suffix_only? - cop_config['SpecSuffixOnly'] - end - - def routing_spec_path? - expanded_file_path.include?('spec/routing/') - end - - def expanded_file_path - File.expand_path(processed_source.file_path) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/focus.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/focus.rb deleted file mode 100644 index 3bbd740425e7b9..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/focus.rb +++ /dev/null @@ -1,108 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks if examples are focused. - # - # This cop does not support autocorrection in some cases. - # - # @example - # # bad - # describe MyClass, focus: true do - # end - # - # describe MyClass, :focus do - # end - # - # fdescribe MyClass do - # end - # - # # good - # describe MyClass do - # end - # - # # bad - # fdescribe 'test' do; end - # - # # good - # describe 'test' do; end - # - # # bad - # fdescribe 'test' do; end - # - # # good - # describe 'test' do; end - # - # # bad (does not support autocorrection) - # focus 'test' do; end - # - class Focus < Base - extend AutoCorrector - include RangeHelp - - MSG = 'Focused spec found.' - - # @!method focusable_selector?(node) - def_node_matcher :focusable_selector?, <<-PATTERN - { - #ExampleGroups.regular - #ExampleGroups.skipped - #Examples.regular - #Examples.skipped - #Examples.pending - } - PATTERN - - # @!method metadata(node) - def_node_matcher :metadata, <<-PATTERN - {(send #rspec? #focusable_selector? <$(sym :focus) ...>) - (send #rspec? #focusable_selector? ... (hash <$(pair (sym :focus) true) ...>))} - PATTERN - - # @!method focused_block?(node) - def_node_matcher :focused_block?, <<~PATTERN - (send #rspec? {#ExampleGroups.focused #Examples.focused} ...) - PATTERN - - def on_send(node) - focus_metadata(node) do |focus| - add_offense(focus) do |corrector| - if focus.pair_type? || focus.str_type? || focus.sym_type? - corrector.remove(with_surrounding(focus)) - elsif focus.send_type? - correct_send(corrector, focus) - end - end - end - end - - private - - def focus_metadata(node, &block) - yield(node) if focused_block?(node) - - metadata(node, &block) - end - - def with_surrounding(focus) - range_with_space = - range_with_surrounding_space(focus.source_range, side: :left) - - range_with_surrounding_comma(range_with_space, :left) - end - - def correct_send(corrector, focus) - range = focus.loc.selector - unfocused = focus.method_name.to_s.sub(/^f/, '') - unless Examples.regular(unfocused) || ExampleGroups.regular(unfocused) - return - end - - corrector.replace(range, - range.source.sub(focus.method_name.to_s, unfocused)) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/hook_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/hook_argument.rb deleted file mode 100644 index 2d447100dd4f12..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/hook_argument.rb +++ /dev/null @@ -1,134 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks the arguments passed to `before`, `around`, and `after`. - # - # This cop checks for consistent style when specifying RSpec - # hooks which run for each example. There are three supported - # styles: "implicit", "each", and "example." All styles have - # the same behavior. - # - # @example `EnforcedStyle: implicit` (default) - # # bad - # before(:each) do - # # ... - # end - # - # # bad - # before(:example) do - # # ... - # end - # - # # good - # before do - # # ... - # end - # - # @example `EnforcedStyle: each` - # # bad - # before(:example) do - # # ... - # end - # - # # bad - # before do - # # ... - # end - # - # # good - # before(:each) do - # # ... - # end - # - # @example `EnforcedStyle: example` - # # bad - # before(:each) do - # # ... - # end - # - # # bad - # before do - # # ... - # end - # - # # good - # before(:example) do - # # ... - # end - # - class HookArgument < Base - extend AutoCorrector - include ConfigurableEnforcedStyle - - IMPLICIT_MSG = 'Omit the default `%p` argument for RSpec hooks.' - EXPLICIT_MSG = 'Use `%p` for RSpec hooks.' - - # @!method scoped_hook(node) - def_node_matcher :scoped_hook, <<-PATTERN - ({block numblock} $(send _ #Hooks.all (sym ${:each :example})) ...) - PATTERN - - # @!method unscoped_hook(node) - def_node_matcher :unscoped_hook, <<-PATTERN - ({block numblock} $(send _ #Hooks.all) ...) - PATTERN - - def on_block(node) - hook(node) do |method_send, scope_name| - return correct_style_detected if scope_name.equal?(style) - return check_implicit(method_send) unless scope_name - - style_detected(scope_name) - msg = explicit_message(scope_name) - add_offense(method_send, message: msg) do |corrector| - autocorrect(corrector, node, method_send) - end - end - end - - alias on_numblock on_block - - private - - def autocorrect(corrector, _node, method_send) - scope = implicit_style? ? '' : "(#{style.inspect})" - corrector.replace( - LocationHelp.arguments_with_whitespace(method_send), scope - ) - end - - def check_implicit(method_send) - style_detected(:implicit) - return if implicit_style? - - msg = explicit_message(nil) - add_offense(method_send.loc.selector, message: msg) do |corrector| - scope = "(#{style.inspect})" - corrector.replace( - LocationHelp.arguments_with_whitespace(method_send), - scope - ) - end - end - - def explicit_message(scope) - if implicit_style? - format(IMPLICIT_MSG, scope: scope) - else - format(EXPLICIT_MSG, scope: style) - end - end - - def implicit_style? - style.equal?(:implicit) - end - - def hook(node, &block) - scoped_hook(node, &block) || unscoped_hook(node, &block) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/hooks_before_examples.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/hooks_before_examples.rb deleted file mode 100644 index 3e66658b43f014..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/hooks_before_examples.rb +++ /dev/null @@ -1,81 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks for before/around/after hooks that come after an example. - # - # @example - # # bad - # it 'checks what foo does' do - # expect(foo).to be - # end - # - # before { prepare } - # after { clean_up } - # - # # good - # before { prepare } - # after { clean_up } - # - # it 'checks what foo does' do - # expect(foo).to be - # end - # - class HooksBeforeExamples < Base - extend AutoCorrector - - MSG = 'Move `%s` above the examples in the group.' - - # @!method example_or_group?(node) - def_node_matcher :example_or_group?, <<-PATTERN - { - ({block numblock} { - (send #rspec? #ExampleGroups.all ...) - (send nil? #Examples.all ...) - } ...) - (send nil? #Includes.examples ...) - } - PATTERN - - def on_block(node) - return unless example_group_with_body?(node) - - check_hooks(node.body) if multiline_block?(node.body) - end - - alias on_numblock on_block - - private - - def multiline_block?(block) - block.begin_type? - end - - def check_hooks(node) - first_example = find_first_example(node) - return unless first_example - - first_example.right_siblings.each do |sibling| - next unless hook?(sibling) - - msg = format(MSG, hook: sibling.method_name) - add_offense(sibling, message: msg) do |corrector| - autocorrect(corrector, sibling, first_example) - end - end - end - - def find_first_example(node) - node.children.find { |sibling| example_or_group?(sibling) } - end - - def autocorrect(corrector, node, first_example) - RuboCop::RSpec::Corrector::MoveNode.new( - node, corrector, processed_source - ).move_before(first_example) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/identical_equality_assertion.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/identical_equality_assertion.rb deleted file mode 100644 index 7298415c93a49f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/identical_equality_assertion.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks for equality assertions with identical expressions on both sides. - # - # @example - # # bad - # expect(foo.bar).to eq(foo.bar) - # expect(foo.bar).to eql(foo.bar) - # - # # good - # expect(foo.bar).to eq(2) - # expect(foo.bar).to eql(2) - # - class IdenticalEqualityAssertion < Base - MSG = 'Identical expressions on both sides of the equality ' \ - 'may indicate a flawed test.' - RESTRICT_ON_SEND = %i[to].freeze - - # @!method equality_check?(node) - def_node_matcher :equality_check?, <<~PATTERN - (send (send nil? :expect $_) :to - {(send nil? {:eql :eq :be} $_) - (send (send nil? :be) :== $_)}) - PATTERN - - def on_send(node) - equality_check?(node) do |left, right| - add_offense(node) if left == right - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/implicit_block_expectation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/implicit_block_expectation.rb deleted file mode 100644 index a9f8993965e912..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/implicit_block_expectation.rb +++ /dev/null @@ -1,68 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Check that implicit block expectation syntax is not used. - # - # Prefer using explicit block expectations. - # - # @example - # # bad - # subject { -> { do_something } } - # it { is_expected.to change(something).to(new_value) } - # - # # good - # it 'changes something to a new value' do - # expect { do_something }.to change(something).to(new_value) - # end - # - class ImplicitBlockExpectation < Base - MSG = 'Avoid implicit block expectations.' - RESTRICT_ON_SEND = %i[is_expected should should_not].freeze - - # @!method lambda?(node) - def_node_matcher :lambda?, <<-PATTERN - { - (send (const nil? :Proc) :new) - (send nil? {:proc :lambda}) - } - PATTERN - - # @!method lambda_subject?(node) - def_node_matcher :lambda_subject?, '(block #lambda? ...)' - - # @!method implicit_expect(node) - def_node_matcher :implicit_expect, <<-PATTERN - $(send nil? {:is_expected :should :should_not} ...) - PATTERN - - def on_send(node) - implicit_expect(node) do |implicit_expect| - subject = nearest_subject(implicit_expect) - add_offense(implicit_expect) if lambda_subject?(subject&.body) - end - end - - private - - def nearest_subject(node) - node - .each_ancestor(:block) - .lazy - .select { |block_node| multi_statement_example_group?(block_node) } - .map { |block_node| find_subject(block_node) } - .find(&:itself) - end - - def multi_statement_example_group?(node) - example_group_with_body?(node) && node.body.begin_type? - end - - def find_subject(block_node) - block_node.body.child_nodes.find { |send_node| subject?(send_node) } - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/implicit_expect.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/implicit_expect.rb deleted file mode 100644 index 2af8e44a699b0b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/implicit_expect.rb +++ /dev/null @@ -1,100 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Check that a consistent implicit expectation style is used. - # - # This cop can be configured using the `EnforcedStyle` option - # and supports the `--auto-gen-config` flag. - # - # @example `EnforcedStyle: is_expected` (default) - # # bad - # it { should be_truthy } - # - # # good - # it { is_expected.to be_truthy } - # - # @example `EnforcedStyle: should` - # # bad - # it { is_expected.to be_truthy } - # - # # good - # it { should be_truthy } - # - class ImplicitExpect < Base - extend AutoCorrector - include ConfigurableEnforcedStyle - - MSG = 'Prefer `%s` over `%s`.' - - RESTRICT_ON_SEND = Runners.all + %i[should should_not] - - # @!method implicit_expect(node) - def_node_matcher :implicit_expect, <<-PATTERN - { - (send nil? ${:should :should_not} ...) - (send (send nil? $:is_expected) #Runners.all ...) - } - PATTERN - - alternatives = { - 'is_expected.to' => 'should', - 'is_expected.not_to' => 'should_not', - 'is_expected.to_not' => 'should_not' - } - - ENFORCED_REPLACEMENTS = alternatives.merge(alternatives.invert).freeze - - def on_send(node) # rubocop:disable Metrics/MethodLength - return unless (source_range = offending_expect(node)) - - expectation_source = source_range.source - - if expectation_source.start_with?(style.to_s) - correct_style_detected - else - opposite_style_detected - - msg = offense_message(expectation_source) - add_offense(source_range, message: msg) do |corrector| - replacement = replacement_source(expectation_source) - corrector.replace(source_range, replacement) - end - end - end - - private - - def offending_expect(node) - case implicit_expect(node) - when :is_expected - is_expected_range(node.loc) - when :should, :should_not - node.loc.selector - end - end - - def is_expected_range(source_map) # rubocop:disable Naming/PredicateName - Parser::Source::Range.new( - source_map.expression.source_buffer, - source_map.expression.begin_pos, - source_map.selector.end_pos - ) - end - - def offense_message(offending_source) - format( - MSG, - good: replacement_source(offending_source), - bad: offending_source - ) - end - - def replacement_source(offending_source) - ENFORCED_REPLACEMENTS.fetch(offending_source) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/implicit_subject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/implicit_subject.rb deleted file mode 100644 index dd7270eacbeed8..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/implicit_subject.rb +++ /dev/null @@ -1,167 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks for usage of implicit subject (`is_expected` / `should`). - # - # This cop can be configured using the `EnforcedStyle` option - # - # @example `EnforcedStyle: single_line_only` (default) - # # bad - # it do - # is_expected.to be_truthy - # end - # - # # good - # it { is_expected.to be_truthy } - # it do - # expect(subject).to be_truthy - # end - # - # @example `EnforcedStyle: single_statement_only` - # # bad - # it do - # foo = 1 - # is_expected.to be_truthy - # end - # - # # good - # it do - # foo = 1 - # expect(subject).to be_truthy - # end - # it do - # is_expected.to be_truthy - # end - # - # @example `EnforcedStyle: disallow` - # # bad - # it { is_expected.to be_truthy } - # - # # good - # it { expect(subject).to be_truthy } - # - # @example `EnforcedStyle: require_implicit` - # # bad - # it { expect(subject).to be_truthy } - # - # # good - # it { is_expected.to be_truthy } - # - # # bad - # it do - # expect(subject).to be_truthy - # end - # - # # good - # it do - # is_expected.to be_truthy - # end - # - # # good - # it { expect(named_subject).to be_truthy } - # - class ImplicitSubject < Base - extend AutoCorrector - include ConfigurableEnforcedStyle - - MSG_REQUIRE_EXPLICIT = "Don't use implicit subject." - - MSG_REQUIRE_IMPLICIT = "Don't use explicit subject." - - RESTRICT_ON_SEND = %i[ - expect - is_expected - should - should_not - ].freeze - - # @!method explicit_unnamed_subject?(node) - def_node_matcher :explicit_unnamed_subject?, <<-PATTERN - (send nil? :expect (send nil? :subject)) - PATTERN - - # @!method implicit_subject?(node) - def_node_matcher :implicit_subject?, <<-PATTERN - (send nil? {:should :should_not :is_expected} ...) - PATTERN - - def on_send(node) - return unless invalid?(node) - - add_offense(node) do |corrector| - autocorrect(corrector, node) - end - end - - private - - def autocorrect(corrector, node) - case node.method_name - when :expect - corrector.replace(node, 'is_expected') - when :is_expected - corrector.replace(node.location.selector, 'expect(subject)') - when :should - corrector.replace(node.location.selector, 'expect(subject).to') - when :should_not - corrector.replace(node.location.selector, 'expect(subject).not_to') - end - end - - def message(_node) - case style - when :require_implicit - MSG_REQUIRE_IMPLICIT - else - MSG_REQUIRE_EXPLICIT - end - end - - def invalid?(node) - case style - when :require_implicit - explicit_unnamed_subject?(node) - when :disallow - implicit_subject_in_non_its?(node) - when :single_line_only - implicit_subject_in_non_its_and_non_single_line?(node) - when :single_statement_only - implicit_subject_in_non_its_and_non_single_statement?(node) - end - end - - def implicit_subject_in_non_its?(node) - implicit_subject?(node) && !its?(node) - end - - def implicit_subject_in_non_its_and_non_single_line?(node) - implicit_subject_in_non_its?(node) && !single_line?(node) - end - - def implicit_subject_in_non_its_and_non_single_statement?(node) - implicit_subject_in_non_its?(node) && !single_statement?(node) - end - - def its?(node) - example_of(node)&.method?(:its) - end - - def single_line?(node) - example_of(node)&.single_line? - end - - def single_statement?(node) - !example_of(node)&.body&.begin_type? - end - - def example_of(node) - node.each_ancestor.find do |ancestor| - example?(ancestor) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/indexed_let.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/indexed_let.rb deleted file mode 100644 index 91e8c2647f2955..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/indexed_let.rb +++ /dev/null @@ -1,76 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Do not set up test data using indexes (e.g., `item_1`, `item_2`). - # - # It makes reading the test harder because it's not clear what exactly - # is tested by this particular example. - # - # @example `Max: 1 (default)` - # # bad - # let(:item_1) { create(:item) } - # let(:item_2) { create(:item) } - # - # let(:item1) { create(:item) } - # let(:item2) { create(:item) } - # - # # good - # - # let(:visible_item) { create(:item, visible: true) } - # let(:invisible_item) { create(:item, visible: false) } - # - # @example `Max: 2` - # # bad - # let(:item_1) { create(:item) } - # let(:item_2) { create(:item) } - # let(:item_3) { create(:item) } - # - # # good - # let(:item_1) { create(:item) } - # let(:item_2) { create(:item) } - # - class IndexedLet < Base - MSG = 'This `let` statement uses index in its name. Please give it ' \ - 'a meaningful name.' - - # @!method let_name(node) - def_node_matcher :let_name, <<~PATTERN - { - (block (send nil? #Helpers.all ({str sym} $_) ...) ...) - (send nil? #Helpers.all ({str sym} $_) block_pass) - } - PATTERN - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - return unless spec_group?(node) - - children = node.body&.child_nodes - return unless children - - filter_indexed_lets(children).each do |let_node| - add_offense(let_node) - end - end - - private - - INDEX_REGEX = /_?\d+/.freeze - - def filter_indexed_lets(candidates) - candidates - .filter { |node| indexed_let?(node) } - .group_by { |node| let_name(node).to_s.gsub(INDEX_REGEX, '') } - .values - .filter { |lets| lets.length > cop_config['Max'] } - .flatten - end - - def indexed_let?(node) - let?(node) && INDEX_REGEX.match?(let_name(node)) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/instance_spy.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/instance_spy.rb deleted file mode 100644 index bcb37c4600c62f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/instance_spy.rb +++ /dev/null @@ -1,74 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks for `instance_double` used with `have_received`. - # - # @example - # # bad - # it do - # foo = instance_double(Foo).as_null_object - # expect(foo).to have_received(:bar) - # end - # - # # good - # it do - # foo = instance_spy(Foo) - # expect(foo).to have_received(:bar) - # end - # - class InstanceSpy < Base - extend AutoCorrector - - MSG = 'Use `instance_spy` when you check your double ' \ - 'with `have_received`.' - - # @!method null_double(node) - def_node_search :null_double, <<-PATTERN - (lvasgn $_ - (send - $(send nil? :instance_double - ...) :as_null_object)) - PATTERN - - # @!method have_received_usage(node) - def_node_search :have_received_usage, <<-PATTERN - (send - (send nil? :expect - (lvar $_)) :to - (send nil? :have_received - ...) - ...) - PATTERN - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - return unless example?(node) - - null_double(node) do |var, receiver| - have_received_usage(node) do |expected| - next if expected != var - - add_offense(receiver) do |corrector| - autocorrect(corrector, receiver) - end - end - end - end - - private - - def autocorrect(corrector, node) - replacement = 'instance_spy' - corrector.replace(node.loc.selector, replacement) - - double_source_map = node.parent.loc - as_null_object_range = double_source_map - .dot - .join(double_source_map.selector) - corrector.remove(as_null_object_range) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/instance_variable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/instance_variable.rb deleted file mode 100644 index 0ce0298ba28b92..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/instance_variable.rb +++ /dev/null @@ -1,96 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks for instance variable usage in specs. - # - # This cop can be configured with the option `AssignmentOnly` which - # will configure the cop to only register offenses on instance - # variable usage if the instance variable is also assigned within - # the spec - # - # @example - # # bad - # describe MyClass do - # before { @foo = [] } - # it { expect(@foo).to be_empty } - # end - # - # # good - # describe MyClass do - # let(:foo) { [] } - # it { expect(foo).to be_empty } - # end - # - # @example with AssignmentOnly configuration - # # rubocop.yml - # # RSpec/InstanceVariable: - # # AssignmentOnly: false - # - # # bad - # describe MyClass do - # before { @foo = [] } - # it { expect(@foo).to be_empty } - # end - # - # # allowed - # describe MyClass do - # it { expect(@foo).to be_empty } - # end - # - # # good - # describe MyClass do - # let(:foo) { [] } - # it { expect(foo).to be_empty } - # end - # - class InstanceVariable < Base - include TopLevelGroup - - MSG = 'Avoid instance variables – use let, ' \ - 'a method call, or a local variable (if possible).' - - # @!method dynamic_class?(node) - def_node_matcher :dynamic_class?, <<-PATTERN - (block (send (const nil? :Class) :new ...) ...) - PATTERN - - # @!method custom_matcher?(node) - def_node_matcher :custom_matcher?, <<-PATTERN - (block { - (send nil? :matcher sym) - (send (const (const nil? :RSpec) :Matchers) :define sym) - } ...) - PATTERN - - # @!method ivar_usage(node) - def_node_search :ivar_usage, '$(ivar $_)' - - # @!method ivar_assigned?(node) - def_node_search :ivar_assigned?, '(ivasgn % ...)' - - def on_top_level_group(node) - ivar_usage(node) do |ivar, name| - next if valid_usage?(ivar) - next if assignment_only? && !ivar_assigned?(node, name) - - add_offense(ivar) - end - end - - private - - def valid_usage?(node) - node.each_ancestor(:block).any? do |block| - dynamic_class?(block) || custom_matcher?(block) - end - end - - def assignment_only? - cop_config['AssignmentOnly'] - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/it_behaves_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/it_behaves_like.rb deleted file mode 100644 index a8f76cbac34001..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/it_behaves_like.rb +++ /dev/null @@ -1,49 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks that only one `it_behaves_like` style is used. - # - # @example `EnforcedStyle: it_behaves_like` (default) - # # bad - # it_should_behave_like 'a foo' - # - # # good - # it_behaves_like 'a foo' - # - # @example `EnforcedStyle: it_should_behave_like` - # # bad - # it_behaves_like 'a foo' - # - # # good - # it_should_behave_like 'a foo' - # - class ItBehavesLike < Base - extend AutoCorrector - include ConfigurableEnforcedStyle - - MSG = 'Prefer `%s` over `%s` when including ' \ - 'examples in a nested context.' - RESTRICT_ON_SEND = %i[it_behaves_like it_should_behave_like].freeze - - # @!method example_inclusion_offense(node) - def_node_matcher :example_inclusion_offense, '(send _ % ...)' - - def on_send(node) - example_inclusion_offense(node, alternative_style) do - add_offense(node) do |corrector| - corrector.replace(node.loc.selector, style.to_s) - end - end - end - - private - - def message(_node) - format(MSG, replacement: style, original: alternative_style) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/iterated_expectation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/iterated_expectation.rb deleted file mode 100644 index 7d65851a46b8d5..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/iterated_expectation.rb +++ /dev/null @@ -1,74 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Check that `all` matcher is used instead of iterating over an array. - # - # @example - # # bad - # it 'validates users' do - # [user1, user2, user3].each { |user| expect(user).to be_valid } - # end - # - # # good - # it 'validates users' do - # expect([user1, user2, user3]).to all(be_valid) - # end - # - class IteratedExpectation < Base - MSG = 'Prefer using the `all` matcher instead ' \ - 'of iterating over an array.' - - # @!method each?(node) - def_node_matcher :each?, <<-PATTERN - (block - (send ... :each) - (args (arg $_)) - $(...) - ) - PATTERN - - # @!method each_numblock?(node) - def_node_matcher :each_numblock?, <<-PATTERN - (numblock - (send ... :each) _ $(...) - ) - PATTERN - - # @!method expectation?(node) - def_node_matcher :expectation?, <<-PATTERN - (send (send nil? :expect (lvar %)) :to ...) - PATTERN - - def on_block(node) - each?(node) do |arg, body| - if single_expectation?(body, arg) || only_expectations?(body, arg) - add_offense(node.send_node) - end - end - end - - def on_numblock(node) - each_numblock?(node) do |body| - if single_expectation?(body, :_1) || only_expectations?(body, :_1) - add_offense(node.send_node) - end - end - end - - private - - def single_expectation?(body, arg) - expectation?(body, arg) - end - - def only_expectations?(body, arg) - return false unless body.each_child_node.any? - - body.each_child_node.all? { |child| expectation?(child, arg) } - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/leading_subject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/leading_subject.rb deleted file mode 100644 index a266ef49dad19f..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/leading_subject.rb +++ /dev/null @@ -1,86 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Enforce that subject is the first definition in the test. - # - # @example - # # bad - # let(:params) { blah } - # subject { described_class.new(params) } - # - # before { do_something } - # subject { described_class.new(params) } - # - # it { expect_something } - # subject { described_class.new(params) } - # it { expect_something_else } - # - # - # # good - # subject { described_class.new(params) } - # let(:params) { blah } - # - # # good - # subject { described_class.new(params) } - # before { do_something } - # - # # good - # subject { described_class.new(params) } - # it { expect_something } - # it { expect_something_else } - # - class LeadingSubject < Base - extend AutoCorrector - include InsideExampleGroup - - MSG = 'Declare `subject` above any other `%s` declarations.' - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - return unless subject?(node) - return unless inside_example_group?(node) - - check_previous_nodes(node) - end - - private - - def check_previous_nodes(node) - offending_node(node) do |offender| - msg = format(MSG, offending: offender.method_name) - add_offense(node, message: msg) do |corrector| - autocorrect(corrector, node, offender) - end - end - end - - def offending_node(node) - parent(node).each_child_node.find do |sibling| - break if sibling.equal?(node) - - yield sibling if offending?(sibling) - end - end - - def parent(node) - node.each_ancestor(:block).first.body - end - - def autocorrect(corrector, node, sibling) - RuboCop::RSpec::Corrector::MoveNode.new( - node, corrector, processed_source - ).move_before(sibling) - end - - def offending?(node) - let?(node) || - hook?(node) || - example?(node) || - spec_group?(node) || - include?(node) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/leaky_constant_declaration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/leaky_constant_declaration.rb deleted file mode 100644 index da1288a6de56a5..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +++ /dev/null @@ -1,127 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks that no class, module, or constant is declared. - # - # Constants, including classes and modules, when declared in a block - # scope, are defined in global namespace, and leak between examples. - # - # If several examples may define a `DummyClass`, instead of being a - # blank slate class as it will be in the first example, subsequent - # examples will be reopening it and modifying its behavior in - # unpredictable ways. - # Even worse when a class that exists in the codebase is reopened. - # - # Anonymous classes are fine, since they don't result in global - # namespace name clashes. - # - # @see https://relishapp.com/rspec/rspec-mocks/docs/mutating-constants - # - # @example Constants leak between examples - # # bad - # describe SomeClass do - # OtherClass = Struct.new - # CONSTANT_HERE = 'I leak into global namespace' - # end - # - # # good - # describe SomeClass do - # before do - # stub_const('OtherClass', Struct.new) - # stub_const('CONSTANT_HERE', 'I only exist during this example') - # end - # end - # - # @example - # # bad - # describe SomeClass do - # class FooClass < described_class - # def double_that - # some_base_method * 2 - # end - # end - # - # it { expect(FooClass.new.double_that).to eq(4) } - # end - # - # # good - anonymous class, no constant needs to be defined - # describe SomeClass do - # let(:foo_class) do - # Class.new(described_class) do - # def double_that - # some_base_method * 2 - # end - # end - # end - # - # it { expect(foo_class.new.double_that).to eq(4) } - # end - # - # # good - constant is stubbed - # describe SomeClass do - # before do - # foo_class = Class.new(described_class) do - # def do_something - # end - # end - # stub_const('FooClass', foo_class) - # end - # - # it { expect(FooClass.new.double_that).to eq(4) } - # end - # - # @example - # # bad - # describe SomeClass do - # module SomeModule - # class SomeClass - # def do_something - # end - # end - # end - # end - # - # # good - # describe SomeClass do - # before do - # foo_class = Class.new(described_class) do - # def do_something - # end - # end - # stub_const('SomeModule::SomeClass', foo_class) - # end - # end - class LeakyConstantDeclaration < Base - MSG_CONST = 'Stub constant instead of declaring explicitly.' - MSG_CLASS = 'Stub class constant instead of declaring explicitly.' - MSG_MODULE = 'Stub module constant instead of declaring explicitly.' - - def on_casgn(node) - return unless inside_describe_block?(node) - - add_offense(node, message: MSG_CONST) - end - - def on_class(node) - return unless inside_describe_block?(node) - - add_offense(node, message: MSG_CLASS) - end - - def on_module(node) - return unless inside_describe_block?(node) - - add_offense(node, message: MSG_MODULE) - end - - private - - def inside_describe_block?(node) - node.each_ancestor(:block).any?(&method(:spec_group?)) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/let_before_examples.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/let_before_examples.rb deleted file mode 100644 index ca322973646907..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/let_before_examples.rb +++ /dev/null @@ -1,97 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks for `let` definitions that come after an example. - # - # @example - # # bad - # let(:foo) { bar } - # - # it 'checks what foo does' do - # expect(foo).to be - # end - # - # let(:some) { other } - # - # it 'checks what some does' do - # expect(some).to be - # end - # - # # good - # let(:foo) { bar } - # let(:some) { other } - # - # it 'checks what foo does' do - # expect(foo).to be - # end - # - # it 'checks what some does' do - # expect(some).to be - # end - class LetBeforeExamples < Base - extend AutoCorrector - - MSG = 'Move `let` before the examples in the group.' - - # @!method example_or_group?(node) - def_node_matcher :example_or_group?, <<-PATTERN - { - (block (send nil? {#ExampleGroups.all #Examples.all} ...) ...) - (send nil? #Includes.examples ...) - } - PATTERN - - # @!method include_examples?(node) - def_node_matcher :include_examples?, <<~PATTERN - { - (block (send nil? :include_examples ...) ...) - (send nil? :include_examples ...) - } - PATTERN - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - return unless example_group_with_body?(node) - - check_let_declarations(node.body) if multiline_block?(node.body) - end - - private - - def example_group_with_include_examples?(body) - body.children.any? { |sibling| include_examples?(sibling) } - end - - def multiline_block?(block) - block.begin_type? - end - - def check_let_declarations(node) - first_example = find_first_example(node) - return unless first_example - - correct = !example_group_with_include_examples?(node) - - first_example.right_siblings.each do |sibling| - next unless let?(sibling) - - add_offense(sibling) do |corrector| - autocorrect(corrector, sibling, first_example) if correct - end - end - end - - def find_first_example(node) - node.children.find { |sibling| example_or_group?(sibling) } - end - - def autocorrect(corrector, node, first_example) - RuboCop::RSpec::Corrector::MoveNode.new( - node, corrector, processed_source - ).move_before(first_example) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/let_setup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/let_setup.rb deleted file mode 100644 index 986fd9774c97f1..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/let_setup.rb +++ /dev/null @@ -1,74 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks unreferenced `let!` calls being used for test setup. - # - # @example - # # bad - # let!(:my_widget) { create(:widget) } - # - # it 'counts widgets' do - # expect(Widget.count).to eq(1) - # end - # - # # good - # it 'counts widgets' do - # create(:widget) - # expect(Widget.count).to eq(1) - # end - # - # # good - # before { create(:widget) } - # - # it 'counts widgets' do - # expect(Widget.count).to eq(1) - # end - class LetSetup < Base - MSG = 'Do not use `let!` to setup objects not referenced in tests.' - - # @!method example_or_shared_group_or_including?(node) - def_node_matcher :example_or_shared_group_or_including?, <<~PATTERN - (block { - (send #rspec? {#SharedGroups.all #ExampleGroups.all} ...) - (send nil? #Includes.all ...) - } ...) - PATTERN - - # @!method let_bang(node) - def_node_matcher :let_bang, <<-PATTERN - { - (block $(send nil? :let! {(sym $_) (str $_)}) ...) - $(send nil? :let! {(sym $_) (str $_)} block_pass) - } - PATTERN - - # @!method method_called?(node) - def_node_search :method_called?, '(send nil? %)' - - def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler - return unless example_or_shared_group_or_including?(node) - - unused_let_bang(node) do |let| - add_offense(let) - end - end - - private - - def unused_let_bang(node) - child_let_bang(node) do |method_send, method_name| - yield(method_send) unless method_called?(node, method_name.to_sym) - end - end - - def child_let_bang(node, &block) - RuboCop::RSpec::ExampleGroup.new(node).lets.each do |let| - let_bang(let, &block) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/match_array.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/match_array.rb deleted file mode 100644 index 058c69f5b216ae..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/match_array.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks where `match_array` is used. - # - # This cop checks for the following: - # - Prefer `contain_exactly` when matching an array with values. - # - Prefer `eq` when using `match_array` with an empty array literal. - # - # @example - # # bad - # it { is_expected.to match_array([content1, content2]) } - # - # # good - # it { is_expected.to contain_exactly(content1, content2) } - # - # # good - # it { is_expected.to match_array([content] + array) } - # - # # good - # it { is_expected.to match_array(%w(tremble in fear foolish mortals)) } - # - class MatchArray < Base - extend AutoCorrector - - MSG = 'Prefer `contain_exactly` when matching an array literal.' - RESTRICT_ON_SEND = %i[match_array].freeze - - # @!method match_array_with_empty_array?(node) - def_node_matcher :match_array_with_empty_array?, <<~PATTERN - (send nil? :match_array (array)) - PATTERN - - def on_send(node) - return unless node.first_argument.array_type? - return if match_array_with_empty_array?(node) - - check_populated_array(node) - end - - private - - def check_populated_array(node) - return if node.first_argument.percent_literal? - - add_offense(node) do |corrector| - array_contents = node.arguments.flat_map(&:to_a) - corrector.replace( - node, - "contain_exactly(#{array_contents.map(&:source).join(', ')})" - ) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/message_chain.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/message_chain.rb deleted file mode 100644 index 14a09bb3a78b8b..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/message_chain.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Check that chains of messages are not being stubbed. - # - # @example - # # bad - # allow(foo).to receive_message_chain(:bar, :baz).and_return(42) - # - # # good - # thing = Thing.new(baz: 42) - # allow(foo).to receive(:bar).and_return(thing) - # - class MessageChain < Base - MSG = 'Avoid stubbing using `%s`.' - RESTRICT_ON_SEND = %i[receive_message_chain stub_chain].freeze - - def on_send(node) - add_offense( - node.loc.selector, message: format(MSG, method: node.method_name) - ) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/message_expectation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/message_expectation.rb deleted file mode 100644 index b625b592f44aa3..00000000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rspec-2.20.0/lib/rubocop/cop/rspec/message_expectation.rb +++ /dev/null @@ -1,62 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module RSpec - # Checks for consistent message expectation style. - # - # This cop can be configured in your configuration using the - # `EnforcedStyle` option and supports `--auto-gen-config`. - # - # @example `EnforcedStyle: allow` (default) - # - # # bad - # expect(foo).to receive(:bar) - # - # # good - # allow(foo).to receive(:bar) - # - # @example `EnforcedStyle: expect` - # - # # bad - # allow(foo).to receive(:bar) - # - # # good - # expect(foo).to receive(:bar) - # - class MessageExpectation < Base - include ConfigurableEnforcedStyle - - MSG = 'Prefer `%