Style/NumericLiterals:
MinDigits: 11
-# Offense count: 23
-Style/RegexpLiteral:
- MaxSlashes: 4
-
-# Offense count: 8
-Style/SelfAssignment:
- Enabled: false
-
# Offense count: 6548
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/StringLiterals:
Enabled: false
-
-# Offense count: 3
-Style/UnlessElse:
- Enabled: false
notifies :reload, "service[apache2]" if enabled?
end
- updated = updated || t.updated_by_last_action?
+ updated ||= t.updated_by_last_action?
end
new_resource.updated_by_last_action(updated)
name !~ /(?:^|#{Regexp.escape(::File::SEPARATOR)})\.\.?$/
end
)
- files_to_purge = files_to_purge - files_transferred
+ files_to_purge -= files_transferred
purge_unmanaged_files(files_to_purge)
end
end
relay_to_domains = node[:exim][:relay_to_domains]
node[:exim][:routes].each_value do |route|
- relay_to_domains = relay_to_domains | route[:domains] if route[:host]
+ relay_to_domains |= route[:domains] if route[:host]
end
relay_from_hosts = node[:exim][:relay_from_hosts]
if node[:exim][:smarthost_name]
search(:node, "exim_smarthost_via:#{node[:exim][:smarthost_name]}\\:*").each do |host|
- relay_from_hosts = relay_from_hosts | host.ipaddresses(:role => :external)
+ relay_from_hosts |= host.ipaddresses(:role => :external)
end
end
uri = line.split(" ")[1]
case uri
- when /api\/0\.6\/map/ then :map
- when /api\/0\.6\/changeset\/[0-9]*\/upload/ then :upload
- when /api\/0\.6\/amf/ then :amf
- when /api\/0\.6\/(node|way|relation)\/[0-9]*\/history/ then :history
- when /api\/0\.6\/(node|way|relation)\/[0-9]*\/full/ then :full
- when /api\/0\.6\/trackpoints/ then :trkpts
- when /api\/0\.6\// then :other
+ when %r{api/0\.6/map} then :map
+ when %r{api/0\.6/changeset/[0-9]*/upload} then :upload
+ when %r{api/0\.6/amf} then :amf
+ when %r{api/0\.6/(node|way|relation)/[0-9]*/history} then :history
+ when %r{api/0\.6/(node|way|relation)/[0-9]*/full} then :full
+ when %r{api/0\.6/trackpoints} then :trkpts
+ when %r{api/0\.6/} then :other
else :web
end
end
uri = line.split(" ")[1]
case uri
- when /api\/0\.6\/map/ then :map
- when /api\/0\.6\/changeset\/[0-9]*\/upload/ then :upload
- when /api\/0\.6\/amf/ then :amf
- when /api\/0\.6\/(node|way|relation)\/[0-9]*\/history/ then :history
- when /api\/0\.6\/(node|way|relation)\/[0-9]*\/full/ then :full
- when /api\/0\.6\/trackpoints/ then :trkpts
- when /api\/0\.6\// then :other
+ when %r{api/0\.6/map} then :map
+ when %r{api/0\.6/changeset/[0-9]*/upload} then :upload
+ when %r{api/0\.6/amf} then :amf
+ when %r{api/0\.6/(node|way|relation)/[0-9]*/history} then :history
+ when %r{api/0\.6/(node|way|relation)/[0-9]*/full} then :full
+ when %r{api/0\.6/trackpoints} then :trkpts
+ when %r{api/0\.6/} then :other
else :web
end
end
uri = line.split(" ")[1]
case uri
- when /api\/0\.6\/map/ then :map
- when /api\/0\.6\/changeset\/[0-9]*\/upload/ then :upload
- when /api\/0\.6\/amf/ then :amf
- when /api\/0\.6\/(node|way|relation)\/[0-9]*\/history/ then :history
- when /api\/0\.6\/(node|way|relation)\/[0-9]*\/full/ then :full
- when /api\/0\.6\/trackpoints/ then :trkpts
- when /api\/0\.6\// then :other
+ when %r{api/0\.6/map} then :map
+ when %r{api/0\.6/changeset/[0-9]*/upload/} then :upload
+ when %r{api/0\.6/amf} then :amf
+ when %r{api/0\.6/(node|way|relation)/[0-9]*/history} then :history
+ when %r{api/0\.6/(node|way|relation)/[0-9]*/full} then :full
+ when %r{api/0\.6/trackpoints} then :trkpts
+ when %r{api/0\.6/} then :other
else :web
end
end
variables new_resource.conf_variables
end
- updated = updated || c.updated_by_last_action?
+ updated ||= c.updated_by_last_action?
end
new_resource.updated_by_last_action(updated)
action :delete
end
- updated = updated || c.updated_by_last_action?
+ updated ||= c.updated_by_last_action?
end
new_resource.updated_by_last_action(updated)
package_name = new_resource.package_name
end
- unless @packages.include?(new_resource.package_name)
+ if !@packages.include?(new_resource.package_name)
shell_out!("npm install --global #{package_name}")
new_resource.updated_by_last_action(true)
else
line.gsub!(/^( *)'PASSWORD': '.*',/, "\\1'PASSWORD': '#{database_password}',")
line.gsub!(/^ALLOWED_HOSTS = .*/, "ALLOWED_HOSTS = ('help.openstreetmap.org',)")
line.gsub!(/^CACHE_BACKEND = .*/, "CACHE_BACKEND = 'memcached://127.0.0.1:11211/'")
- line.gsub!(/^APP_URL = 'http:\/\/'/, "APP_URL = 'http://#{name}'")
+ line.gsub!(%r{^APP_URL = 'http://'}, "APP_URL = 'http://#{name}'")
line.gsub!(/^TIME_ZONE = 'America\/New_York'/, "TIME_ZONE = 'Europe/London'")
line.gsub!(/^DISABLED_MODULES = \[([^\]]+)\]/, "DISABLED_MODULES = [\\1, 'localauth', 'facebookauth', 'oauthauth']")
end
action :create do
- unless @pg.databases.include?(new_resource.database)
+ if !@pg.databases.include?(new_resource.database)
@pg.execute(:command => "CREATE DATABASE \"#{new_resource.database}\" OWNER \"#{new_resource.owner}\" TEMPLATE template0 ENCODING '#{new_resource.encoding}' LC_COLLATE '#{new_resource.collation}' LC_CTYPE '#{new_resource.ctype}'")
new_resource.updated_by_last_action(true)
else
createrole = new_resource.createrole ? "CREATEROLE" : "NOCREATEROLE"
replication = new_resource.replication ? "REPLICATION" : "NOREPLICATION"
- unless @pg.users.include?(new_resource.user)
+ if !@pg.users.include?(new_resource.user)
@pg.execute(:command => "CREATE ROLE \"#{new_resource.user}\" LOGIN #{password} #{superuser} #{createdb} #{createrole}")
new_resource.updated_by_last_action(true)
else
if node[:exim][:smarthost_name]
search(:node, "exim_smarthost_via:#{node[:exim][:smarthost_name]}\\:*").each do |host|
- trusted_networks = trusted_networks | host.ipaddresses(:role => :external)
+ trusted_networks |= host.ipaddresses(:role => :external)
end
end
-trusted_networks = trusted_networks - ["127.0.0.1", "::1"]
+trusted_networks -= ["127.0.0.1", "::1"]
template "/etc/spamassassin/local.cf" do
source "local.cf.erb"
line.gsub!(/^CGIMAP_LOGFILE=.*;/, "CGIMAP_LOGFILE=#{log_directory}/cgimap.log;")
line.gsub!(/^CGIMAP_MEMCACHE=.*;/, "CGIMAP_MEMCACHE=rails1,rails2,rails3;")
- line.gsub!(/\/home\/rails\/bin\/map/, "#{cgimap_directory}/map")
+ line.gsub!(%r{/home/rails/bin/map}, "#{cgimap_directory}/map")
if database_readonly
line.gsub!(/--daemon/, "--daemon --readonly")