Skip to content

Commit 46ab1bc

Browse files
authored
Merge pull request #96 from xinminlabs/awesomecode-lint-ruby-style-safenavigation-47828
Auto corrected by following Lint Ruby Style/SafeNavigation
2 parents 5e3d01d + 379cdce commit 46ab1bc

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

lib/synvert/core/node_ext.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,7 @@ def debug_info
299299
#
300300
# @return [String] source code.
301301
def to_source
302-
if self.loc.expression
303-
self.loc.expression.source
304-
end
302+
self.loc.expression&.source
305303
end
306304

307305
# Get the indent of current node.

lib/synvert/core/rewriter/condition/if_exist_condition.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Rewriter::IfExistCondition < Rewriter::Condition
77
def match?
88
match = false
99
@instance.current_node.recursive_children do |child_node|
10-
match = match || (child_node && child_node.match?(@rules))
10+
match = match || (child_node&.match?(@rules))
1111
end
1212
match
1313
end

lib/synvert/core/rewriter/condition/unless_exist_condition.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Rewriter::UnlessExistCondition < Rewriter::Condition
77
def match?
88
match = false
99
@instance.current_node.recursive_children do |child_node|
10-
match = match || (child_node && child_node.match?(@rules))
10+
match = match || (child_node&.match?(@rules))
1111
end
1212
!match
1313
end

0 commit comments

Comments
 (0)