Follow-up from "Splits out SAST reports to a new module"

The following discussion from !14299 (merged) should be addressed:

  • @pgascouvaillancourt started a discussion: (+1 comment)

    What would you think of adding a getter that returns all reports, it would let us simplify some of these getters:

    export const allReports = ({ sastContainer, dast, dependencyScanning }, _getters, { sast }) => [
      sast,
      sastContainer,
      dast,
      dependencyScanning,
    ];
    
    export const summaryCounts = (_state, getters) =>
    getters.allReports.reduce(

    We could leverage some Array methods to replace some of the conditions below, while this might have a slight performance cost, I feel like it would nicely improve maintainability. eg:

    export const areReportsLoading = (_, getters) =>
      getters.allReports.some(({ isLoading }) => isLoading);
    
    export const allReportsHaveError = (_, getters) =>
      getters.allReports.every(({ hasError }) => hasError);

    Although, this comment is probably out-of-scope for this MR, we could probably address it in a follow up MR if you think it's worth the shot.

Assignee Loading
Time tracking Loading