Skip to content

Commit

Permalink
Rubocop fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
justin808 committed Nov 11, 2020
1 parent 042023c commit 45a2123
Show file tree
Hide file tree
Showing 57 changed files with 390 additions and 355 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Check out: https://github.com/bbatsov/rubocop

AllCops:
NewCops: enable
DisplayCopNames: true
TargetRubyVersion: 2.5

Expand Down Expand Up @@ -110,6 +111,9 @@ Layout/SpaceAroundMethodCallOperator:
Lint/RaiseException:
Enabled: true

Lint/EmptyInterpolation:
Enabled: false

Lint/StructNewOverride:
Enabled: true

Expand Down
57 changes: 28 additions & 29 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,31 @@ gemspec
# They must be defined here because of the way Travis CI works, in that it will only
# bundle install from a single Gemfile. Therefore, all gems that we will need for any dummy/example
# app have to be manually added to this file.
gem "bootsnap", ">= 1.1.0", require: false
gem "bootstrap-sass"
gem "jbuilder"
gem "jquery-rails"
gem "mini_racer"
gem "puma"
gem "rails_12factor"
gem "ruby-lint", require: false
gem "sass-rails"
gem "scss_lint", require: false
gem "sdoc", group: :doc
gem "spring"
gem "sprockets"
gem "sqlite3"
gem "turbolinks"
gem "uglifier"
gem "web-console", group: :development

# below are copied from spec/dummy/Gemfile
gem "capybara"
gem "capybara-screenshot"
gem "launchy"
gem "rspec-rails"
gem "rspec-retry"
gem "selenium-webdriver"
gem "webpacker", ">= 5.2.1"

gem "equivalent-xml", github: "mbklein/equivalent-xml"
gem "rainbow"
# gem "bootsnap", ">= 1.1.0", require: false
# gem "bootstrap-sass"
# gem "jbuilder"
# gem "jquery-rails"
# gem "mini_racer"
# gem "puma"
# gem "rails_12factor"
# gem "sass-rails"
# gem "scss_lint", require: false
# gem "sdoc", group: :doc
# gem "spring"
# gem "sprockets"
# gem "sqlite3"
# gem "turbolinks"
# gem "uglifier"
# gem "web-console", group: :development
#
# # below are copied from spec/dummy/Gemfile
# gem "capybara"
# gem "capybara-screenshot"
# gem "launchy"
# gem "rspec-rails"
# gem "rspec-retry"
# gem "selenium-webdriver"
# gem "webpacker", ">= 5.2.1"
#
# gem "equivalent-xml", github: "mbklein/equivalent-xml"
# gem "rainbow"
2 changes: 1 addition & 1 deletion lib/react_on_rails/test_helper/webpack_assets_compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class WebpackAssetsCompiler
def compile_assets
if ReactOnRails.configuration.build_test_command.blank?
msg = <<~MSG
You are using the React on Rails test helper.
You are using the React on Rails test helper.
Either you used:
ReactOnRails::TestHelper.configure_rspec_to_compile_assets or
ReactOnRails::TestHelper.ensure_assets_compiled
Expand Down
2 changes: 1 addition & 1 deletion lib/react_on_rails/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def self.wrap_message(msg, color = :red)
end

def self.object_to_boolean(value)
[true, "true", "yes", 1, "1", "t"].include?(value.class == String ? value.downcase : value)
[true, "true", "yes", 1, "1", "t"].include?(value.instance_of?(String) ? value.downcase : value)
end

def self.server_rendering_is_enabled?
Expand Down
8 changes: 4 additions & 4 deletions lib/tasks/assets.rake
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ end
namespace :react_on_rails do
namespace :assets do
desc <<-DESC.strip_heredoc
Compile assets with webpack
Uses command defined with ReactOnRails.configuration.build_production_command
sh "#{ReactOnRails::Utils.prepend_cd_node_modules_directory('<ReactOnRails.configuration.build_production_command>')}"
Note: This command is not automatically added to assets:precompile if the rails/webpacker
Compile assets with webpack
Uses command defined with ReactOnRails.configuration.build_production_command
sh "#{ReactOnRails::Utils.prepend_cd_node_modules_directory('<ReactOnRails.configuration.build_production_command>')}"
Note: This command is not automatically added to assets:precompile if the rails/webpacker
configuration file config/webpack/production.js exists.
DESC
task webpack: :locale do
Expand Down
5 changes: 0 additions & 5 deletions rakelib/docker.rake
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ namespace :docker do
sh "docker-compose run lint rake lint:rubocop"
end

desc "Run ruby-lint linter from docker"
task :ruby do
sh "docker-compose run lint rake lint:ruby"
end

desc "Run scss-lint linter from docker"
task :scss do
sh "docker-compose run lint rake lint:scss"
Expand Down
8 changes: 1 addition & 7 deletions rakelib/lint.rake
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ namespace :lint do
sh_in_dir(gem_root, "bundle exec rubocop .")
end

desc "Run ruby-lint as shell"
task :ruby do
puts "See /ruby-lint.yml for what directories are included."
sh_in_dir(gem_root, "bundle exec ruby-lint .")
end

desc "Run scss-lint as shell"
task :scss do
sh_in_dir(gem_root, "bundle exec scss-lint spec/dummy/app/assets/stylesheets/")
Expand All @@ -26,7 +20,7 @@ namespace :lint do
sh_in_dir(gem_root, "yarn run eslint")
end

desc "Run all eslint & rubocop linters. Skip ruby-lint and scss"
desc "Run all eslint & rubocop linters. Skip scss"
task lint: %i[eslint rubocop] do
puts "Completed all linting"
end
Expand Down
25 changes: 0 additions & 25 deletions ruby-lint.yml

This file was deleted.

5 changes: 2 additions & 3 deletions spec/dummy/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ gem "sdoc", group: :doc
# Use Unicorn as the app server
# gem 'unicorn'

gem "sprockets", "~>3.0"
gem "sprockets"

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
Expand All @@ -55,8 +55,7 @@ group :development, :test do
gem "pry-doc"
gem "pry-rails"
gem "pry-rescue"
gem "rubocop", require: false
gem "ruby-lint", require: false
gem "rubocop", "0.93.1", require: false
gem "scss_lint", require: false

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
Expand Down
21 changes: 8 additions & 13 deletions spec/dummy/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ GEM
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
parallel (1.19.2)
parser (2.7.1.5)
parser (2.7.2.0)
ast (~> 2.4.1)
pry (0.13.1)
coderay (~> 1.1)
Expand Down Expand Up @@ -207,7 +207,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
rdoc (6.2.1)
regexp_parser (1.8.1)
regexp_parser (1.8.2)
rexml (3.2.4)
rspec-core (3.9.2)
rspec-support (~> 3.9.3)
Expand All @@ -230,20 +230,17 @@ GEM
rspec-support (3.9.3)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (0.92.0)
rubocop (0.93.1)
parallel (~> 1.10)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
regexp_parser (>= 1.8)
rexml
rubocop-ast (>= 0.5.0)
rubocop-ast (>= 0.6.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.7.1)
rubocop-ast (1.0.1)
parser (>= 2.7.1.5)
ruby-lint (2.3.1)
parser (~> 2.2)
slop (~> 3.4, >= 3.4.7)
ruby-progressbar (1.10.1)
rubyzip (1.3.0)
sass (3.7.4)
Expand Down Expand Up @@ -274,7 +271,6 @@ GEM
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
slop (3.6.0)
spring (2.1.1)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -345,14 +341,13 @@ DEPENDENCIES
rspec-rails
rspec-retry
rspec_junit_formatter
rubocop
ruby-lint
rubocop (= 0.93.1)
sass-rails
scss_lint
sdoc
selenium-webdriver
spring
sprockets (~> 3.0)
sprockets
sqlite3
turbolinks
uglifier
Expand Down
6 changes: 4 additions & 2 deletions spec/dummy/bin/bundle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')
# frozen_string_literal: true

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
load Gem.bin_path("bundler", "bundle")
14 changes: 8 additions & 6 deletions spec/dummy/bin/bundler
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'bundler' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'
require "rubygems"
require "bundler/setup"

load Gem.bin_path('bundler', 'bundler')
load Gem.bin_path("bundler", "bundler")
14 changes: 8 additions & 6 deletions spec/dummy/bin/byebug
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'byebug' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'
require "rubygems"
require "bundler/setup"

load Gem.bin_path('byebug', 'byebug')
load Gem.bin_path("byebug", "byebug")
14 changes: 8 additions & 6 deletions spec/dummy/bin/cdiff
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'cdiff' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'
require "rubygems"
require "bundler/setup"

load Gem.bin_path('term-ansicolor', 'cdiff')
load Gem.bin_path("term-ansicolor", "cdiff")
14 changes: 8 additions & 6 deletions spec/dummy/bin/chromedriver
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'chromedriver' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'
require "rubygems"
require "bundler/setup"

load Gem.bin_path('chromedriver-helper', 'chromedriver')
load Gem.bin_path("chromedriver-helper", "chromedriver")
14 changes: 8 additions & 6 deletions spec/dummy/bin/chromedriver-update
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'chromedriver-update' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'
require "rubygems"
require "bundler/setup"

load Gem.bin_path('chromedriver-helper', 'chromedriver-update')
load Gem.bin_path("chromedriver-helper", "chromedriver-update")

0 comments on commit 45a2123

Please sign in to comment.