Skip to content

Commit 42df79b

Browse files
authored
fix identicalConditionalBranches (#428)
1 parent 2a91a6d commit 42df79b

File tree

3 files changed

+5
-34
lines changed

3 files changed

+5
-34
lines changed

.rubocop.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ Style/IndentHash:
3838
Enabled: false
3939
Style/VariableNumber:
4040
EnforcedStyle: 'snake_case'
41-
# The followings should checked again
42-
Style/IdenticalConditionalBranches:
43-
Enabled: false
4441
Lint/NestedMethodDefinition:
4542
Enabled: false
43+
# The followings should checked again
4644
Lint/UnifiedInteger:
4745
Enabled: false

lib/appium_lib/device/touch_actions.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,12 @@ def swipe(opts, ele = nil)
147147
if ele # pinch/zoom for XCUITest
148148
press x: start_x, y: start_y, element: ele
149149
move_to x: start_x + delta_x, y: start_y + delta_y, element: ele
150-
release
151150
else
152151
press x: start_x, y: start_y
153152
wait(duration) if duration
154153
move_to x: start_x + delta_x, y: start_y + delta_y
155-
release
156154
end
155+
release
157156

158157
self
159158
end

lib/appium_lib/ios/helper.rb

+3-29
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,21 @@ def _print_attr(type, name, label, value, hint)
1616
if name == label && name == value
1717
puts type.to_s if name || label || value || hint
1818
puts " name, label, value: #{name}" if name
19-
puts " hint: #{hint}" if hint
2019
elsif name == label
2120
puts type.to_s if name || label || value || hint
2221
puts " name, label: #{name}" if name
2322
puts " value: #{value}" if value
24-
puts " hint: #{hint}" if hint
2523
elsif name == value
2624
puts type.to_s if name || label || value || hint
2725
puts " name, value: #{name}" if name
2826
puts " label: #{label}" if label
29-
puts " hint: #{hint}" if hint
3027
else
3128
puts type.to_s if name || label || value || hint
3229
puts " name: #{name}" if name
3330
puts " label: #{label}" if label
3431
puts " value: #{value}" if value
35-
puts " hint: #{hint}" if hint
3632
end
33+
puts " hint: #{hint}" if hint
3734
end
3835
end
3936
# iOS only. On Android uiautomator always returns an empty string for EditText password.
@@ -87,34 +84,11 @@ def fix_space(s)
8784
visible = fix_space element['visible']
8885
type = fix_space element['type']
8986

90-
# TODO: Rubocop warning cleanup
91-
# rubocop:disable Metrics/BlockNesting
92-
9387
# if class_name is set, mark non-matches as invisible
9488
visible = (type.downcase.include? class_namet).to_s if class_name
9589
if visible && visible == 'true'
96-
if name == label && name == value
97-
puts type.to_s if name || label || value || hint
98-
puts " name, label, value: #{name}" if name
99-
puts " hint: #{hint}" if hint
100-
elsif name == label
101-
puts type.to_s if name || label || value || hint
102-
puts " name, label: #{name}" if name
103-
puts " value: #{value}" if value
104-
puts " hint: #{hint}" if hint
105-
elsif name == value
106-
puts type.to_s if name || label || value || hint
107-
puts " name, value: #{name}" if name
108-
puts " label: #{label}" if label
109-
puts " hint: #{hint}" if hint
110-
else
111-
puts type.to_s if name || label || value || hint
112-
puts " name: #{name}" if name
113-
puts " label: #{label}" if label
114-
puts " value: #{value}" if value
115-
puts " hint: #{hint}" if hint
116-
end
117-
# rubocop:enable Metrics/BlockNesting
90+
91+
_print_attr(type, name, label, value, hint)
11892

11993
# there may be many ids with the same value.
12094
# output all exact matches.

0 commit comments

Comments
 (0)