google / slo-generator

SLO Generator computes SLIs, SLOs, Error Budgets and Burn Rates from supported backends, then exports an SLO report to supported targets.
Apache License 2.0
489 stars 78 forks source link

refactor: remove unreachable code #357

Closed sdenef-adeo closed 1 year ago

sdenef-adeo commented 1 year ago

Check if data is None already done at the beginning of the function. This code can't be reached.

lvaylet commented 1 year ago

Hi @sdenef-adeo, I agree this code is not reachable. data is never modified in between the two identical checks. It is safe to remove this code. Could you just move the code responsible for defining error and appending it to errors to the block at the top? This way we get the best of both.

sdenef-adeo commented 1 year ago

Hi @lvaylet ,

I didn't move it to not change the behavior (as this code has never been reached).

I updated the PR as requested.