@@ -204,109 +204,89 @@ func calculateComplianceCondition(policy *policyv1beta1.OperatorPolicy) metav1.C
204204 idx , cond := policy .Status .GetCondition (validPolicyConditionType )
205205 if idx == - 1 {
206206 return shortReturn ("the validity of the policy is unknown" )
207- } else {
208- if cond .Status != metav1 .ConditionTrue {
209- // When invalid, short-circuit immediately with only the validation message.
210- return shortReturn (cond .Message )
211- }
212-
213- messages = append (messages , cond .Message )
214207 }
208+ if cond .Status != metav1 .ConditionTrue {
209+ // When invalid, short-circuit immediately with only the validation message.
210+ return shortReturn (cond .Message )
211+ }
212+ messages = append (messages , cond .Message )
215213
216214 idx , cond = policy .Status .GetCondition (opGroupConditionType )
217215 if idx == - 1 {
218216 return shortReturn ("the status of the OperatorGroup is unknown" )
219- } else {
220- if cond .Status != metav1 .ConditionTrue {
221- return shortReturn (cond .Message )
222- }
223-
224- messages = append (messages , cond .Message )
225217 }
218+ if cond .Status != metav1 .ConditionTrue {
219+ return shortReturn (cond .Message )
220+ }
221+ messages = append (messages , cond .Message )
226222
227223 idx , cond = policy .Status .GetCondition (subConditionType )
228224 if idx == - 1 {
229225 return shortReturn ("the status of the Subscription is unknown" )
230- } else {
231- if cond .Status != metav1 .ConditionTrue {
232- return shortReturn (cond .Message )
233- }
234-
235- messages = append (messages , cond .Message )
236226 }
227+ if cond .Status != metav1 .ConditionTrue {
228+ return shortReturn (cond .Message )
229+ }
230+ messages = append (messages , cond .Message )
237231
238232 idx , cond = policy .Status .GetCondition (installPlanConditionType )
239-
240233 if idx == - 1 {
241234 return shortReturn ("the status of the InstallPlan is unknown" )
242- } else {
243- if cond .Status != metav1 .ConditionTrue {
244- return shortReturn (cond .Message )
245- }
246-
247- messages = append (messages , cond .Message )
248235 }
236+ if cond .Status != metav1 .ConditionTrue {
237+ return shortReturn (cond .Message )
238+ }
239+ messages = append (messages , cond .Message )
249240
250241 idx , cond = policy .Status .GetCondition (csvConditionType )
251242 if idx == - 1 {
252243 return shortReturn ("the status of the ClusterServiceVersion is unknown" )
253- } else {
254- if cond .Status != metav1 .ConditionTrue {
255- return shortReturn (cond .Message )
256- }
257-
258- messages = append (messages , cond .Message )
259244 }
245+ if cond .Status != metav1 .ConditionTrue {
246+ return shortReturn (cond .Message )
247+ }
248+ messages = append (messages , cond .Message )
260249
261250 idx , cond = policy .Status .GetCondition (crdConditionType )
262251 if idx == - 1 {
263252 return shortReturn ("the status of the CustomResourceDefinitions is unknown" )
264- } else {
265-
266- if cond .Status != metav1 .ConditionTrue {
267- return shortReturn (cond .Message )
268- }
269-
270- messages = append (messages , cond .Message )
271253 }
254+ if cond .Status != metav1 .ConditionTrue {
255+ return shortReturn (cond .Message )
256+ }
257+ messages = append (messages , cond .Message )
272258
273259 idx , cond = policy .Status .GetCondition (deploymentConditionType )
274-
275260 if idx == - 1 {
276261 return shortReturn ("the status of the Deployments are unknown" )
277- } else {
278-
279- if cond .Status != metav1 .ConditionTrue {
280- return shortReturn (cond .Message )
281- }
262+ }
282263
283- messages = append (messages , cond .Message )
264+ if cond .Status != metav1 .ConditionTrue {
265+ return shortReturn (cond .Message )
284266 }
285267
286- idx , cond = policy . Status . GetCondition ( catalogSrcConditionType )
268+ messages = append ( messages , cond . Message )
287269
270+ idx , cond = policy .Status .GetCondition (catalogSrcConditionType )
288271 if idx == - 1 {
289272 return shortReturn ("the status of the CatalogSource is unknown" )
290- } else {
291- messages = append (messages , cond .Message )
273+ }
292274
293- if cond . Status != metav1 . ConditionFalse {
294- return shortReturn ( cond .Message )
295- }
275+ messages = append ( messages , cond . Message )
276+ if cond .Status != metav1 . ConditionFalse {
277+ return shortReturn ( cond . Message )
296278 }
297279
298280 idx , cond = policy .Status .GetCondition (deprecationType )
299281 if ! policy .Spec .ComplianceType .IsMustNotHave () &&
300282 policy .Spec .ComplianceConfig .DeprecationsPresent == "NonCompliant" {
301283 if idx == - 1 {
302284 return shortReturn ("The deprecation status is unknown" )
303- } else {
304- if cond .Status != metav1 .ConditionTrue {
305- return shortReturn (cond .Message )
306- }
307-
308- messages = append (messages , cond .Message )
309285 }
286+ if cond .Status != metav1 .ConditionTrue {
287+ return shortReturn (cond .Message )
288+ }
289+ messages = append (messages , cond .Message )
310290 }
311291
312292 message := strings .Join (messages , ", " )
0 commit comments