Commit f9172d553eb1ec543f22944587216a6a6c1d4cb3

Authored by Laust Rud Jacobsen
1 parent 92035d31
Exists in master and in 1 other branch production

Rubocop: simplify regexp literals with slashes in them

.rubocop_todo.yml
@@ -220,15 +220,6 @@ Style/Proc: @@ -220,15 +220,6 @@ Style/Proc:
220 - 'app/models/notice.rb' 220 - 'app/models/notice.rb'
221 - 'app/models/problem.rb' 221 - 'app/models/problem.rb'
222 222
223 -# Offense count: 3  
224 -# Cop supports --auto-correct.  
225 -# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.  
226 -Style/RegexpLiteral:  
227 - Exclude:  
228 - - 'app/models/app.rb'  
229 - - 'config/initializers/ssl_enforcer.rb'  
230 - - 'config/load.rb'  
231 -  
232 # Offense count: 1 223 # Offense count: 1
233 # Configuration parameters: Methods. 224 # Configuration parameters: Methods.
234 Style/SingleLineBlockParams: 225 Style/SingleLineBlockParams:
app/models/app.rb
@@ -214,7 +214,7 @@ protected @@ -214,7 +214,7 @@ protected
214 github_host = URI.parse(Errbit::Config.github_url).host 214 github_host = URI.parse(Errbit::Config.github_url).host
215 github_host = Regexp.escape(github_host) 215 github_host = Regexp.escape(github_host)
216 github_repo.strip! 216 github_repo.strip!
217 - github_repo.sub!(/(git@|https?:\/\/)#{github_host}(\/|:)/, '') 217 + github_repo.sub!(%r{(git@|https?://)#{github_host}(/|:)}, '')
218 github_repo.sub!(/\.git$/, '') 218 github_repo.sub!(/\.git$/, '')
219 end 219 end
220 end 220 end
config/initializers/ssl_enforcer.rb
@@ -3,6 +3,6 @@ if Errbit::Config.enforce_ssl @@ -3,6 +3,6 @@ if Errbit::Config.enforce_ssl
3 require 'rack/ssl-enforcer' 3 require 'rack/ssl-enforcer'
4 ActionMailer::Base.default_url_options.merge!(:protocol => 'https://') 4 ActionMailer::Base.default_url_options.merge!(:protocol => 'https://')
5 Rails.application.configure do 5 Rails.application.configure do
6 - config.middleware.use Rack::SslEnforcer, :except => /^\/deploys/ 6 + config.middleware.use Rack::SslEnforcer, :except => %r{^/deploys}
7 end 7 end
8 end 8 end
config/load.rb
@@ -30,7 +30,7 @@ Errbit::Config = Configurator.run({ @@ -30,7 +30,7 @@ Errbit::Config = Configurator.run({
30 30
31 # github 31 # github
32 github_url: ['GITHUB_URL', ->(values) { 32 github_url: ['GITHUB_URL', ->(values) {
33 - values[:github_url].gsub(/\/*\z/, '') 33 + values[:github_url].gsub(%r{/*\z}, '')
34 }], 34 }],
35 github_authentication: ['GITHUB_AUTHENTICATION'], 35 github_authentication: ['GITHUB_AUTHENTICATION'],
36 github_client_id: ['GITHUB_CLIENT_ID'], 36 github_client_id: ['GITHUB_CLIENT_ID'],