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/AmbiguousOperator warnings #1021 #1022

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 3 additions & 9 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 8
Lint/AmbiguousOperator:
Exclude:
- 'lib/cucumber/formatter/legacy_api/adapter.rb'
- 'lib/cucumber/formatter/legacy_api/ast.rb'
- 'lib/cucumber/multiline_argument/data_table.rb'
- 'lib/cucumber/running_test_case.rb'
- 'spec/cucumber/formatter/legacy_api/adapter_spec.rb'
- 'spec/cucumber/formatter/spec_helper.rb'
# Offense count: 173
Lint/AmbiguousRegexpLiteral:
Enabled: false

# Offense count: 6
# Configuration parameters: AllowSafeAssignment.
Expand Down
8 changes: 4 additions & 4 deletions lib/cucumber/formatter/legacy_api/adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def before_hook(location, result)
def after_hook(location, result)
# if the scenario has no steps, we can hit this before we've created the scenario printer
# ideally we should call switch_step_container in before_step_step
switch_step_container if !@child
switch_step_container if !@child
@child.after_hook Ast::HookResult.new(LegacyResultBuilder.new(result), @delayed_messages, @delayed_embeddings)
@delayed_messages = []
@delayed_embeddings = []
Expand All @@ -287,7 +287,7 @@ def background(node, *)
end

def puts(messages)
@delayed_messages.push *messages
@delayed_messages.push(*messages)
end

def embed(src, mime_type, label)
Expand All @@ -313,7 +313,7 @@ def after
private :before_hook_results

def any_test_steps_failed?
@test_step_results.any? &:failed?
@test_step_results.any?(&:failed?)
end

def switch_step_container(source = current_test_step_source)
Expand Down Expand Up @@ -389,7 +389,7 @@ def switch_to_child(child, source)
end
end
unless from_scenario_outline_to_hidden_backgroud(@child, child)
@child.after
@child.after
@previous_outline_child = nil
else
@previous_outline_child = @child
Expand Down
4 changes: 2 additions & 2 deletions lib/cucumber/formatter/legacy_api/ast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ def accept(formatter)
Ast::Comments.new(step.comments).accept(formatter)
messages.each { |message| formatter.puts(message) }
embeddings.each { |embedding| embedding.send_to_formatter(formatter) }
formatter.before_step_result *step_result_attributes
formatter.before_step_result(*step_result_attributes)
print_step_name(formatter)
Ast::MultilineArg.for(multiline_arg).accept(formatter)
print_exception(formatter)
formatter.after_step_result *step_result_attributes
formatter.after_step_result(*step_result_attributes)
formatter.after_step(self)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/multiline_argument/data_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def column_names #:nodoc:

def rows
hashes.map do |hash|
hash.values_at *headers
hash.values_at(*headers)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/running_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def passed?
end

def source_tag_names
tags.map &:name
tags.map(&:name)
end

def outline?
Expand Down
2 changes: 1 addition & 1 deletion spec/cucumber/formatter/legacy_api/adapter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def initialize(&block)
end

def activate(test_step)
test_step.with_action &@block
test_step.with_action(&@block)
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/cucumber/formatter/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def define_steps
rb = runtime.support_code.ruby
dsl = Object.new
dsl.extend RbSupport::RbDsl
dsl.instance_exec &step_defs
dsl.instance_exec(&step_defs)
end

def options
Expand Down