Skip to content

Commit 940f5dd

Browse files
committed
rubocop --only Style/NegatedIf -a
1 parent 579367f commit 940f5dd

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

lib/generators/react/install_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def create_directory
2424
javascript_dir
2525
end
2626
empty_directory File.join(components_dir, 'components')
27-
if !options[:skip_git]
27+
unless options[:skip_git]
2828
create_file File.join(components_dir, 'components/.gitkeep')
2929
end
3030
end

lib/react/rails/railtie.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Railtie < ::Rails::Railtie
7878
})
7979

8080
sprockets_env = app.assets || app.config.try(:assets) # sprockets-rails 3.x attaches this at a different config
81-
if !sprockets_env.nil?
81+
unless sprockets_env.nil?
8282
sprockets_env.version = [sprockets_env.version, "react-#{asset_variant.react_build}",].compact.join('-')
8383
end
8484

test/generators/install_generator_sprockets_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require 'generators/react/install_generator'
33

44
# If webpacker is available, its setup is preferred
5-
if !WebpackerHelpers.available?
5+
unless WebpackerHelpers.available?
66
class InstallGeneratorSprocketsTest < Rails::Generators::TestCase
77
destination File.join(Rails.root, 'tmp', 'generator_test_output')
88
tests React::Generators::InstallGenerator

test/react/rails/component_mount_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
class ComponentMountTest < ActionDispatch::IntegrationTest
55
compiled_once = false
66
setup do
7-
if !compiled_once
7+
unless compiled_once
88
WebpackerHelpers.clear_webpacker_packs
99
WebpackerHelpers.compile
1010
end

test/react/rails/controller_lifecycle_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def react_component(*args)
2525
class ControllerLifecycleTest < ActionDispatch::IntegrationTest
2626
compiled = false
2727
setup do
28-
if !compiled
28+
unless compiled
2929
compile = true
3030
WebpackerHelpers.compile
3131
end

test/react/rails/react_rails_ujs_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class ReactRailsUJSTest < ActionDispatch::IntegrationTest
66

77
compiled = false
88
setup do
9-
if !compiled
9+
unless compiled
1010
React::ServerRendering.reset_pool
1111
WebpackerHelpers.compile
1212
end

test/react/server_rendering/bundle_renderer_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class BundleRendererTest < ActiveSupport::TestCase
9090
assert_match(/console.error.apply\(console, \["setTimeout #{message}"\]\);$/, result)
9191
end
9292

93-
if !WebpackerHelpers.available?
93+
unless WebpackerHelpers.available?
9494
# This doesn't work with webpacker since finding components is based on filename
9595
test '.new accepts additional code to add to the JS context' do
9696
additional_code = File.read(File.expand_path('../../../helper_files/WithoutSprockets.js', __FILE__))

test/support/webpacker_helpers.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def when_webpacker_available
1818
end
1919

2020
def compile
21-
return if !available?
21+
return unless available?
2222
clear_webpacker_packs
2323
Dir.chdir("./test/#{DUMMY_LOCATION}") do
2424
# capture_io do
@@ -31,7 +31,7 @@ def compile
3131
end
3232

3333
def compile_if_missing
34-
if !File.exist?(PACKS_DIRECTORY)
34+
unless File.exist?(PACKS_DIRECTORY)
3535
compile
3636
end
3737
end
@@ -127,7 +127,7 @@ def with_dev_server
127127
end
128128

129129
# If we didn't hook up with a dev server after waiting, fail loudly.
130-
if !detected_dev_server
130+
unless detected_dev_server
131131
raise 'Failed to start dev server'
132132
end
133133

0 commit comments

Comments
 (0)