MCPcopy Create free account
hub / github.com/code-pushup/cli / getSortableAuditByRef

Function getSortableAuditByRef

packages/utils/src/lib/reports/sorting.ts:20–39  ·  view source on GitHub ↗
(
  { slug, weight, plugin }: CategoryRef,
  plugins: ScoredReport['plugins'],
)

Source from the content-addressed store, hash-verified

18} from './utils.js';
19
20export function getSortableAuditByRef(
21 { slug, weight, plugin }: CategoryRef,
22 plugins: ScoredReport['plugins'],
23): SortableAuditReport {
24 const auditPlugin = plugins.find(p => p.slug === plugin);
25 if (!auditPlugin) {
26 throwIsNotPresentError(`Plugin ${plugin}`, 'report');
27 }
28 const audit = auditPlugin.audits.find(
29 ({ slug: auditSlug }) => auditSlug === slug,
30 );
31 if (!audit) {
32 throwIsNotPresentError(`Audit ${slug}`, auditPlugin.slug);
33 }
34 return {
35 ...audit,
36 weight,
37 plugin,
38 };
39}
40
41export function getSortedGroupAudits(
42 group: Group,

Callers 4

categoriesDetailsSectionFunction · 0.85
getSortedGroupAuditsFunction · 0.85
sortReportFunction · 0.85

Calls 1

throwIsNotPresentErrorFunction · 0.85

Tested by

no test coverage detected