Skip to content

fix: change metrics output#27

Merged
k1LoW merged 10 commits intomainfrom
fix-metrics
Sep 11, 2025
Merged

fix: change metrics output#27
k1LoW merged 10 commits intomainfrom
fix-metrics

Conversation

@k1LoW
Copy link
Copy Markdown
Contributor

@k1LoW k1LoW commented Sep 11, 2025

  • Modify the structure of tailor.Metric
  • Output metrics including Coverage and Lint.

@k1LoW k1LoW self-assigned this Sep 11, 2025
@k1LoW k1LoW added enhancement New feature or request minor breaking change labels Sep 11, 2025
@k1LoW k1LoW changed the title fix: modify the structure of tailor.Metric to output metrics including Coverage and Lint. fix: modify the structure of tailor.Metric to output metrics including Coverage and Lint. Sep 11, 2025
@github-actions

This comment has been minimized.

@k1LoW k1LoW changed the title fix: modify the structure of tailor.Metric to output metrics including Coverage and Lint. fix: change metrics output Sep 11, 2025
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@k1LoW k1LoW marked this pull request as ready for review September 11, 2025 08:34
@k1LoW k1LoW requested a review from a team as a code owner September 11, 2025 08:34
@k1LoW k1LoW requested a review from Copilot September 11, 2025 09:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modifies the structure of tailor.Metric to enhance metrics output functionality and adds new coverage and lint metrics reporting capabilities.

  • Replace Description field with Key, Unit, and Error fields in the Metric struct
  • Add coverage percentage and lint warnings total metrics to metrics output
  • Enhance metrics command with table formatting, lint warnings display, and octocov format output support

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tailor/metrics.go Updates Metric struct fields and adds coverage/lint metrics computation
tailor/metrics_test.go Updates all test cases to use new Metric struct field names and adds coverage for new metrics
cmd/metrics.go Enhances metrics command with table output, coverage reports, lint warnings, and octocov format support
cmd/coverage.go Adds division by zero protection for coverage calculations
go.mod Adds tablewriter dependency and updates existing dependencies
README.md Updates documentation to reflect new metrics structure and command options

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread cmd/metrics.go Outdated
Comment thread tailor/metrics.go
Comment thread cmd/metrics.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Comment thread tailor/metrics_test.go Outdated
Comment on lines +641 to +651
expectedKeys := map[string]string{
"pipeline_resolver_step_coverage_percentage": "pipeline_resolver_step_coverage_percentage",
"lint_warnings_total": "lint_warnings_total",
"pipelines_total": "pipelines_total",
"pipeline_resolvers_total": "pipeline_resolvers_total",
"pipeline_resolver_steps_total": "pipeline_resolver_steps_total",
"pipeline_resolver_execution_paths_total": "pipeline_resolver_execution_paths_total",
"tailordbs_total": "tailordbs_total",
"tailordb_types_total": "tailordb_types_total",
"tailordb_type_fields_total": "tailordb_type_fields_total",
"stateflows_total": "stateflows_total",
Copy link
Copy Markdown

@toiroakr toiroakr Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it tests here?

If testing metric.Key is in expected key set:

expectedKeys := map[string]struct{}{
	"pipeline_resolver_step_coverage_percentage": struct{}{},
    ...
}

for _, metric := range metrics {
	_, exists := expectedKeys[metric.Key]
	if !exists {
		t.Errorf("Unexpected metric: %s", metric.Key)
	}
	// `if expectedKey != metric.Key` is not needed
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of the Name field had changed, making the test unnecessary.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

Code Metrics Report

main (b4d7b80) #27 (77bc9c1) +/-
Coverage 32.5% 30.7% -1.8%
Code to Test Ratio 1:1.7 1:1.4 -0.3
Test Execution Time 8s 3s -5s
Details
  |                     | main (b4d7b80) | #27 (77bc9c1) |  +/-  |
  |---------------------|----------------|---------------|-------|
- | Coverage            |          32.5% |         30.7% | -1.8% |
  |   Files             |             12 |            12 |     0 |
  |   Lines             |            406 |           481 |   +75 |
+ |   Covered           |            132 |           148 |   +16 |
- | Code to Test Ratio  |          1:1.7 |         1:1.4 |  -0.3 |
  |   Code              |           1142 |          1345 |  +203 |
- |   Test              |           1970 |          1924 |   -46 |
+ | Test Execution Time |             8s |            3s |   -5s |

Code coverage of files in pull request scope (32.1% → 27.1%)

Files Coverage +/- Status
cmd/coverage.go 0.0% 0.0% modified
cmd/metrics.go 0.0% 0.0% modified
tailor/metrics.go 93.6% -6.4% modified

Reported by octocov

@k1LoW k1LoW merged commit b51bae0 into main Sep 11, 2025
1 check passed
@k1LoW k1LoW deleted the fix-metrics branch September 11, 2025 13:35
@k1LoW
Copy link
Copy Markdown
Contributor Author

k1LoW commented Sep 11, 2025

@toiroakr Thank you!

@github-actions github-actions Bot mentioned this pull request Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants