Skip to content

Commit d28d05e

Browse files
committed
Add comments, avoid unnecessary assignments
1 parent 24f21af commit d28d05e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/arduino_ci/arduino_backend.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,11 @@ def compile_sketch(path, boardname)
211211
@last_msg = "Can't compile Sketch at nonexistent path '#{path}'!"
212212
return false
213213
end
214-
use_dry_run = should_use_dry_run?
215-
if use_dry_run
216-
ret = run_and_capture("compile", "--fqbn", boardname, "--warnings", "all", "--dry-run", path.to_s)
214+
215+
ret = if should_use_dry_run?
216+
run_and_capture("compile", "--fqbn", boardname, "--warnings", "all", "--dry-run", path.to_s)
217217
else
218-
ret = run_and_capture("compile", "--fqbn", boardname, "--warnings", "all", path.to_s)
218+
run_and_capture("compile", "--fqbn", boardname, "--warnings", "all", path.to_s)
219219
end
220220
@last_msg = ret[:out]
221221
ret[:success]
@@ -305,6 +305,10 @@ def last_bytes_usage
305305
Hash[mem_info.names.map(&:to_sym).zip(mem_info.captures.map(&:to_i))]
306306
end
307307

308+
private
309+
310+
# Since the dry-run behavior became default in arduino-cli 0.14, the command line flag was removed
311+
# @return [Bool] whether the --dry-run flag is available for this arduino-cli version
308312
def should_use_dry_run?
309313
ret = capture_json("version")
310314
version = ret[:json]["VersionString"]

0 commit comments

Comments
 (0)