Skip to content

Commit 75dd622

Browse files
committed
Add comments, avoid unnecessary assignments
1 parent 1f2b7e5 commit 75dd622

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
@@ -201,11 +201,11 @@ def compile_sketch(path, boardname)
201201
@last_msg = "Can't compile Sketch at nonexistent path '#{path}'!"
202202
return false
203203
end
204-
use_dry_run = should_use_dry_run?
205-
if use_dry_run
206-
ret = run_and_capture("compile", "--fqbn", boardname, "--warnings", "all", "--dry-run", path.to_s)
204+
205+
ret = if should_use_dry_run?
206+
run_and_capture("compile", "--fqbn", boardname, "--warnings", "all", "--dry-run", path.to_s)
207207
else
208-
ret = run_and_capture("compile", "--fqbn", boardname, "--warnings", "all", path.to_s)
208+
run_and_capture("compile", "--fqbn", boardname, "--warnings", "all", path.to_s)
209209
end
210210
@last_msg = ret[:out]
211211
ret[:success]
@@ -295,6 +295,10 @@ def last_bytes_usage
295295
Hash[mem_info.names.map(&:to_sym).zip(mem_info.captures.map(&:to_i))]
296296
end
297297

298+
private
299+
300+
# Since the dry-run behavior became default in arduino-cli 0.14, the command line flag was removed
301+
# @return [Bool] whether the --dry-run flag is available for this arduino-cli version
298302
def should_use_dry_run?
299303
ret = capture_json("version")
300304
version = ret[:json]["VersionString"]

0 commit comments

Comments
 (0)