Skip to content

Commit c7c277b

Browse files
committed
Rubocop Updates
A recent upgrade to Rubocop caused a number of new failures. This change fixes those failures.
1 parent 348162c commit c7c277b

36 files changed

Lines changed: 300 additions & 299 deletions

java-buildpack.iml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -271,31 +271,32 @@
271271
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.3.5, rbenv: 1.9.3-p484) [gem]" level="application" />
272272
<orderEntry type="library" scope="PROVIDED" name="ast (v1.1.0, rbenv: 1.9.3-p484) [gem]" level="application" />
273273
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.5.3, rbenv: 1.9.3-p484) [gem]" level="application" />
274-
<orderEntry type="library" scope="PROVIDED" name="codeclimate-test-reporter (v0.2.0, rbenv: 1.9.3-p484) [gem]" level="application" />
275-
<orderEntry type="library" scope="PROVIDED" name="crack (v0.4.1, rbenv: 1.9.3-p484) [gem]" level="application" />
276-
<orderEntry type="library" scope="PROVIDED" name="debugger-ruby_core_source (v1.2.4, rbenv: 1.9.3-p484) [gem]" level="application" />
274+
<orderEntry type="library" scope="PROVIDED" name="codeclimate-test-reporter (v0.3.0, rbenv: 1.9.3-p484) [gem]" level="application" />
275+
<orderEntry type="library" scope="PROVIDED" name="crack (v0.4.2, rbenv: 1.9.3-p484) [gem]" level="application" />
276+
<orderEntry type="library" scope="PROVIDED" name="debugger-ruby_core_source (v1.3.1, rbenv: 1.9.3-p484) [gem]" level="application" />
277277
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, rbenv: 1.9.3-p484) [gem]" level="application" />
278-
<orderEntry type="library" scope="PROVIDED" name="docile (v1.1.1, rbenv: 1.9.3-p484) [gem]" level="application" />
279-
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.8.2, rbenv: 1.9.3-p484) [gem]" level="application" />
280-
<orderEntry type="library" scope="PROVIDED" name="parser (v2.0.0, rbenv: 1.9.3-p484) [gem]" level="application" />
278+
<orderEntry type="library" scope="PROVIDED" name="docile (v1.1.3, rbenv: 1.9.3-p484) [gem]" level="application" />
279+
<orderEntry type="library" scope="PROVIDED" name="json (v1.8.1, rbenv: 1.9.3-p484) [gem]" level="application" />
280+
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.8.4, rbenv: 1.9.3-p484) [gem]" level="application" />
281+
<orderEntry type="library" scope="PROVIDED" name="parser (v2.1.4, rbenv: 1.9.3-p484) [gem]" level="application" />
281282
<orderEntry type="library" scope="PROVIDED" name="powerpack (v0.0.9, rbenv: 1.9.3-p484) [gem]" level="application" />
282-
<orderEntry type="library" scope="PROVIDED" name="rainbow (v1.1.4, rbenv: 1.9.3-p484) [gem]" level="application" />
283-
<orderEntry type="library" scope="PROVIDED" name="rake (v10.1.0, rbenv: 1.9.3-p484) [gem]" level="application" />
284-
<orderEntry type="library" scope="PROVIDED" name="redcarpet (v3.0.0, rbenv: 1.9.3-p484) [gem]" level="application" />
283+
<orderEntry type="library" scope="PROVIDED" name="rainbow (v2.0.0, rbenv: 1.9.3-p484) [gem]" level="application" />
284+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.1.1, rbenv: 1.9.3-p484) [gem]" level="application" />
285+
<orderEntry type="library" scope="PROVIDED" name="redcarpet (v3.1.0, rbenv: 1.9.3-p484) [gem]" level="application" />
285286
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.0.0.beta1, rbenv: 1.9.3-p484) [gem]" level="application" />
286287
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.0.0.beta1, rbenv: 1.9.3-p484) [gem]" level="application" />
287288
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.0.0.beta1, rbenv: 1.9.3-p484) [gem]" level="application" />
288289
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.0.0.beta1, rbenv: 1.9.3-p484) [gem]" level="application" />
289290
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.0.0.beta1, rbenv: 1.9.3-p484) [gem]" level="application" />
290-
<orderEntry type="library" scope="PROVIDED" name="rubocop (v0.15.0, rbenv: 1.9.3-p484) [gem]" level="application" />
291+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v0.18.1, rbenv: 1.9.3-p484) [gem]" level="application" />
291292
<orderEntry type="library" scope="PROVIDED" name="ruby-debug-base19x (v0.11.30.pre15, rbenv: 1.9.3-p484) [gem]" level="application" />
292293
<orderEntry type="library" scope="PROVIDED" name="ruby-debug-ide (v0.4.22, rbenv: 1.9.3-p484) [gem]" level="application" />
293-
<orderEntry type="library" scope="PROVIDED" name="safe_yaml (v0.9.7, rbenv: 1.9.3-p484) [gem]" level="application" />
294+
<orderEntry type="library" scope="PROVIDED" name="safe_yaml (v1.0.1, rbenv: 1.9.3-p484) [gem]" level="application" />
294295
<orderEntry type="library" scope="PROVIDED" name="simplecov (v0.8.2, rbenv: 1.9.3-p484) [gem]" level="application" />
295296
<orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.8.0, rbenv: 1.9.3-p484) [gem]" level="application" />
296297
<orderEntry type="library" scope="PROVIDED" name="slop (v3.4.7, rbenv: 1.9.3-p484) [gem]" level="application" />
297298
<orderEntry type="library" scope="PROVIDED" name="tee (v1.0.0, rbenv: 1.9.3-p484) [gem]" level="application" />
298-
<orderEntry type="library" scope="PROVIDED" name="webmock (v1.16.0, rbenv: 1.9.3-p484) [gem]" level="application" />
299+
<orderEntry type="library" scope="PROVIDED" name="webmock (v1.17.3, rbenv: 1.9.3-p484) [gem]" level="application" />
299300
<orderEntry type="library" scope="PROVIDED" name="yard (v0.8.7.3, rbenv: 1.9.3-p484) [gem]" level="application" />
300301
</component>
301302
<component name="RModuleSettingsStorage">

lib/java_buildpack/container/spring_boot_cli.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def release
5151
# @macro versioned_dependency_component_supports
5252
def supports?
5353
gf = JavaBuildpack::Util::GroovyUtils.groovy_files(@application)
54-
gf.length > 0 && all_pogo_or_configuration(gf) && no_main_method(gf) && no_shebang(gf) && !has_web_inf
54+
gf.length > 0 && all_pogo_or_configuration(gf) && no_main_method(gf) && no_shebang(gf) && !web_inf?
5555
end
5656

5757
private
@@ -72,7 +72,7 @@ def no_shebang(groovy_files)
7272
none?(groovy_files) { |file| JavaBuildpack::Util::GroovyUtils.shebang? file }
7373
end
7474

75-
def has_web_inf
75+
def web_inf?
7676
(@application.root + 'WEB-INF').exist?
7777
end
7878

lib/java_buildpack/framework/maria_db_jdbc.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ def release
3838

3939
# @macro versioned_dependency_component_supports
4040
def supports?
41-
has_service? && !has_driver?
41+
service? && !driver?
4242
end
4343

4444
private
4545

46-
def has_driver?
46+
def driver?
4747
%w(mariadb-java-client*.jar mysql-connector-java*.jar).any? do |candidate|
4848
(@application.root + '**' + candidate).glob.any?
4949
end
5050
end
5151

52-
def has_service?
52+
def service?
5353
[/mysql/, /mariadb/].any? { |filter| @application.services.one_service? filter, 'uri' }
5454
end
5555
end

lib/java_buildpack/framework/play_framework_jpa_plugin.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def play20?(version)
5656
end
5757

5858
def uses_jpa?(play_app)
59-
play_app.has_jar? /.*play-java-jpa.*\.jar/
59+
play_app.jar?(/.*play-java-jpa.*\.jar/)
6060
end
6161

6262
end

lib/java_buildpack/framework/postgresql_jdbc.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ def release
3838

3939
# @macro versioned_dependency_component_supports
4040
def supports?
41-
has_service? && !has_driver?
41+
service? && !driver?
4242
end
4343

4444
private
4545

46-
def has_driver?
46+
def driver?
4747
(@application.root + '**/postgresql-*.jar').glob.any?
4848
end
4949

50-
def has_service?
51-
@application.services.one_service? /postgres/, 'uri'
50+
def service?
51+
@application.services.one_service?(/postgres/, 'uri')
5252
end
5353
end
5454

lib/java_buildpack/jre/memory/memory_bucket.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,16 @@ def validate_name(name)
6161
end
6262

6363
def validate_weighting(weighting)
64-
fail diagnose_weighting(weighting, 'not numeric') unless is_numeric weighting
64+
fail diagnose_weighting(weighting, 'not numeric') unless numeric? weighting
6565
fail diagnose_weighting(weighting, 'negative') if weighting < 0
6666
weighting
6767
end
6868

6969
def diagnose_weighting(weighting, reason)
70-
"Invalid weighting '#{@weighting}' for #{identify} : #{reason}"
70+
"Invalid weighting '#{weighting}' for #{identify} : #{reason}"
7171
end
7272

73-
def is_numeric(w)
73+
def numeric?(w)
7474
Float(w) rescue false
7575
end
7676

lib/java_buildpack/jre/memory/memory_size.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def initialize(size)
3232
fail "Invalid memory size '#{size}'" if !size || size.length < 2
3333
unit = size[-1]
3434
v = size[0..-2]
35-
fail "Invalid memory size '#{size}'" unless is_integer v
35+
fail "Invalid memory size '#{size}'" unless integer? v
3636
v = size.to_i
3737

3838
# Store the number of bytes.
@@ -140,7 +140,7 @@ def memory_size_operation(other)
140140
from_numeric(yield @bytes, other.bytes)
141141
end
142142

143-
def is_integer(v)
143+
def integer?(v)
144144
f = Float(v)
145145
f && f.floor == f
146146
rescue

lib/java_buildpack/jre/memory/weight_balancing_memory_heuristic.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def resolve
5656
allocate_lower_bounds(buckets)
5757
end
5858

59-
set_switches(buckets)
59+
switches(buckets)
6060
end
6161

6262
private
@@ -219,7 +219,7 @@ def check_close_to_default(type, bucket, total_weighting)
219219
end
220220
end
221221

222-
def set_switches(buckets)
222+
def switches(buckets)
223223
buckets.map { |type, bucket| @java_opts[type][bucket.size] if bucket.size && bucket.size > 0 && @java_opts.key?(type) }.flatten(1).compact
224224
end
225225

lib/java_buildpack/util/cache/download_cache.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ def retry_limit
215215
def cache_ready?(immutable_file_cache, uri)
216216
use_internet = InternetAvailability.use_internet?
217217
cached = immutable_file_cache.cached?
218-
has_etag = immutable_file_cache.has_etag?
219-
has_last_modified = immutable_file_cache.has_last_modified?
218+
has_etag = immutable_file_cache.etag?
219+
has_last_modified = immutable_file_cache.last_modified?
220220
@logger.debug { "should_use_cache for #{uri}, inputs: use_internet? = #{use_internet}, cached? = #{cached}, has_etag? = #{has_etag}, has_last_modified? = #{has_last_modified}" }
221221

222222
use_cache = false

lib/java_buildpack/util/cache/file_cache.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ def cached?
9999
# Returns whether or not an etag is stored.
100100
#
101101
# @return [Boolean] +true+ if and only if an etag is stored
102-
def has_etag?
102+
def etag?
103103
@etag.exist?
104104
end
105105

106106
# Returns whether or not a last modified time stamp is stored.
107107
#
108108
# @return [Boolean] +true+ if and only if a last modified time stamp is stored
109-
def has_last_modified?
109+
def last_modified?
110110
@last_modified.exist?
111111
end
112112

0 commit comments

Comments
 (0)