Skip to content

Commit 2022e16

Browse files
committed
Ignoring Procfiles for rubocop. Auto-fixing rubocop warnings
1 parent 41a6158 commit 2022e16

File tree

11 files changed

+34
-36
lines changed

11 files changed

+34
-36
lines changed

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ AllCops:
77
Include:
88
- '**/Rakefile'
99
- '**/config.ru'
10+
- '**/Gemfile'
1011
Exclude:
1112
- 'vendor/**/*'
1213
- 'spec/fixtures/**/*'
@@ -16,6 +17,7 @@ AllCops:
1617
- 'db/seeds.rb'
1718
- 'client/node_modules/**/*'
1819
- 'bin/**/*'
20+
- 'Procfile.*'
1921
- !ruby/regexp /old_and_unused\.rb$/
2022

2123
Metrics/LineLength:

Gemfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ ruby "2.4.1"
33

44
#
55
# Bundle edge Rails instead: gem "rails", github: "rails/rails"
6-
gem "rails"
76
gem "listen"
7+
gem "rails"
88

99
# Note: We're using sqllite3 for development and testing
1010
# gem "sqlite3", group: [:development, :test]
@@ -27,7 +27,7 @@ gem "coffee-rails"
2727

2828
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
2929
gem "jbuilder"
30-
gem 'redis'
30+
gem "redis"
3131

3232
# bundle exec rake doc:rails generates the API under doc/api.
3333
gem "sdoc", group: :doc
@@ -65,38 +65,38 @@ group :development, :test do
6565

6666
################################################################################
6767
# Manage application processes
68-
gem "foreman"
6968
gem "factory_girl_rails"
69+
gem "foreman"
7070

7171
################################################################################
7272
# Linters and Security
7373
gem "rubocop", require: false
7474
gem "ruby-lint", require: false
7575
# Critical that require: false be set! https://github.com/brigade/scss-lint/issues/278
76-
gem "scss_lint", require: false
7776
gem "brakeman", require: false
7877
gem "bundler-audit", require: false
78+
gem "scss_lint", require: false
7979

8080
################################################################################
8181
# Favorite debugging gems
8282
gem "pry"
83+
gem "pry-byebug"
8384
gem "pry-doc"
8485
gem "pry-rails"
85-
gem "pry-stack_explorer"
8686
gem "pry-rescue"
87-
gem "pry-byebug"
87+
gem "pry-stack_explorer"
8888

8989
################################################################################
9090
# Color console output
9191
gem "rainbow"
9292
end
9393

94-
group :test do
95-
gem "coveralls", require: false
94+
group :test do
9695
gem "capybara"
9796
gem "capybara-screenshot"
9897
gem "capybara-webkit"
9998
gem "chromedriver-helper"
99+
gem "coveralls", require: false
100100
gem "database_cleaner"
101101
gem "generator_spec"
102102
gem "launchy"

app/controllers/comments_controller.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class CommentsController < ApplicationController
2-
before_action :set_comment, only: [:show, :edit, :update, :destroy]
2+
before_action :set_comment, only: %i[show edit update destroy]
33

44
# GET /comments
55
# GET /comments.json
@@ -9,17 +9,15 @@ def index
99

1010
# GET /comments/1
1111
# GET /comments/1.json
12-
def show
13-
end
12+
def show; end
1413

1514
# GET /comments/new
1615
def new
1716
@comment = Comment.new
1817
end
1918

2019
# GET /comments/1/edit
21-
def edit
22-
end
20+
def edit; end
2321

2422
# POST /comments
2523
# POST /comments.json

app/controllers/pages_controller.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ def no_router
3232
render_html
3333
end
3434

35-
def simple
36-
end
35+
def simple; end
3736

3837
private
3938

app/views/comments/show.json.jbuilder

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
json.partial! 'comment', comment: @comment
1+
json.partial! "comment", comment: @comment

config/initializers/react_on_rails.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
ReactOnRails.configure do |config|
33
# Directory where your generated assets go. All generated assets must go to the same directory.
44
# Configure this in your webpack config files. This relative to your Rails root directory.
5-
config.generated_assets_dir = File.join(%w(app assets webpack))
5+
config.generated_assets_dir = File.join(%w[app assets webpack])
66

77
# Define the files for we need to check for webpack compilation when running tests
8-
config.webpack_generated_files = %w( app-bundle.js vendor-bundle.js app-bundle.css
9-
vendor-bundle.css server-bundle.js )
8+
config.webpack_generated_files = %w[ app-bundle.js vendor-bundle.js app-bundle.css
9+
vendor-bundle.css server-bundle.js ]
1010

1111
# This is the file used for server rendering of React when using `(prerender: true)`
1212
# If you are never using server rendering, you may set this to "".

lib/tasks/brakeman.rake

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
namespace :brakeman do
2-
32
desc "Run Brakeman"
4-
task :run, :output_files do |t, args|
5-
require 'brakeman'
3+
task :run, :output_files do |_t, args|
4+
require "brakeman"
65

7-
files = args[:output_files].split(' ') if args[:output_files]
8-
Brakeman.run :app_path => ".", :output_files => files, :print_report => true
6+
files = args[:output_files].split(" ") if args[:output_files]
7+
Brakeman.run app_path: ".", output_files: files, print_report: true
98
end
109

1110
desc "Check your code with Brakeman"
1211
task :check do
13-
require 'brakeman'
14-
result = Brakeman.run app_path: '.', print_report: true
12+
require "brakeman"
13+
result = Brakeman.run app_path: ".", print_report: true
1514
exit Brakeman::Warnings_Found_Exit_Code unless result.filtered_warnings.empty?
1615
end
1716
end

lib/tasks/ci.rake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ if Rails.env.development? || Rails.env.test?
2525
namespace :ci do
2626
desc "Run all audits and tests"
2727
# rspec_tests must be before lint and js_tests to build the locale files
28-
task all: [:environment, :rspec_tests, :lint, :js_tests, :bundle_audit, :security_audit] do
28+
task all: %i[environment rspec_tests lint js_tests bundle_audit security_audit] do
2929
begin
3030
puts "All CI tasks"
3131
puts Rainbow("PASSED").green
3232
puts ""
3333
rescue Exception => e
34-
puts "#{e}"
34+
puts e.to_s
3535
puts Rainbow("FAILED").red
3636
puts ""
3737
raise(e)

lib/tasks/linters.rake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if %w(development test).include? Rails.env
1+
if %w[development test].include? Rails.env
22
namespace :lint do
33
# require "rubocop/rake_task"
44
# require "slim_lint/rake_task"
@@ -10,9 +10,9 @@ if %w(development test).include? Rails.env
1010
desc "Run Rubocop lint as shell. Specify option fix to auto-correct (and don't have uncommitted files!)."
1111
task :rubocop, [:fix] => [] do |_t, args|
1212
def to_bool(str)
13-
return true if str =~ (/^(true|t|yes|y|1)$/i)
14-
return false if str.blank? || str =~ (/^(false|f|no|n|0)$/i)
15-
fail ArgumentError, "invalid value for Boolean: \"#{str}\""
13+
return true if str =~ /^(true|t|yes|y|1)$/i
14+
return false if str.blank? || str =~ /^(false|f|no|n|0)$/i
15+
raise ArgumentError, "invalid value for Boolean: \"#{str}\""
1616
end
1717

1818
fix = (args.fix == "fix") || to_bool(args.fix)
@@ -54,7 +54,7 @@ if %w(development test).include? Rails.env
5454
desc "See docs for task 'scss_lint'"
5555
task scss: :scss_lint
5656

57-
task lint: [:rubocop, :ruby, :js, :scss] do
57+
task lint: %i[rubocop ruby js scss] do
5858
puts "Completed all linting"
5959
end
6060
end

spec/rails_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555

5656
default_driver = :poltergeist_no_animations
5757

58-
supported_drivers = %i( poltergeist poltergeist_errors_ok
58+
supported_drivers = %i[ poltergeist poltergeist_errors_ok
5959
poltergeist_no_animations webkit
60-
selenium_chrome selenium_firefox selenium)
60+
selenium_chrome selenium_firefox selenium]
6161
driver = ENV["DRIVER"].try(:to_sym) || default_driver
6262
Capybara.default_driver = driver
6363

spec/support/poltergeist.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# 2. restart_poltergeist
44

55
RESTART_PHANTOMJS = ENV["RESTART_PHANTOMJS"] &&
6-
%w(TRUE YES).include?(ENV["RESTART_PHANTOMJS"].upcase)
6+
%w[TRUE YES].include?(ENV["RESTART_PHANTOMJS"].upcase)
77
puts "RESTART_PHANTOMJS = #{RESTART_PHANTOMJS}"
88

99
CAPYBARA_TIMEOUT_RETRIES = 5

0 commit comments

Comments
 (0)