Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Lint/UnusedArgument #1033

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ Lint/ShadowingOuterLocalVariable:
Lint/UnusedBlockArgument:
Enabled: false

# Offense count: 108
# Cop supports --auto-correct.
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
Lint/UnusedMethodArgument:
Enabled: false

# Offense count: 60
Metrics/AbcSize:
Max: 99
Expand Down
4 changes: 2 additions & 2 deletions examples/watir/features/support/screenshots.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# browser testing. Just run cucumber with --format html --out report.html
#
# The code below will work on OS X or Windows (with IE Watir only).
# Adding support for other platforms should be easy - as long as there is a
# Adding support for other platforms should be easy - as long as there is a
# ruby library or command line tool to take pictures.
#
module Screenshots
Expand All @@ -21,7 +21,7 @@ def embed_screenshot(id)
end
else
# Other platforms...
def embed_screenshot(id)
def embed_screenshot(_id)
STDERR.puts 'Sorry - no screenshots on your platform yet.'
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/cli/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def to_hash
private

class LogFormatter < ::Logger::Formatter
def call(severity, time, progname, msg)
def call(_severity, _time, _progname, msg)
msg
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/deprecate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def self.call(message, method, remove_after_version)
end

module ForDevelopers
def self.call(message, method, remove_after_version)
def self.call(_message, _method, remove_after_version)
if Cucumber::VERSION > remove_after_version
raise "This method is due for removal after version #{remove_after_version}"
end
Expand Down
54 changes: 27 additions & 27 deletions lib/cucumber/formatter/html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,20 @@ def after_features(features)
@builder << '</html>'
end

def before_feature(feature)
def before_feature(_feature)
@exceptions = []
@builder << '<div class="feature">'
end

def after_feature(feature)
def after_feature(_feature)
@builder << '</div>'
end

def before_comment(comment)
def before_comment(_comment)
@builder << '<pre class="comment">'
end

def after_comment(comment)
def after_comment(_comment)
@builder << '</pre>'
end

Expand All @@ -138,7 +138,7 @@ def comment_line(comment_line)
@builder.br
end

def after_tags(tags)
def after_tags(_tags)
@tag_spacer = nil
end

Expand All @@ -162,21 +162,21 @@ def feature_name(keyword, name)
end
end

def before_test_case(test_case)
def before_test_case(_test_case)
@previous_step_keyword = nil
end

def before_background(background)
def before_background(_background)
@in_background = true
@builder << '<div class="background">'
end

def after_background(background)
def after_background(_background)
@in_background = nil
@builder << '</div>'
end

def background_name(keyword, name, file_colon_line, source_indent)
def background_name(keyword, name, _file_colon_line, _source_indent)
@listing_background = true
@builder.h3(:id => "background_#{@scenario_number}") do |h3|
@builder.span(keyword, :class => 'keyword')
Expand All @@ -193,7 +193,7 @@ def before_feature_element(feature_element)
@in_scenario_outline = feature_element.class == Cucumber::Core::Ast::ScenarioOutline
end

def after_feature_element(feature_element)
def after_feature_element(_feature_element)
unless @in_scenario_outline
print_messages
@builder << '</ol>'
Expand All @@ -202,7 +202,7 @@ def after_feature_element(feature_element)
@in_scenario_outline = nil
end

def scenario_name(keyword, name, file_colon_line, source_indent)
def scenario_name(keyword, name, file_colon_line, _source_indent)
@builder.span(:class => 'scenario_file') do
@builder << file_colon_line
end
Expand All @@ -220,23 +220,23 @@ def scenario_name(keyword, name, file_colon_line, source_indent)
end
end

def before_outline_table(outline_table)
def before_outline_table(_outline_table)
@inside_outline = true
@outline_row = 0
@builder << '<table>'
end

def after_outline_table(outline_table)
def after_outline_table(_outline_table)
@builder << '</table>'
@outline_row = nil
@inside_outline = false
end

def before_examples(examples)
def before_examples(_examples)
@builder << '<div class="examples">'
end

def after_examples(examples)
def after_examples(_examples)
@builder << '</div>'
end

Expand All @@ -248,11 +248,11 @@ def examples_name(keyword, name)
end
end

def before_steps(steps)
def before_steps(_steps)
@builder << '<ol>'
end

def after_steps(steps)
def after_steps(_steps)
print_messages
@builder << '</ol>' if @in_background or @in_scenario_outline
end
Expand All @@ -264,11 +264,11 @@ def before_step(step)
@step = step
end

def after_step(step)
def after_step(_step)
move_progress
end

def before_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
def before_step_result(_keyword, step_match, _multiline_arg, status, exception, _source_indent, background, _file_colon_line)
@step_match = step_match
@hide_this_step = false
if exception
Expand All @@ -288,7 +288,7 @@ def before_step_result(keyword, step_match, multiline_arg, status, exception, so
@builder << "<li id='#{@step_id}' class='step #{status}'>"
end

def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
def after_step_result(keyword, step_match, _multiline_arg, status, _exception, _source_indent, _background, _file_colon_line)
return if @hide_this_step
# print snippet for undefined steps
unless outline_step?(@step)
Expand All @@ -306,7 +306,7 @@ def after_step_result(keyword, step_match, multiline_arg, status, exception, sou
print_messages
end

def step_name(keyword, step_match, status, source_indent, background, file_colon_line)
def step_name(keyword, step_match, status, _source_indent, background, _file_colon_line)
background_in_scenario = background && !@listing_background
@skip_step = background_in_scenario

Expand All @@ -315,7 +315,7 @@ def step_name(keyword, step_match, status, source_indent, background, file_colon
end
end

def exception(exception, status)
def exception(exception, _status)
return if @hide_this_step
print_messages
build_exception_detail(exception)
Expand Down Expand Up @@ -421,7 +421,7 @@ def empty_messages
@delayed_messages = []
end

def after_test_case(test_case, result)
def after_test_case(_test_case, result)
if result.failed? and not @scenario_red
set_scenario_color_failed
end
Expand Down Expand Up @@ -489,7 +489,7 @@ def set_scenario_color_pending
end
end

def build_step(keyword, step_match, status)
def build_step(keyword, step_match, _status)
step_name = step_match.format_args(lambda{|param| %{<span class="param">#{param}</span>}})
@builder.div(:class => 'step_name') do |div|
@builder.span(keyword, :class => 'keyword')
Expand Down Expand Up @@ -605,7 +605,7 @@ def print_stats(features)
@builder << "<script type=\"text/javascript\">document.getElementById('totals').innerHTML = \"#{print_stat_string(features)}\";</script>"
end

def print_stat_string(features)
def print_stat_string(_features)
string = String.new
string << dump_count(@runtime.scenarios.length, 'scenario')
scenario_count = print_status_counts{|status| @runtime.scenarios(status)}
Expand All @@ -632,12 +632,12 @@ def create_builder(io)
Builder::XmlMarkup.new(:target => io, :indent => 0)
end

def outline_step?(step)
def outline_step?(_step)
not @step.step.respond_to?(:actual_keyword)
end

class SnippetExtractor #:nodoc:
class NullConverter; def convert(code, pre); code; end; end #:nodoc:
class NullConverter; def convert(code, _pre); code; end; end #:nodoc:

begin
require 'syntax/convertors/html'
Expand Down
4 changes: 2 additions & 2 deletions lib/cucumber/formatter/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def on_test_case_finished(event)
add_failed_around_hook(result) if result.failed? && !@any_step_failed
end

def on_test_run_finished(event)
def on_test_run_finished(_event)
@io.write(MultiJson.dump(@feature_hashes, pretty: true))
end

Expand Down Expand Up @@ -197,7 +197,7 @@ def add_failed_around_hook(result)
@step_or_hook_hash[:result] = create_result_hash(result)
end

def create_match_hash(test_step, result)
def create_match_hash(test_step, _result)
{ location: test_step.action_location.to_s }
end

Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/formatter/junit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def on_test_case_finished(event)
Interceptor::Pipe.unwrap! :stderr
end

def on_test_run_finished(event)
def on_test_run_finished(_event)
@features_data.each { |file, data| end_feature(data) }
end

Expand Down
Loading