diff --git a/app/lib/frontend/templates/views/pkg/score_tab.dart b/app/lib/frontend/templates/views/pkg/score_tab.dart index 8557f1053d..9a61026d20 100644 --- a/app/lib/frontend/templates/views/pkg/score_tab.dart +++ b/app/lib/frontend/templates/views/pkg/score_tab.dart @@ -125,8 +125,16 @@ d.Node _section(ReportSection section) { child: d.img( classes: ['pkg-report-icon'], image: d.Image( - src: _statusIconUrls[section.status]!, - alt: _statusIconAlts[section.status]!, + src: switch (section.status) { + ReportStatus.passed => staticUrls.reportOKIconGreen, + ReportStatus.partial => staticUrls.reportMissingIconYellow, + ReportStatus.failed => staticUrls.reportMissingIconRed, + }, + alt: switch (section.status) { + ReportStatus.passed => 'Passed report section', + ReportStatus.partial => 'Partially passed report section', + ReportStatus.failed => 'Failed report section', + }, width: 18, height: 18, ), @@ -238,21 +246,6 @@ d.Node _downloadsChart(WeeklyVersionDownloadCounts weeklyVersionDownloads) { ]); } -final _statusIconUrls = { - ReportStatus.passed: - staticUrls.getAssetUrl('/static/img/report-ok-icon-green.svg'), - ReportStatus.partial: - staticUrls.getAssetUrl('/static/img/report-missing-icon-yellow.svg'), - ReportStatus.failed: - staticUrls.getAssetUrl('/static/img/report-missing-icon-red.svg'), -}; - -final _statusIconAlts = { - ReportStatus.passed: 'OK', - ReportStatus.partial: 'partial', - ReportStatus.failed: 'failed', -}; - String _updatedSummary(String summary) { return summary.split('\n').map((line) { if (!line.startsWith('### ')) return line; @@ -260,14 +253,17 @@ String _updatedSummary(String summary) { .replaceFirst( '[*]', '') .replaceFirst( '[x]', '') .replaceFirst( '[~]', ''); }).join('\n'); } diff --git a/app/test/frontend/golden/pkg_score_page.html b/app/test/frontend/golden/pkg_score_page.html index 343b746815..09b46d4ffb 100644 --- a/app/test/frontend/golden/pkg_score_page.html +++ b/app/test/frontend/golden/pkg_score_page.html @@ -241,7 +241,7 @@

Metadata

- failed + Failed report section
Fake conventions
@@ -255,7 +255,7 @@

Metadata

- + Partially passed check 18/30 points: Package layout

    @@ -268,7 +268,7 @@

    - OK + Passed report section
    Fake documentation
    @@ -282,7 +282,7 @@

    - + Partially passed check 36/40 points: Example

      diff --git a/app/test/frontend/golden/pkg_score_page_with_downloads_chart.html b/app/test/frontend/golden/pkg_score_page_with_downloads_chart.html index 343b746815..09b46d4ffb 100644 --- a/app/test/frontend/golden/pkg_score_page_with_downloads_chart.html +++ b/app/test/frontend/golden/pkg_score_page_with_downloads_chart.html @@ -241,7 +241,7 @@

      Metadata

      - failed + Failed report section
      Fake conventions
      @@ -255,7 +255,7 @@

      Metadata

      - + Partially passed check 18/30 points: Package layout

        @@ -268,7 +268,7 @@

        - OK + Passed report section
        Fake documentation
        @@ -282,7 +282,7 @@

        - + Partially passed check 36/40 points: Example

          diff --git a/app/test/task/testdata/goldens/packages/oxygen/score.html b/app/test/task/testdata/goldens/packages/oxygen/score.html index ad608a7a5e..93d97354fd 100644 --- a/app/test/task/testdata/goldens/packages/oxygen/score.html +++ b/app/test/task/testdata/goldens/packages/oxygen/score.html @@ -233,7 +233,7 @@

          Metadata

          - failed + Failed report section
          Follow Dart file conventions
          @@ -247,7 +247,7 @@

          Metadata

          - + Failed check 0/10 points: Provide a valid pubspec.yaml

          @@ -298,17 +298,17 @@

          - + Passed check 5/5 points: Provide a valid README.md

          - + Passed check 5/5 points: Provide a valid CHANGELOG.md

          - + Failed check 0/10 points: Use an OSI-approved license

          @@ -328,7 +328,7 @@

          - OK + Passed report section
          Provide documentation
          @@ -342,7 +342,7 @@

          - + Passed check 10/10 points: 20% or more of the public API has dartdoc comments

          2 out of 8 API elements (25.0 %) have documentation comments.

          @@ -360,7 +360,7 @@

          .

          - + Passed check 10/10 points: Package has an example and has no issues with screenshots

          @@ -370,7 +370,7 @@

          - OK + Passed report section
          Platform support
          @@ -384,7 +384,7 @@

          - + Passed check 20/20 points: Supports 6 of 6 possible platforms ( iOS , @@ -420,7 +420,7 @@

        - + Passed check 0/0 points: WASM compatibility

        @@ -440,7 +440,7 @@

        - OK + Passed report section
        Pass static analysis
        @@ -454,7 +454,7 @@

        - + Passed check 50/50 points: code has no errors, warnings, lints, or formatting issues

        @@ -464,7 +464,7 @@

        - OK + Passed report section
        Support up-to-date dependencies
        @@ -478,7 +478,7 @@

        - + Passed check 10/10 points: All of the package dependencies are supported in the latest version

        No dependencies.

        @@ -488,11 +488,11 @@

        .

        - + Passed check 10/10 points: Package supports latest stable Dart and Flutter SDKs

        - + Passed check 20/20 points: Compatible with dependency constraint lower bounds

        diff --git a/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/score.html b/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/score.html index d644eb6787..5081a0c83b 100644 --- a/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/score.html +++ b/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/score.html @@ -237,7 +237,7 @@

        Metadata

        - failed + Failed report section
        Follow Dart file conventions
        @@ -251,7 +251,7 @@

        Metadata

        - + Failed check 0/10 points: Provide a valid pubspec.yaml

        @@ -302,17 +302,17 @@

        - + Passed check 5/5 points: Provide a valid README.md

        - + Passed check 5/5 points: Provide a valid CHANGELOG.md

        - + Failed check 0/10 points: Use an OSI-approved license

        @@ -332,7 +332,7 @@

        - OK + Passed report section
        Provide documentation
        @@ -346,7 +346,7 @@

        - + Passed check 10/10 points: 20% or more of the public API has dartdoc comments

        2 out of 8 API elements (25.0 %) have documentation comments.

        @@ -364,7 +364,7 @@

        .

        - + Passed check 10/10 points: Package has an example and has no issues with screenshots

        @@ -374,7 +374,7 @@

        - OK + Passed report section
        Platform support
        @@ -388,7 +388,7 @@

        - + Passed check 20/20 points: Supports 6 of 6 possible platforms ( iOS , @@ -424,7 +424,7 @@

      - + Passed check 0/0 points: WASM compatibility

      @@ -444,7 +444,7 @@

      - OK + Passed report section
      Pass static analysis
      @@ -458,7 +458,7 @@

      - + Passed check 50/50 points: code has no errors, warnings, lints, or formatting issues

      @@ -468,7 +468,7 @@

      - OK + Passed report section
      Support up-to-date dependencies
      @@ -482,7 +482,7 @@

      - + Passed check 10/10 points: All of the package dependencies are supported in the latest version

      No dependencies.

      @@ -492,11 +492,11 @@

      .

      - + Passed check 10/10 points: Package supports latest stable Dart and Flutter SDKs

      - + Passed check 20/20 points: Compatible with dependency constraint lower bounds