Skip to content

Commit ea83ba5

Browse files
committed
Update RuboCop
Resolve new offenses. Require Ruby 2.4 or greater.
1 parent 9aeed06 commit ea83ba5

File tree

18 files changed

+45
-22
lines changed

18 files changed

+45
-22
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ end_of_line = lf
77
charset = utf-8
88
trim_trailing_whitespace = true
99
insert_final_newline = true
10+
max_line_length = 120

.rubocop.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
AllCops:
2-
TargetRubyVersion: 2.1
2+
TargetRubyVersion: 2.4
3+
NewCops: enable
34

4-
Eval:
5-
Exclude:
6-
- "Rakefile"
5+
Layout/LineLength:
6+
Max: 120
77

88
Layout/EmptyLinesAroundBlockBody:
99
Enabled: false
@@ -21,9 +21,6 @@ Metrics/BlockLength:
2121
Exclude:
2222
- "spec/**/*"
2323

24-
Metrics/LineLength:
25-
Max: 120
26-
2724
Metrics/MethodLength:
2825
Max: 30
2926

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: ruby
22
rvm:
3-
- 2.3
3+
- 2.4
44
- 2.5
55
- 2.6

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ group :development do
99
gem "highline"
1010
gem "listen", "~> 3.0"
1111
gem "rake", "~> 12.3"
12-
gem "rubocop", "~> 0.57.2", "<= 0.58", require: false
12+
gem "rubocop", "~> 0.89.0", require: false
1313
end
1414

1515
group :test do

clamp.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ Gem::Specification.new do |s|
2424
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
2525
s.require_paths = ["lib"]
2626

27+
s.required_ruby_version = "~> 2.4"
2728
end

lib/clamp/attribute/declaration.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def define_reader_for(attribute)
3030

3131
def define_default_for(attribute)
3232
return false if attribute.default_value.nil?
33+
3334
define_method(attribute.default_method) do
3435
attribute.default_value
3536
end

lib/clamp/attribute/definition.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ def default_description
9595
("$#{@environment_variable}" if defined?(@environment_variable)),
9696
(@default_value.inspect if defined?(@default_value))
9797
].compact
98+
9899
return nil if default_sources.empty?
100+
99101
"#{Clamp.message(:default)}: " + default_sources.join(", #{Clamp.message(:or)} ")
100102
end
101103

lib/clamp/attribute/instance.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def default_from_environment
7070
return if self.defined?
7171
return if attribute.environment_variable.nil?
7272
return unless ENV.key?(attribute.environment_variable)
73+
7374
# Set the parameter value if it's environment variable is present
7475
value = ENV[attribute.environment_variable]
7576
begin

lib/clamp/help.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def usage(usage)
1414
@declared_usage_descriptions << usage
1515
end
1616

17-
attr_reader :declared_usage_descriptions
17+
attr_reader :declared_usage_descriptions, :description
1818

1919
def description=(description)
2020
@description = description.dup
@@ -29,8 +29,6 @@ def banner(description)
2929
self.description = description
3030
end
3131

32-
attr_reader :description
33-
3432
def derived_usage_description
3533
parts = ["[OPTIONS]"]
3634
parts += parameters.map(&:name)
@@ -84,19 +82,20 @@ def row(lhs, rhs)
8482
end
8583

8684
def add_usage(invocation_path, usage_descriptions)
87-
line Clamp.message(:usage_heading) + ":"
85+
line "#{Clamp.message(:usage_heading)}:"
8886
usage_descriptions.each do |usage|
8987
line " #{invocation_path} #{usage}".rstrip
9088
end
9189
end
9290

9391
def add_description(description)
9492
return unless description
93+
9594
line
9695
line description.gsub(/^/, " ")
9796
end
9897

99-
DETAIL_FORMAT = " %-29s %s".freeze
98+
DETAIL_FORMAT = " %-29s %s"
10099

101100
def add_list(heading, items)
102101
line

lib/clamp/option/declaration.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def recognised_options
4040

4141
def declare_implicit_help_option
4242
return false if effective_options.find { |o| o.handles?("--help") }
43+
4344
help_switches = ["--help"]
4445
help_switches.unshift("-h") unless effective_options.find { |o| o.handles?("-h") }
4546
option help_switches, :flag, "print help" do
@@ -55,6 +56,7 @@ def effective_options
5556

5657
def options_declared_on(ancestor)
5758
return [] unless ancestor.is_a?(Clamp::Option::Declaration)
59+
5860
ancestor.declared_options
5961
end
6062

0 commit comments

Comments
 (0)