Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable Layout/SpaceAroundOperators cop #40436

Merged
merged 1 commit into from Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .rubocop.yml
Expand Up @@ -119,6 +119,9 @@ Layout/SpaceAroundEqualsInParameterDefault:
Layout/SpaceAroundKeyword:
Enabled: true

Layout/SpaceAroundOperators:
Enabled: true

Layout/SpaceBeforeComma:
Enabled: true

Expand Down
31 changes: 16 additions & 15 deletions Gemfile.lock
Expand Up @@ -370,7 +370,7 @@ GEM
mini_portile2 (~> 2.4.0)
os (1.1.1)
parallel (1.19.2)
parser (2.7.1.4)
parser (2.7.2.0)
ast (~> 2.4.1)
path_expander (1.1.0)
pg (1.2.3)
Expand Down Expand Up @@ -410,7 +410,7 @@ GEM
rdoc (6.2.1)
redcarpet (3.2.3)
redis (4.2.2)
regexp_parser (1.7.1)
regexp_parser (1.8.2)
representable (3.0.4)
declarative (< 0.1.0)
declarative-option (< 0.2.0)
Expand All @@ -429,25 +429,26 @@ GEM
retriable (3.1.2)
rexml (3.2.4)
rouge (3.20.0)
rubocop (0.90.0)
rubocop (1.0.0)
parallel (~> 1.10)
parser (>= 2.7.1.1)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
regexp_parser (>= 1.8)
rexml
rubocop-ast (>= 0.3.0, < 1.0)
rubocop-ast (>= 0.6.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.3.0)
parser (>= 2.7.1.4)
rubocop-packaging (0.4.0)
rubocop (~> 0.89)
rubocop-performance (1.6.1)
rubocop (>= 0.71.0)
rubocop-rails (2.5.2)
activesupport
rubocop-ast (1.0.1)
parser (>= 2.7.1.5)
rubocop-packaging (0.5.1)
rubocop (>= 0.89, < 2.0)
rubocop-performance (1.8.1)
rubocop (>= 0.87.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.8.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 0.72.0)
rubocop (>= 0.87.0)
ruby-progressbar (1.10.1)
ruby-vips (2.0.17)
ffi (~> 1.9)
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/journey/gtg/builder.rb
Expand Up @@ -34,7 +34,7 @@ def transition_table
from = state_id[s]

if u.all? { |pos| pos == DUMMY }
to = state_id[Object.new]
to = state_id[Object.new]
dtrans[from, to] = sym
dtrans.add_accepting(to)

Expand Down
Expand Up @@ -24,7 +24,7 @@ def call(env)

private
def actionable_request?(request)
request.get_header("action_dispatch.show_detailed_exceptions") && request.post? && request.path == endpoint
request.get_header("action_dispatch.show_detailed_exceptions") && request.post? && request.path == endpoint
end

def redirect_to(location)
Expand Down
2 changes: 1 addition & 1 deletion activemodel/lib/active_model/type/helpers/time_value.rb
Expand Up @@ -75,7 +75,7 @@ def fast_string_to_time(string)
usec = $7.to_i
usec_len = $7&.length
if usec_len&.< 6
usec *= 10 ** (6 - usec_len)
usec *= 10**(6 - usec_len)
Copy link
Member Author

Choose a reason for hiding this comment

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

There is EnforcedStyleForExponentOperator configurable attributes, but here is only line that space around exponent operator, so I'll accept this change.

https://docs.rubocop.org/rubocop/1.0/cops_layout.html#configurable-attributes-41

% git grep -n ' \*\* '
activemodel/lib/active_model/type/helpers/time_value.rb:78:              usec *= 10 ** (6 - usec_len)
railties/lib/rails/commands/secrets/USAGE:1:=== ** DEPRECATED **

% git grep -n '[a-z0-9]\*\*[a-z0-9]'
actionpack/test/controller/parameters/parameters_permit_test.rb:62:    values += [0, 1.0, 2**128, BigDecimal(1)]
Binary file actiontext/test/fixtures/files/racecar.jpg matches
actionview/test/template/date_helper_test.rb:194:    assert_equal "about 3 years", distance_of_time_in_words(10**8)
actionview/test/template/date_helper_test.rb:195:    assert_equal "about 3 years", distance_of_time_in_words(0, 10**8)
actionview/test/template/number_helper_test.rb:117:    assert_equal "100&lt;script&gt;&lt;/script&gt;000 Quadrillion", number_to_human(10**20, delimiter: "<script></script>")
actionview/test/template/render_test.rb:157:    assert_equal "4", @view.render(inline: "(2**2).to_s", type: :ruby)
activejob/lib/active_job/exceptions.rb:26:      #   <tt>:exponentially_longer</tt>, which applies the wait algorithm of <tt>((executions**4) + (Kernel.rand * (executions**4) * jitter)) + 2</tt>
activejob/lib/active_job/exceptions.rb:137:          delay = executions**4
activemodel/lib/active_model/type/helpers/time_value.rb:28:          round_power = 10**number_of_insignificant_digits
activemodel/test/cases/validations/length_validation_test.rb:166:    bigmin = 2**30
activemodel/test/cases/validations/length_validation_test.rb:167:    bigmax = 2**32
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:588:          m.register_type %r(tinytext)i,   Type::Text.new(limit: 2**8 - 1)
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:589:          m.register_type %r(tinyblob)i,   Type::Binary.new(limit: 2**8 - 1)
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:590:          m.register_type %r(text)i,       Type::Text.new(limit: 2**16 - 1)
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:591:          m.register_type %r(blob)i,       Type::Binary.new(limit: 2**16 - 1)
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:592:          m.register_type %r(mediumtext)i, Type::Text.new(limit: 2**24 - 1)
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:593:          m.register_type %r(mediumblob)i, Type::Binary.new(limit: 2**24 - 1)
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:594:          m.register_type %r(longtext)i,   Type::Text.new(limit: 2**32 - 1)
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:595:          m.register_type %r(longblob)i,   Type::Binary.new(limit: 2**32 - 1)
activerecord/lib/active_record/fixtures.rb:464:    MAX_ID = 2**30 - 1
activerecord/test/cases/bind_parameter_test.rb:112:        topics = Topic.where(id: (1 .. bind_params_length).to_a << 2**63)
activerecord/test/cases/bind_parameter_test.rb:115:        topics = Topic.where.not(id: (1 .. bind_params_length).to_a << 2**63)
activerecord/test/cases/migration_test.rb:391:      world_population: 2**62,
activerecord/test/cases/migration_test.rb:406:    assert_equal 2**62, b.world_population
activerecord/test/cases/numeric_data_test.rb:22:      world_population: 2**62,
activerecord/test/cases/numeric_data_test.rb:33:    assert_equal 2**62, m1.world_population
activerecord/test/cases/numeric_data_test.rb:49:      world_population: 2**62,
activerecord/test/cases/numeric_data_test.rb:60:    assert_equal 2**62, m1.world_population
activerecord/test/cases/numeric_data_test.rb:77:        world_population: 2**62,
Binary file activestorage/test/fixtures/files/racecar.jpg matches
Binary file activestorage/test/fixtures/files/racecar.tif matches
Binary file activestorage/test/fixtures/files/racecar_rotated.jpg matches
Binary file activestorage/test/fixtures/files/video.webm matches
activesupport/lib/active_support/key_generator.rb:16:      @iterations = options[:iterations] || 2**16
activesupport/lib/active_support/number_helper/number_to_human_converter.rb:26:        @number = number / (10**exponent)
activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb:24:          human_size = number / (base**exponent)
activesupport/test/core_ext/numeric_ext_test.rb:107:    assert_equal 1.kilobyte**4, 1.terabyte
activesupport/test/core_ext/numeric_ext_test.rb:111:    assert_equal 1.kilobyte**5, 1.petabyte
activesupport/test/core_ext/numeric_ext_test.rb:112:    assert_equal 1.kilobyte**6, 1.exabyte
activesupport/test/core_ext/numeric_ext_test.rb:383:    assert_equal "100000 Quadrillion", (100**10).to_s(:human)
activesupport/test/core_ext/numeric_ext_test.rb:390:    assert_equal "100000000000000000000", (100**10).to_s(:invalid)
activesupport/test/core_ext/numeric_ext_test.rb:400:    assert_equal "100000000000000000000", (100**10).to_s
activesupport/test/core_ext/numeric_ext_test.rb:401:    assert_equal "1010110101111000111010111100010110101100011000100000000000000000000", (100**10).to_s(2)
Binary file guides/assets/images/association_basics/has_one_through.png matches
Binary file guides/assets/images/getting_started/rails_welcome.png matches
guides/source/active_support_core_extensions.md:2045:[].sum(1) {|n| n**3} # => 1

end

if $8
Expand Down
Expand Up @@ -40,7 +40,7 @@ def test_establish_connection_using_3_levels_config

config = {
"default_env" => {
"primary" => { "adapter" => "sqlite3", "database" => "test/db/primary.sqlite3" },
"primary" => { "adapter" => "sqlite3", "database" => "test/db/primary.sqlite3" },
"primary_shard_one" => { "adapter" => "sqlite3", "database" => "test/db/primary_shard_one.sqlite3" },
}
}
Expand Down Expand Up @@ -73,8 +73,8 @@ def test_establish_connection_using_3_levels_config_with_shards_and_replica

config = {
"default_env" => {
"primary" => { "adapter" => "sqlite3", "database" => "test/db/primary.sqlite3" },
"primary_replica" => { "adapter" => "sqlite3", "database" => "test/db/primary.sqlite3", "replica" => true },
"primary" => { "adapter" => "sqlite3", "database" => "test/db/primary.sqlite3" },
"primary_replica" => { "adapter" => "sqlite3", "database" => "test/db/primary.sqlite3", "replica" => true },
"primary_shard_one" => { "adapter" => "sqlite3", "database" => "test/db/primary_shard_one.sqlite3" },
"primary_shard_one_replica" => { "adapter" => "sqlite3", "database" => "test/db/primary_shard_one.sqlite3", "replica" => true }
}
Expand Down Expand Up @@ -117,8 +117,8 @@ def test_switching_connections_via_handler

config = {
"default_env" => {
"primary" => { "adapter" => "sqlite3", "database" => "test/db/primary.sqlite3" },
"primary_replica" => { "adapter" => "sqlite3", "database" => "test/db/primary.sqlite3", "replica" => true },
"primary" => { "adapter" => "sqlite3", "database" => "test/db/primary.sqlite3" },
"primary_replica" => { "adapter" => "sqlite3", "database" => "test/db/primary.sqlite3", "replica" => true },
"primary_shard_one" => { "adapter" => "sqlite3", "database" => "test/db/primary_shard_one.sqlite3" },
"primary_shard_one_replica" => { "adapter" => "sqlite3", "database" => "test/db/primary_shard_one.sqlite3", "replica" => true }
}
Expand Down Expand Up @@ -185,8 +185,8 @@ def test_retrieves_proper_connection_with_nested_connected_to

config = {
"default_env" => {
"primary" => { "adapter" => "sqlite3", "database" => "test/db/primary.sqlite3" },
"primary_replica" => { "adapter" => "sqlite3", "database" => "test/db/primary.sqlite3", "replica" => true },
"primary" => { "adapter" => "sqlite3", "database" => "test/db/primary.sqlite3" },
"primary_replica" => { "adapter" => "sqlite3", "database" => "test/db/primary.sqlite3", "replica" => true },
"primary_shard_one" => { "adapter" => "sqlite3", "database" => "test/db/primary_shard_one.sqlite3" },
"primary_shard_one_replica" => { "adapter" => "sqlite3", "database" => "test/db/primary_shard_one.sqlite3", "replica" => true }
}
Expand Down
6 changes: 3 additions & 3 deletions activerecord/test/cases/database_configurations_test.rb
Expand Up @@ -57,13 +57,13 @@ def test_default_hash_returns_config_hash_from_default_env
def test_find_db_config_returns_first_config_for_env
config = ActiveRecord::DatabaseConfigurations.new({
"test" => {
"config_1"=> {
"config_1" => {
"database" => "db"
},
"config_2"=> {
"config_2" => {
"database" => "db"
},
"config_3"=> {
"config_3" => {
"database" => "db"
},
}
Expand Down
4 changes: 2 additions & 2 deletions activerecord/test/cases/tasks/database_tasks_test.rb
Expand Up @@ -1291,7 +1291,7 @@ class DatabaseTasksCharsetTest < ActiveRecord::TestCase
def test_charset_current
old_configurations = ActiveRecord::Base.configurations
configurations = {
"production" => { "database" => "prod-db" }
"production" => { "database" => "prod-db" }
}

ActiveRecord::Base.configurations = configurations
Expand Down Expand Up @@ -1324,7 +1324,7 @@ class DatabaseTasksCollationTest < ActiveRecord::TestCase
def test_collation_current
old_configurations = ActiveRecord::Base.configurations
configurations = {
"production" => { "database" => "prod-db" }
"production" => { "database" => "prod-db" }
}

ActiveRecord::Base.configurations = configurations
Expand Down