diff --git a/.changeset/fix-code-coverage-folder-percentage.md b/.changeset/fix-code-coverage-folder-percentage.md new file mode 100644 index 0000000000..4f0bfdbfa5 --- /dev/null +++ b/.changeset/fix-code-coverage-folder-percentage.md @@ -0,0 +1,5 @@ +--- +'@backstage-community/plugin-code-coverage': patch +--- + +Fix folder coverage calculation to use aggregated tracked and missing lines instead of averaging child coverage percentages. diff --git a/.changeset/pretty-items-try.md b/.changeset/pretty-items-try.md new file mode 100644 index 0000000000..730977cdf0 --- /dev/null +++ b/.changeset/pretty-items-try.md @@ -0,0 +1,5 @@ +--- +'@backstage-community/plugins': patch +--- + +docs(feedback): add new frontend / hybrid migration notice diff --git a/workspaces/code-coverage/plugins/code-coverage/src/components/FileExplorer/FileExplorer.tsx b/workspaces/code-coverage/plugins/code-coverage/src/components/FileExplorer/FileExplorer.tsx index b2c92edcdf..52ff093979 100644 --- a/workspaces/code-coverage/plugins/code-coverage/src/components/FileExplorer/FileExplorer.tsx +++ b/workspaces/code-coverage/plugins/code-coverage/src/components/FileExplorer/FileExplorer.tsx @@ -93,27 +93,30 @@ const removeVisitedPathGroup = ( export const buildFileStructure = (row: CoverageTableRow) => { const dataGroupedByPath: FileStructureObject = groupByPath(row.files); + row.files = Object.keys(dataGroupedByPath).map(pathGroup => { + const aggregatedTracked = dataGroupedByPath[pathGroup].reduce( + (acc: number, cur: CoverageTableRow) => acc + cur.tracked, + 0, + ); + + const aggregatedMissing = dataGroupedByPath[pathGroup].reduce( + (acc: number, cur: CoverageTableRow) => acc + cur.missing, + 0, + ); + return buildFileStructure({ path: pathGroup, - files: dataGroupedByPath.hasOwnProperty('files') - ? removeVisitedPathGroup(dataGroupedByPath.files, pathGroup) - : removeVisitedPathGroup(dataGroupedByPath[pathGroup], pathGroup), + files: removeVisitedPathGroup(dataGroupedByPath[pathGroup], pathGroup), coverage: - dataGroupedByPath[pathGroup].reduce( - (acc: number, cur: CoverageTableRow) => acc + cur.coverage, - 0, - ) / dataGroupedByPath[pathGroup].length, - missing: dataGroupedByPath[pathGroup].reduce( - (acc: number, cur: CoverageTableRow) => acc + cur.missing, - 0, - ), - tracked: dataGroupedByPath[pathGroup].reduce( - (acc: number, cur: CoverageTableRow) => acc + cur.tracked, - 0, - ), + aggregatedTracked > 0 + ? ((aggregatedTracked - aggregatedMissing) / aggregatedTracked) * 100 + : 0, + missing: aggregatedMissing, + tracked: aggregatedTracked, }); }); + return row; }; diff --git a/workspaces/feedback/plugins/feedback/README.md b/workspaces/feedback/plugins/feedback/README.md index 95f2a7756e..43bd9c550c 100644 --- a/workspaces/feedback/plugins/feedback/README.md +++ b/workspaces/feedback/plugins/feedback/README.md @@ -38,6 +38,18 @@ It is dedicated to simplifying the process of gathering and managing user feedba ### Plugin Setup +## New Frontend / Hybrid Migration Notice + +The Feedback plugin currently has limited support for the new +Backstage frontend and hybrid migration setups. + +The following steps are **legacy frontend only**: + +- Adding routes in `App.tsx` using `FlatRoutes` +- Registering components directly in `AppRouter` + +## The backend configuration and catalog annotations remain the same for both legacy and new frontend setups. + 1. Install the plugin in your environment ```bash