Skip to content

Scorecard: Assert correctness of threshold constants in unit tests #4594

Description

@christoph-jerolimov

Invalid threshold definitions let the scorecard plugin fail to start. For the ThresholdConfigs in the code base, unit tests should assert their correctness.

Add a unit tests that calls validateThresholdNumberIntervals for each of this ThresholdConfigs:

  1. PERCENTAGE_THRESHOLDS in @plugins/scorecard-backend-module-code-coverage/src/metricProviders/CodeCoverageMetricProvider.ts
  2. DEPENDABOT_THRESHOLDS in @plugins/scorecard-backend-module-dependabot/src/metricProviders/DependabotConfig.ts
  3. OPENSSF_THRESHOLDS in @plugins/scorecard-backend-module-openssf/src/metricProviders/OpenSSFConfig.ts
  4. SONARQUBE_NUMBER_THRESHOLDS in @plugins/scorecard-backend-module-sonarqube/src/metricProviders/SonarQubeConfig.ts
  5. DEFAULT_NUMBER_THRESHOLDS in @plugins/scorecard-common/src/types/threshold.ts

The test just need to pass without an exception.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions