redhat-developer / redhat-developer/rhdh-plugins
Scorecard: Assert correctness of threshold constants in unit tests
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 48
- Forks
- 120
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 337
Description
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:
- PERCENTAGE_THRESHOLDS in @plugins/scorecard-backend-module-code-coverage/src/metricProviders/CodeCoverageMetricProvider.ts
- DEPENDABOT_THRESHOLDS in @plugins/scorecard-backend-module-dependabot/src/metricProviders/DependabotConfig.ts
- OPENSSF_THRESHOLDS in @plugins/scorecard-backend-module-openssf/src/metricProviders/OpenSSFConfig.ts
- SONARQUBE_NUMBER_THRESHOLDS in @plugins/scorecard-backend-module-sonarqube/src/metricProviders/SonarQubeConfig.ts
- DEFAULT_NUMBER_THRESHOLDS in @plugins/scorecard-common/src/types/threshold.ts
The test just need to pass without an exception.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with validateThresholdNumberIntervals in @plugins/scorecard-common/src/types/threshold.ts, then inspect the five named ThresholdConfigs in the scorecard metric provider files. Add unit tests that call the validator for each configuration, and run the relevant scorecard unit tests. Done means every test passes without an exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100