Skip to content

Commit aa2ec39

Browse files
committed
Use any? idiom
1 parent 5bafda6 commit aa2ec39

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

exe/arduino_ci_remote.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def display_files(pathname)
112112
inform("Library installed at") { installed_library_path.to_s }
113113
else
114114
assure_multiline("Library installed successfully") do
115+
# print out the contents of the deepest directory we actually find
115116
@arduino_cmd.lib_dir.ascend do |path_part|
116117
next unless path_part.exist?
117118

lib/arduino_ci/cpp_library.rb

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ def vendor_bundle?(path)
5757
return false unless base.exist?
5858

5959
real = base.realpath
60-
path.ascend do |path_part|
61-
return true if path_part == base
62-
return true if path_part == real
63-
end
64-
false
60+
path.ascend.any? { |part| part == base || part == real }
6561
end
6662

6763
# Check whether libasan (and by extension -fsanitizer=address) is supported
@@ -98,15 +94,10 @@ def cpp_files_in(some_dir)
9894
# CPP files that are part of the project library under test
9995
# @return [Array<Pathname>]
10096
def cpp_files
101-
real_tests_dir = tests_dir.realpath
97+
tests_dir_aliases = [tests_dir, tests_dir.realpath]
10298
cpp_files_in(@base_dir).reject do |p|
103-
next true if p.ascend do |path_part|
104-
break true if path_part == tests_dir
105-
break true if path_part == real_tests_dir
106-
break true if vendor_bundle?(p)
107-
end
108-
109-
false
99+
# ignore anything in the vendor bundle or tests dir
100+
vendor_bundle?(p) || (p.ascend.any? { |part| tests_dir_aliases.include?(part) })
110101
end
111102
end
112103

0 commit comments

Comments
 (0)