( plugin: PluginFragment, issues: IssueFragment[], )
| 75 | } |
| 76 | |
| 77 | function transformGQLPlugin( |
| 78 | plugin: PluginFragment, |
| 79 | issues: IssueFragment[], |
| 80 | ): PluginReport { |
| 81 | return { |
| 82 | slug: plugin.slug, |
| 83 | title: plugin.title, |
| 84 | icon: plugin.icon, |
| 85 | ...(plugin.description && { description: plugin.description }), |
| 86 | ...(plugin.docsUrl && { docsUrl: plugin.docsUrl }), |
| 87 | audits: plugin.audits.edges.map(({ node }) => |
| 88 | transformGQLAudit( |
| 89 | node, |
| 90 | issues.filter( |
| 91 | issue => |
| 92 | issue.audit.plugin.slug === plugin.slug && |
| 93 | issue.audit.slug === node.slug, |
| 94 | ), |
| 95 | ), |
| 96 | ), |
| 97 | groups: plugin.groups.map(transformGQLGroup), |
| 98 | ...(plugin.packageName && { packageName: plugin.packageName }), |
| 99 | ...(plugin.packageVersion && { version: plugin.packageVersion }), |
| 100 | // TODO: make plugin metadata required in Portal API? |
| 101 | date: plugin.runnerStartDate ?? '', |
| 102 | duration: plugin.runnerDuration ?? 0, |
| 103 | }; |
| 104 | } |
| 105 | |
| 106 | function transformGQLGroup(group: GroupFragment): Group { |
| 107 | return { |
no test coverage detected