Closed agateau-gg closed 8 months ago
Attention: 11 lines
in your changes are missing coverage. Please review.
Comparison is base (
5801d88
) 91.61% compared to head (90f582f
) 91.59%.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Description
This PR finishes the migration to ContextObj. It does two things:
Interesting trivia
Interestingly this pointed out harmless typing errors, for example:
pyright complained because the 2nd argument of
handle_scan_error()
expects aDetail
instance, but pyright thought it could be aIaCScanResult
. From a typing perspective, it could happen ifscan.success
was False butisinstance(scan, IaCScanResult)
was True. In practice it cannot happen becausescan
is always aDetail
whenscan.success
is False.I wondered why it did not complain before, and I realized it's because
client
was previously defined asclient = ctx.obj["client"]
, so pyright had no idea what type it was. And also had no idea what the return type ofclient.iac_directory_scan()
was.Now that
client
is defined asclient.ctx_obj.client
, pyright knows it's aGGClient
instance and thus knows the return type ofclient.iac_directory_scan()
.