From cd75dbcaabab9b568b73ba0a056f896140918dc8 Mon Sep 17 00:00:00 2001 From: Ken'ichiro Oyama Date: Wed, 17 Sep 2025 19:27:27 +0900 Subject: [PATCH] feat: add support for configurable acceptable thresholds in octocov output --- README.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++- cmd/metrics.go | 11 ++++++---- config/config.go | 15 ++++++++++--- 3 files changed, 74 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 5f9d544..4b9bdd4 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ export TAILOR_TOKEN=your_access_token patterner metrics ``` -The metrics command displays metrics in a table format. Use the `--out-octocov-path` option to output metrics in octocov custom metrics format. +The metrics command displays metrics in a table format. Use the `--out-octocov-path` option to output metrics in octocov custom metrics format with configurable acceptable thresholds. #### Metrics Options @@ -124,6 +124,43 @@ patterner metrics --out-octocov-path metrics.json patterner metrics --since 24hours --out-octocov-path metrics.json --with-coverage-full-report --with-lint-warnings ``` +#### Octocov Custom Metrics Format + +When using the `--out-octocov-path` option, patterner outputs metrics in octocov custom metrics format. This format includes: + +- **Metrics data** - All collected metrics with their values and units +- **Acceptable thresholds** - Configurable conditions that define acceptable metric values + - Configured via `metrics.octocov.acceptables` in `.patterner.yml` + - Used by [octocov](https://github.com/k1LoW/octocov) to evaluate whether metrics meet quality standards + +**Example octocov output:** +```json +[ + { + "key": "patterner-metrics", + "name": "Patterner Metrics", + "metrics": [ + { + "key": "pipeline_resolver_step_coverage_percentage", + "name": "Pipeline Resolver Step Coverage", + "value": 75.0, + "unit": "%" + }, + { + "key": "lint_warnings_total", + "name": "Lint Warnings Total", + "value": 3, + "unit": "count" + } + ], + "acceptables": [ + "pipeline_resolver_step_coverage_percentage >= 80", + "lint_warnings_total <= 5" + ] + } +] +``` + **Implementation Notes:** ```