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