wakatime / wakatime-cli

Command line interface used by all WakaTime text editor plugins
https://wakatime.com/plugins
BSD 3-Clause "New" or "Revised" License
262 stars 40 forks source link

Skip extra heartbeats when no data provided #1022

Closed gandarez closed 5 months ago

gandarez commented 5 months ago

This PR fixes reading extra heartbeat when the flag is set to true but no data was provided.

current log

failed to read extra heartbeats: failed parsing: failed to json decode from data \"\": unexpected end of JSON input
codecov-commenter commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (e983264) 62.95% compared to head (eed6d94) 62.96%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

@@             Coverage Diff             @@
##           develop    #1022      +/-   ##
===========================================
+ Coverage    62.95%   62.96%   +0.01%     
===========================================
  Files          374      374              
  Lines        15960    15965       +5     
===========================================
+ Hits         10048    10053       +5     
  Misses        5378     5378              
  Partials       534      534              
Flag Coverage Δ
unittests 62.96% <100.00%> (+0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
cmd/params/params.go 85.96% <100.00%> (+0.09%) :arrow_up:
alanhamlett commented 5 months ago

Good catch. So this only resulted in an error logged, but the main heartbeat was still sent to the api and not lost. It's good this cleans up the ~/.wakatime/wakatime.log so it's not noisy.