Skip to content

Commit ca1c336

Browse files
committed
configure Brakeman and rubocop
1 parent e67e1bb commit ca1c336

File tree

8 files changed

+50
-17
lines changed

8 files changed

+50
-17
lines changed

.rubocop.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
inherit_from: .rubocop_todo.yml
2+
Style/FrozenStringLiteralComment:
3+
Enabled: false
4+
Metrics/LineLength:
5+
Max: 130
6+
Style/ClassAndModuleChildren:
7+
Enabled: false
8+
Style/MixinUsage:
9+
Enabled: false
10+
Style/Documentation:
11+
Enabled: false
12+
Style/ExpandPathArguments:
13+
Enabled: false

.rubocop_todo.yml

Whitespace-only changes.

Gemfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ruby '2.6.3'
55

66
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
77
gem 'rails', '~> 5.2.3'
8-
#For database
8+
# For database
99
gem 'pg'
1010
# Use Puma as the app server
1111
gem 'puma', '~> 3.11'
@@ -30,16 +30,20 @@ gem 'bootsnap', '>= 1.1.0', require: false
3030

3131
group :development, :test do
3232
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
33-
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
33+
gem 'byebug', platforms: %i[mri mingw x64_mingw]
3434
end
3535

3636
group :development do
3737
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
38-
gem 'web-console', '>= 3.3.0'
3938
gem 'listen', '>= 3.0.5', '< 3.2'
39+
gem 'web-console', '>= 3.3.0'
4040
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
4141
gem 'spring'
4242
gem 'spring-watcher-listen', '~> 2.0.0'
43+
# Brakeman is a static analysis tool which checks Ruby on Rails applications for security vulnerabilities.
44+
gem 'brakeman'
45+
# RuboCop is a Ruby static code analyzer and code formatter
46+
gem 'rubocop', require: false
4347
end
4448

4549
group :test do
@@ -51,4 +55,4 @@ group :test do
5155
end
5256

5357
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
54-
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
58+
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

Gemfile.lock

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ GEM
4747
archive-zip (0.12.0)
4848
io-like (~> 0.3.0)
4949
arel (9.0.0)
50+
ast (2.4.0)
5051
bindex (0.8.1)
5152
bootsnap (1.4.5)
5253
msgpack (~> 1.0)
54+
brakeman (4.6.1)
5355
builder (3.2.3)
5456
byebug (11.0.1)
5557
capybara (3.29.0)
@@ -82,6 +84,7 @@ GEM
8284
i18n (1.6.0)
8385
concurrent-ruby (~> 1.0)
8486
io-like (0.3.0)
87+
jaro_winkler (1.5.3)
8588
jbuilder (2.9.1)
8689
activesupport (>= 4.2.0)
8790
listen (3.1.5)
@@ -104,6 +107,9 @@ GEM
104107
nio4r (2.5.2)
105108
nokogiri (1.10.4)
106109
mini_portile2 (~> 2.4.0)
110+
parallel (1.17.0)
111+
parser (2.6.4.1)
112+
ast (~> 2.4.0)
107113
pg (1.1.4)
108114
public_suffix (4.0.1)
109115
puma (3.12.1)
@@ -134,11 +140,20 @@ GEM
134140
method_source
135141
rake (>= 0.8.7)
136142
thor (>= 0.19.0, < 2.0)
143+
rainbow (3.0.0)
137144
rake (12.3.3)
138145
rb-fsevent (0.10.3)
139146
rb-inotify (0.10.0)
140147
ffi (~> 1.0)
141148
regexp_parser (1.6.0)
149+
rubocop (0.74.0)
150+
jaro_winkler (~> 1.5.1)
151+
parallel (~> 1.10)
152+
parser (>= 2.6)
153+
rainbow (>= 2.2.2, < 4.0)
154+
ruby-progressbar (~> 1.7)
155+
unicode-display_width (>= 1.4.0, < 1.7)
156+
ruby-progressbar (1.10.1)
142157
ruby_dep (1.5.0)
143158
rubyzip (1.3.0)
144159
sass (3.7.4)
@@ -176,6 +191,7 @@ GEM
176191
thread_safe (~> 0.1)
177192
uglifier (4.2.0)
178193
execjs (>= 0.3.0, < 3)
194+
unicode-display_width (1.6.0)
179195
web-console (3.7.0)
180196
actionview (>= 5.0)
181197
activemodel (>= 5.0)
@@ -192,6 +208,7 @@ PLATFORMS
192208

193209
DEPENDENCIES
194210
bootsnap (>= 1.1.0)
211+
brakeman
195212
byebug
196213
capybara (>= 2.15)
197214
chromedriver-helper
@@ -201,6 +218,7 @@ DEPENDENCIES
201218
pg
202219
puma (~> 3.11)
203220
rails (~> 5.2.3)
221+
rubocop
204222
sass-rails (~> 5.0)
205223
selenium-webdriver
206224
spring

bin/yarn

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#!/usr/bin/env ruby
22
APP_ROOT = File.expand_path('..', __dir__)
33
Dir.chdir(APP_ROOT) do
4-
begin
5-
exec "yarnpkg", *ARGV
6-
rescue Errno::ENOENT
7-
$stderr.puts "Yarn executable was not detected in the system."
8-
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9-
exit 1
10-
end
4+
exec 'yarnpkg', *ARGV
5+
rescue Errno::ENOENT
6+
warn 'Yarn executable was not detected in the system.'
7+
warn 'Download Yarn at https://yarnpkg.com/en/docs/install'
8+
exit 1
119
end

config/environments/production.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
config.log_level = :debug
5555

5656
# Prepend all log lines with the following tags.
57-
config.log_tags = [ :request_id ]
57+
config.log_tags = [:request_id]
5858

5959
# Use a different cache store in production.
6060
# config.cache_store = :mem_cache_store
@@ -83,7 +83,7 @@
8383
# require 'syslog/logger'
8484
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
8585

86-
if ENV["RAILS_LOG_TO_STDOUT"].present?
86+
if ENV['RAILS_LOG_TO_STDOUT'].present?
8787
logger = ActiveSupport::Logger.new(STDOUT)
8888
logger.formatter = config.log_formatter
8989
config.logger = ActiveSupport::TaggedLogging.new(logger)

config/puma.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
# the maximum value specified for Puma. Default is set to 5 threads for minimum
55
# and maximum; this matches the default thread size of Active Record.
66
#
7-
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
7+
threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
88
threads threads_count, threads_count
99

1010
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
1111
#
12-
port ENV.fetch("PORT") { 3000 }
12+
port ENV.fetch('PORT') { 3000 }
1313

1414
# Specifies the `environment` that Puma will run in.
1515
#
16-
environment ENV.fetch("RAILS_ENV") { "development" }
16+
environment ENV.fetch('RAILS_ENV') { 'development' }
1717

1818
# Specifies the number of `workers` to boot in clustered mode.
1919
# Workers are forked webserver processes. If using threads and workers together

test/application_system_test_case.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require "test_helper"
1+
require 'test_helper'
22

33
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
44
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]

0 commit comments

Comments
 (0)