CombinedCheckState: factor out code for counting check states
Currently, the "IN_PROGRESS" combined check state doesn't
work well for required and optional check states. The
problem is as an "enum", "IN_PROGRESS" can only have one
"passing" state (true or false), which affects whether
we should block submission or not.
But whether a "IN_PROGRESS" is passing or not depends on
whether there are required check states pending. That
means it can be true or false.
To resolve this, we have two possibilities:
1- split "IN_PROGRESS" into two, e.g.
"IN_PROGRESS_BLOCKING" and "IN_PROGRESS_NOT_BLOCKING".
But these names would probably be long and could
confuse users.
2- this commit proposes to keep the current combined
check state definition, but doesn't hard-code the
"passing" state in the "enum". This commit is a no-op
for Checks#getCombinedCheckState but it makes it
much easier to share the code for extracting the
"CheckStateCount".
The follow-up commit will teach the submittable check
to use "CheckStateCount" information and remove
the "pass" boolean from "CombinedCheckState" in the
end.
Change-Id: Ia85f9f9b9d947699f3c34216642814121a772b1e
1 file changed