cov-loupe 3.0.0 → 4.0.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AGENTS.md +230 -0
- data/CLAUDE.md +5 -0
- data/CODE_OF_CONDUCT.md +62 -0
- data/CONTRIBUTING.md +102 -0
- data/GEMINI.md +5 -0
- data/README.md +154 -51
- data/RELEASE_NOTES.md +452 -0
- data/dev/images/cov-loupe-icon-lores.png +0 -0
- data/dev/images/cov-loupe-icon-square.png +0 -0
- data/dev/images/cov-loupe-icon.png +0 -0
- data/dev/images/cov-loupe-logo.png +0 -0
- data/dev/prompts/README.md +74 -0
- data/dev/prompts/archive/architectural-review-and-actions-prompt.md +53 -0
- data/dev/prompts/archive/investigate-and-report-issues-prompt.md +33 -0
- data/dev/prompts/archive/produce-action-items-prompt.md +25 -0
- data/dev/prompts/guidelines/ai-code-evaluator-guidelines.md +337 -0
- data/dev/prompts/improve/refactor-test-suite.md +18 -0
- data/dev/prompts/improve/simplify-code-logic.md +133 -0
- data/dev/prompts/improve/update-documentation.md +21 -0
- data/dev/prompts/review/comprehensive-codebase-review.md +176 -0
- data/dev/prompts/review/identify-action-items.md +143 -0
- data/dev/prompts/review/verify-code-changes.md +54 -0
- data/dev/prompts/validate/create-screencast-outline.md +234 -0
- data/dev/prompts/validate/test-documentation-examples.md +180 -0
- data/docs/QUICKSTART.md +63 -0
- data/docs/assets/images/cov-loupe-logo-lores.png +0 -0
- data/docs/assets/images/cov-loupe-logo.png +0 -0
- data/docs/assets/images/favicon.png +0 -0
- data/docs/assets/stylesheets/branding.css +16 -0
- data/docs/assets/stylesheets/extra.css +15 -0
- data/docs/code_of_conduct.md +1 -0
- data/docs/contributing.md +1 -0
- data/docs/dev/ARCHITECTURE.md +56 -11
- data/docs/dev/DEVELOPMENT.md +116 -12
- data/docs/dev/FUTURE_ENHANCEMENTS.md +14 -0
- data/docs/dev/README.md +3 -2
- data/docs/dev/RELEASING.md +2 -0
- data/docs/dev/arch-decisions/README.md +10 -7
- data/docs/dev/arch-decisions/application-architecture.md +259 -0
- data/docs/dev/arch-decisions/coverage-data-quality.md +193 -0
- data/docs/dev/arch-decisions/output-character-mode.md +217 -0
- data/docs/dev/arch-decisions/path-resolution.md +90 -0
- data/docs/dev/arch-decisions/{004-x-arch-decision.md → policy-validation.md} +32 -28
- data/docs/dev/arch-decisions/{005-x-arch-decision.md → simplecov-integration.md} +47 -44
- data/docs/dev/presentations/cov-loupe-presentation.md +15 -13
- data/docs/examples/mcp-inputs.md +3 -0
- data/docs/examples/prompts.md +3 -0
- data/docs/examples/success_predicates.md +3 -0
- data/docs/fixtures/demo_project/.resultset.json +170 -0
- data/docs/fixtures/demo_project/README.md +6 -0
- data/docs/fixtures/demo_project/app/controllers/admin/audit_logs_controller.rb +19 -0
- data/docs/fixtures/demo_project/app/controllers/orders_controller.rb +26 -0
- data/docs/fixtures/demo_project/app/models/order.rb +20 -0
- data/docs/fixtures/demo_project/app/models/user.rb +19 -0
- data/docs/fixtures/demo_project/lib/api/client.rb +22 -0
- data/docs/fixtures/demo_project/lib/ops/jobs/cleanup_job.rb +16 -0
- data/docs/fixtures/demo_project/lib/ops/jobs/report_job.rb +17 -0
- data/docs/fixtures/demo_project/lib/payments/processor.rb +15 -0
- data/docs/fixtures/demo_project/lib/payments/refund_service.rb +15 -0
- data/docs/fixtures/demo_project/lib/payments/reporting/exporter.rb +16 -0
- data/docs/index.md +1 -0
- data/docs/license.md +3 -0
- data/docs/release_notes.md +3 -0
- data/docs/user/ADVANCED_USAGE.md +208 -115
- data/docs/user/CLI_FALLBACK_FOR_LLMS.md +2 -0
- data/docs/user/CLI_USAGE.md +276 -101
- data/docs/user/ERROR_HANDLING.md +4 -4
- data/docs/user/EXAMPLES.md +121 -128
- data/docs/user/INSTALLATION.md +9 -28
- data/docs/user/LIBRARY_API.md +227 -122
- data/docs/user/MCP_INTEGRATION.md +114 -203
- data/docs/user/README.md +5 -1
- data/docs/user/TROUBLESHOOTING.md +49 -27
- data/docs/user/installing-a-prelease-version-of-covloupe.md +43 -0
- data/docs/user/{V2-BREAKING-CHANGES.md → migrations/MIGRATING_TO_V2.md} +62 -72
- data/docs/user/migrations/MIGRATING_TO_V3.md +72 -0
- data/docs/user/migrations/MIGRATING_TO_V4.md +591 -0
- data/docs/user/migrations/README.md +22 -0
- data/docs/user/prompts/README.md +9 -0
- data/docs/user/prompts/non-web-coverage-analysis-prompt.md +103 -0
- data/docs/user/prompts/rails-coverage-analysis-prompt.md +94 -0
- data/docs/user/prompts/use-cli-not-mcp-prompt.md +53 -0
- data/examples/cli_demo.sh +77 -0
- data/examples/filter_and_table_demo-output.md +114 -0
- data/examples/filter_and_table_demo.rb +174 -0
- data/examples/fixtures/demo_project/coverage/.resultset.json +10 -0
- data/examples/mcp-inputs/README.md +66 -0
- data/examples/mcp-inputs/coverage_detailed.json +1 -0
- data/examples/mcp-inputs/coverage_raw.json +1 -0
- data/examples/mcp-inputs/coverage_summary.json +1 -0
- data/examples/mcp-inputs/list.json +1 -0
- data/examples/mcp-inputs/uncovered_lines.json +1 -0
- data/examples/prompts/README.md +27 -0
- data/examples/prompts/custom_resultset.txt +2 -0
- data/examples/prompts/detailed_with_source.txt +2 -0
- data/examples/prompts/list_lowest.txt +2 -0
- data/examples/prompts/summary.txt +2 -0
- data/examples/prompts/uncovered.txt +2 -0
- data/examples/success_predicates/README.md +198 -0
- data/examples/success_predicates/all_files_above_threshold_predicate.rb +21 -0
- data/examples/success_predicates/directory_specific_thresholds_predicate.rb +30 -0
- data/examples/success_predicates/project_coverage_minimum_predicate.rb +6 -0
- data/lib/cov_loupe/base_tool.rb +229 -20
- data/lib/cov_loupe/cli.rb +132 -23
- data/lib/cov_loupe/commands/base_command.rb +25 -6
- data/lib/cov_loupe/commands/command_factory.rb +0 -1
- data/lib/cov_loupe/commands/detailed_command.rb +10 -5
- data/lib/cov_loupe/commands/list_command.rb +2 -1
- data/lib/cov_loupe/commands/raw_command.rb +7 -5
- data/lib/cov_loupe/commands/summary_command.rb +12 -7
- data/lib/cov_loupe/commands/totals_command.rb +74 -10
- data/lib/cov_loupe/commands/uncovered_command.rb +7 -5
- data/lib/cov_loupe/commands/validate_command.rb +11 -3
- data/lib/cov_loupe/commands/version_command.rb +6 -4
- data/lib/cov_loupe/{app_config.rb → config/app_config.rb} +13 -5
- data/lib/cov_loupe/config/app_context.rb +43 -0
- data/lib/cov_loupe/config/boolean_type.rb +91 -0
- data/lib/cov_loupe/config/logger.rb +92 -0
- data/lib/cov_loupe/{option_normalizers.rb → config/option_normalizers.rb} +55 -24
- data/lib/cov_loupe/{option_parser_builder.rb → config/option_parser_builder.rb} +46 -24
- data/lib/cov_loupe/coverage/coverage_calculator.rb +53 -0
- data/lib/cov_loupe/coverage/coverage_reporter.rb +63 -0
- data/lib/cov_loupe/coverage/coverage_table_formatter.rb +133 -0
- data/lib/cov_loupe/{error_handler.rb → errors/error_handler.rb} +21 -33
- data/lib/cov_loupe/{errors.rb → errors/errors.rb} +48 -71
- data/lib/cov_loupe/formatters/formatters.rb +75 -0
- data/lib/cov_loupe/formatters/source_formatter.rb +18 -7
- data/lib/cov_loupe/formatters/table_formatter.rb +80 -0
- data/lib/cov_loupe/loaders/all.rb +15 -0
- data/lib/cov_loupe/loaders/all_cli.rb +10 -0
- data/lib/cov_loupe/loaders/all_mcp.rb +23 -0
- data/lib/cov_loupe/loaders/resultset_loader.rb +147 -0
- data/lib/cov_loupe/mcp_server.rb +3 -2
- data/lib/cov_loupe/model/model.rb +520 -0
- data/lib/cov_loupe/model/model_data.rb +13 -0
- data/lib/cov_loupe/model/model_data_cache.rb +116 -0
- data/lib/cov_loupe/option_parsers/env_options_parser.rb +17 -6
- data/lib/cov_loupe/option_parsers/error_helper.rb +16 -10
- data/lib/cov_loupe/output_chars.rb +192 -0
- data/lib/cov_loupe/paths/glob_utils.rb +100 -0
- data/lib/cov_loupe/{path_relativizer.rb → paths/path_relativizer.rb} +5 -13
- data/lib/cov_loupe/paths/path_utils.rb +265 -0
- data/lib/cov_loupe/paths/volume_case_sensitivity.rb +173 -0
- data/lib/cov_loupe/presenters/base_coverage_presenter.rb +9 -13
- data/lib/cov_loupe/presenters/coverage_payload_presenter.rb +21 -0
- data/lib/cov_loupe/presenters/payload_caching.rb +23 -0
- data/lib/cov_loupe/presenters/project_coverage_presenter.rb +73 -21
- data/lib/cov_loupe/presenters/project_totals_presenter.rb +16 -10
- data/lib/cov_loupe/repositories/coverage_repository.rb +149 -0
- data/lib/cov_loupe/resolvers/coverage_line_resolver.rb +90 -76
- data/lib/cov_loupe/resolvers/{resolver_factory.rb → resolver_helpers.rb} +6 -5
- data/lib/cov_loupe/resolvers/resultset_path_resolver.rb +40 -12
- data/lib/cov_loupe/scripts/command_execution.rb +113 -0
- data/lib/cov_loupe/scripts/latest_ci_status.rb +97 -0
- data/lib/cov_loupe/scripts/pre_release_check.rb +164 -0
- data/lib/cov_loupe/scripts/setup_doc_server.rb +23 -0
- data/lib/cov_loupe/scripts/start_doc_server.rb +24 -0
- data/lib/cov_loupe/staleness/stale_status.rb +23 -0
- data/lib/cov_loupe/staleness/staleness_checker.rb +328 -0
- data/lib/cov_loupe/staleness/staleness_message_formatter.rb +91 -0
- data/lib/cov_loupe/tools/coverage_detailed_tool.rb +14 -15
- data/lib/cov_loupe/tools/coverage_raw_tool.rb +14 -14
- data/lib/cov_loupe/tools/coverage_summary_tool.rb +16 -16
- data/lib/cov_loupe/tools/coverage_table_tool.rb +139 -21
- data/lib/cov_loupe/tools/coverage_totals_tool.rb +31 -13
- data/lib/cov_loupe/tools/help_tool.rb +16 -20
- data/lib/cov_loupe/tools/list_tool.rb +65 -0
- data/lib/cov_loupe/tools/uncovered_lines_tool.rb +14 -14
- data/lib/cov_loupe/tools/validate_tool.rb +18 -24
- data/lib/cov_loupe/tools/version_tool.rb +8 -3
- data/lib/cov_loupe/version.rb +1 -1
- data/lib/cov_loupe.rb +83 -55
- metadata +184 -154
- data/docs/dev/BRANCH_ONLY_COVERAGE.md +0 -158
- data/docs/dev/arch-decisions/001-x-arch-decision.md +0 -95
- data/docs/dev/arch-decisions/002-x-arch-decision.md +0 -159
- data/docs/dev/arch-decisions/003-x-arch-decision.md +0 -165
- data/lib/cov_loupe/app_context.rb +0 -26
- data/lib/cov_loupe/constants.rb +0 -22
- data/lib/cov_loupe/coverage_reporter.rb +0 -31
- data/lib/cov_loupe/formatters.rb +0 -51
- data/lib/cov_loupe/mode_detector.rb +0 -56
- data/lib/cov_loupe/model.rb +0 -339
- data/lib/cov_loupe/presenters/coverage_detailed_presenter.rb +0 -14
- data/lib/cov_loupe/presenters/coverage_raw_presenter.rb +0 -14
- data/lib/cov_loupe/presenters/coverage_summary_presenter.rb +0 -14
- data/lib/cov_loupe/presenters/coverage_uncovered_presenter.rb +0 -14
- data/lib/cov_loupe/resultset_loader.rb +0 -131
- data/lib/cov_loupe/staleness_checker.rb +0 -247
- data/lib/cov_loupe/table_formatter.rb +0 -64
- data/lib/cov_loupe/tools/all_files_coverage_tool.rb +0 -51
- data/lib/cov_loupe/util.rb +0 -88
- data/spec/MCP_INTEGRATION_TESTS_README.md +0 -111
- data/spec/TIMESTAMPS.md +0 -48
- data/spec/all_files_coverage_tool_spec.rb +0 -53
- data/spec/app_config_spec.rb +0 -142
- data/spec/base_tool_spec.rb +0 -62
- data/spec/cli/show_default_report_spec.rb +0 -33
- data/spec/cli_enumerated_options_spec.rb +0 -90
- data/spec/cli_error_spec.rb +0 -184
- data/spec/cli_format_spec.rb +0 -123
- data/spec/cli_json_options_spec.rb +0 -50
- data/spec/cli_source_spec.rb +0 -44
- data/spec/cli_spec.rb +0 -192
- data/spec/cli_table_spec.rb +0 -28
- data/spec/cli_usage_spec.rb +0 -42
- data/spec/commands/base_command_spec.rb +0 -107
- data/spec/commands/command_factory_spec.rb +0 -76
- data/spec/commands/detailed_command_spec.rb +0 -34
- data/spec/commands/list_command_spec.rb +0 -28
- data/spec/commands/raw_command_spec.rb +0 -69
- data/spec/commands/summary_command_spec.rb +0 -34
- data/spec/commands/totals_command_spec.rb +0 -34
- data/spec/commands/uncovered_command_spec.rb +0 -55
- data/spec/commands/validate_command_spec.rb +0 -213
- data/spec/commands/version_command_spec.rb +0 -38
- data/spec/constants_spec.rb +0 -61
- data/spec/cov_loupe/formatters/source_formatter_spec.rb +0 -267
- data/spec/cov_loupe/formatters_spec.rb +0 -76
- data/spec/cov_loupe/presenters/base_coverage_presenter_spec.rb +0 -79
- data/spec/cov_loupe_model_spec.rb +0 -454
- data/spec/cov_loupe_module_spec.rb +0 -37
- data/spec/cov_loupe_opts_spec.rb +0 -185
- data/spec/coverage_reporter_spec.rb +0 -102
- data/spec/coverage_table_tool_spec.rb +0 -59
- data/spec/coverage_totals_tool_spec.rb +0 -37
- data/spec/error_handler_spec.rb +0 -197
- data/spec/error_mode_spec.rb +0 -139
- data/spec/errors_edge_cases_spec.rb +0 -312
- data/spec/errors_stale_spec.rb +0 -83
- data/spec/file_based_mcp_tools_spec.rb +0 -99
- data/spec/help_tool_spec.rb +0 -26
- data/spec/integration_spec.rb +0 -789
- data/spec/logging_fallback_spec.rb +0 -128
- data/spec/mcp_logging_spec.rb +0 -44
- data/spec/mcp_server_integration_spec.rb +0 -23
- data/spec/mcp_server_spec.rb +0 -106
- data/spec/mode_detector_spec.rb +0 -153
- data/spec/model_error_handling_spec.rb +0 -269
- data/spec/model_staleness_spec.rb +0 -79
- data/spec/option_normalizers_spec.rb +0 -203
- data/spec/option_parsers/env_options_parser_spec.rb +0 -221
- data/spec/option_parsers/error_helper_spec.rb +0 -222
- data/spec/path_relativizer_spec.rb +0 -98
- data/spec/presenters/coverage_detailed_presenter_spec.rb +0 -19
- data/spec/presenters/coverage_raw_presenter_spec.rb +0 -15
- data/spec/presenters/coverage_summary_presenter_spec.rb +0 -15
- data/spec/presenters/coverage_uncovered_presenter_spec.rb +0 -16
- data/spec/presenters/project_coverage_presenter_spec.rb +0 -87
- data/spec/presenters/project_totals_presenter_spec.rb +0 -144
- data/spec/resolvers/coverage_line_resolver_spec.rb +0 -282
- data/spec/resolvers/resolver_factory_spec.rb +0 -61
- data/spec/resolvers/resultset_path_resolver_spec.rb +0 -60
- data/spec/resultset_loader_spec.rb +0 -167
- data/spec/shared_examples/README.md +0 -115
- data/spec/shared_examples/coverage_presenter_examples.rb +0 -66
- data/spec/shared_examples/file_based_mcp_tools.rb +0 -179
- data/spec/shared_examples/formatted_command_examples.rb +0 -64
- data/spec/shared_examples/mcp_tool_text_json_response.rb +0 -16
- data/spec/spec_helper.rb +0 -127
- data/spec/staleness_checker_spec.rb +0 -374
- data/spec/staleness_more_spec.rb +0 -42
- data/spec/support/cli_helpers.rb +0 -22
- data/spec/support/control_flow_helpers.rb +0 -20
- data/spec/support/fake_mcp.rb +0 -40
- data/spec/support/io_helpers.rb +0 -29
- data/spec/support/mcp_helpers.rb +0 -35
- data/spec/support/mcp_runner.rb +0 -66
- data/spec/support/mocking_helpers.rb +0 -30
- data/spec/table_format_spec.rb +0 -70
- data/spec/tools/validate_tool_spec.rb +0 -132
- data/spec/tools_error_handling_spec.rb +0 -130
- data/spec/util_spec.rb +0 -154
- data/spec/version_spec.rb +0 -123
- data/spec/version_tool_spec.rb +0 -141
- /data/{spec/fixtures/project1 → examples/fixtures/demo_project}/lib/bar.rb +0 -0
- /data/{spec/fixtures/project1 → examples/fixtures/demo_project}/lib/foo.rb +0 -0
- /data/lib/cov_loupe/{config_parser.rb → config/config_parser.rb} +0 -0
- /data/lib/cov_loupe/{predicate_evaluator.rb → config/predicate_evaluator.rb} +0 -0
- /data/lib/cov_loupe/{error_handler_factory.rb → errors/error_handler_factory.rb} +0 -0
data/docs/user/CLI_USAGE.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# CLI Usage Guide
|
|
2
2
|
|
|
3
|
-
[Back to main README](../
|
|
3
|
+
[Back to main README](../index.md)
|
|
4
4
|
|
|
5
5
|
Complete reference for using cov-loupe from the command line.
|
|
6
6
|
|
|
7
7
|
> Docs use `clp` as a shortcut pointing at the demo fixture with partial coverage:
|
|
8
|
-
> `alias clp='cov-loupe
|
|
8
|
+
> `alias clp='cov-loupe -R docs/fixtures/demo_project'` # -R = --root
|
|
9
9
|
> Replace `clp` with `cov-loupe` to run commands against your own project.
|
|
10
|
+
> The demo fixture is a small Rails-like project in `docs/fixtures/demo_project` with intentional coverage gaps for testing `--tracked-globs`.
|
|
10
11
|
|
|
11
12
|
## Table of Contents
|
|
12
13
|
|
|
@@ -67,29 +68,29 @@ Default sort order is descending (highest coverage first) so the lowest-coverage
|
|
|
67
68
|
|---------|--------------------------|-------------------------------------------------------|
|
|
68
69
|
| `-o` | `--sort-order` | Sort by coverage percentage (ascending or descending) |
|
|
69
70
|
| `-g` | `--tracked-globs` | Filter to specific file patterns |
|
|
70
|
-
| `-S` | `--
|
|
71
|
+
| `-S` | `--raise-on-stale` | Raise error if coverage is stale (default false) |
|
|
71
72
|
| `-fJ` | `--format pretty-json` | Output as pretty-printed JSON |
|
|
72
73
|
| `-fj` | `--format json` | Output as single-line JSON |
|
|
73
74
|
| `-f y` | `--format yaml` | Output as YAML |
|
|
74
|
-
| `-f ap` | `--format
|
|
75
|
+
| `-f ap` | `--format amazing_print` | Output using AmazingPrint | |
|
|
75
76
|
|
|
76
77
|
**Output (table format):**
|
|
77
78
|
```
|
|
78
79
|
┌────────────────────────────────────────┬──────────┬───────────┬─────────┬───────┐
|
|
79
80
|
│ File │ % │ Covered │ Total │ Stale │
|
|
80
81
|
├────────────────────────────────────────┼──────────┼───────────┼─────────┼───────┤
|
|
81
|
-
│
|
|
82
|
-
│
|
|
82
|
+
│ app/models/user.rb │ 100.00% │ 6 │ 6 │ │
|
|
83
|
+
│ lib/api/client.rb │ 88.89% │ 8 │ 9 │ │
|
|
84
|
+
│ app/models/order.rb │ 85.71% │ 6 │ 7 │ │
|
|
83
85
|
│ lib/ops/jobs/report_job.rb │ 80.00% │ 4 │ 5 │ │
|
|
84
86
|
│ lib/payments/processor.rb │ 80.00% │ 4 │ 5 │ │
|
|
85
|
-
│ app/
|
|
86
|
-
│ lib/
|
|
87
|
-
│ app/models/user.rb │ 100.00% │ 6 │ 6 │ │
|
|
87
|
+
│ app/controllers/orders_controller.rb │ 70.00% │ 7 │ 10 │ │
|
|
88
|
+
│ lib/payments/refund_service.rb │ 60.00% │ 3 │ 5 │ │
|
|
88
89
|
└────────────────────────────────────────┴──────────┴───────────┴─────────┴───────┘
|
|
89
90
|
Files: total 7, ok 7, stale 0
|
|
90
91
|
```
|
|
91
92
|
|
|
92
|
-
**Stale indicators:**
|
|
93
|
+
**Stale indicators:** missing (missing file), newer (timestamp mismatch), length_mismatch (line count mismatch), error (staleness check error)
|
|
93
94
|
|
|
94
95
|
### `summary <path>`
|
|
95
96
|
|
|
@@ -98,7 +99,7 @@ Show covered/total/percentage for a specific file.
|
|
|
98
99
|
```sh
|
|
99
100
|
clp summary app/models/order.rb
|
|
100
101
|
clp summary app/models/order.rb -fJ
|
|
101
|
-
clp summary app/models/order.rb --source
|
|
102
|
+
clp summary app/models/order.rb -s full # -s = --source
|
|
102
103
|
```
|
|
103
104
|
|
|
104
105
|
**Arguments:**
|
|
@@ -111,12 +112,16 @@ clp summary app/models/order.rb --source full
|
|
|
111
112
|
| `-fJ` | `--format pretty-json` | Output as pretty-printed JSON |
|
|
112
113
|
| `-fj` | `--format json` | Output as single-line JSON |
|
|
113
114
|
| `-f y` | `--format yaml` | Output as YAML |
|
|
114
|
-
| `-f ap` | `--format
|
|
115
|
+
| `-f ap` | `--format amazing_print` | Output using AmazingPrint | |
|
|
115
116
|
| `-s` | `--source MODE` | Include source code (full or uncovered) |
|
|
116
117
|
|
|
117
118
|
**Output (default format):**
|
|
118
119
|
```
|
|
119
|
-
|
|
120
|
+
┌───────────────────────┬──────────┬─────────┬───────┬───────┐
|
|
121
|
+
│ File │ % │ Covered │ Total │ Stale │
|
|
122
|
+
├───────────────────────┼──────────┼─────────┼───────┼───────┤
|
|
123
|
+
│ app/models/order.rb │ 85.71% │ 6 │ 7 │ │
|
|
124
|
+
└───────────────────────┴──────────┴─────────┴───────┴───────┘
|
|
120
125
|
```
|
|
121
126
|
|
|
122
127
|
**Output (JSON format):**
|
|
@@ -128,7 +133,7 @@ clp summary app/models/order.rb --source full
|
|
|
128
133
|
"total": 7,
|
|
129
134
|
"percentage": 85.71
|
|
130
135
|
},
|
|
131
|
-
"stale":
|
|
136
|
+
"stale": "ok"
|
|
132
137
|
}
|
|
133
138
|
```
|
|
134
139
|
|
|
@@ -138,8 +143,8 @@ Show uncovered line numbers for a specific file.
|
|
|
138
143
|
|
|
139
144
|
```sh
|
|
140
145
|
clp uncovered app/controllers/orders_controller.rb
|
|
141
|
-
clp uncovered app/controllers/orders_controller.rb --source
|
|
142
|
-
clp uncovered app/controllers/orders_controller.rb
|
|
146
|
+
clp uncovered app/controllers/orders_controller.rb -s uncovered # -s = --source
|
|
147
|
+
clp uncovered app/controllers/orders_controller.rb -s uncovered -c 3 # -c = --context-lines
|
|
143
148
|
```
|
|
144
149
|
|
|
145
150
|
**Arguments:**
|
|
@@ -147,16 +152,15 @@ clp uncovered app/controllers/orders_controller.rb --source uncovered --context-
|
|
|
147
152
|
|
|
148
153
|
**Options:**
|
|
149
154
|
|
|
150
|
-
| Short
|
|
151
|
-
|
|
152
|
-
| `-s`
|
|
153
|
-
| `-c`
|
|
154
|
-
|
|
|
155
|
-
|
|
|
156
|
-
| `-
|
|
157
|
-
| `-
|
|
158
|
-
| `-f
|
|
159
|
-
| `-f ap` | `--format awesome_print` | Output using AwesomePrint |
|
|
155
|
+
| Short | Long | Description |
|
|
156
|
+
|---------|--------------------------|------------------------------------------------------|
|
|
157
|
+
| `-s` | `--source uncovered` | Show uncovered lines with context |
|
|
158
|
+
| `-c` | `--context-lines N` | Lines of context around uncovered lines (default: 2) |
|
|
159
|
+
| `-C` | `--color BOOLEAN` | Enable (`true`)/disable (`false`) syntax coloring |
|
|
160
|
+
| `-fJ` | `--format pretty-json` | Output as pretty-printed JSON |
|
|
161
|
+
| `-fj` | `--format json` | Output as single-line JSON |
|
|
162
|
+
| `-f y` | `--format yaml` | Output as YAML |
|
|
163
|
+
| `-f ap` | `--format amazing_print` | Output using AmazingPrint | |
|
|
160
164
|
|
|
161
165
|
**Output (default format):**
|
|
162
166
|
```
|
|
@@ -194,7 +198,7 @@ Show per-line coverage with hit counts.
|
|
|
194
198
|
```sh
|
|
195
199
|
clp detailed app/models/order.rb
|
|
196
200
|
clp detailed app/models/order.rb -fJ
|
|
197
|
-
clp detailed app/models/order.rb --source
|
|
201
|
+
clp detailed app/models/order.rb -s full # -s = --source
|
|
198
202
|
```
|
|
199
203
|
|
|
200
204
|
**Arguments:**
|
|
@@ -207,21 +211,25 @@ clp detailed app/models/order.rb --source full
|
|
|
207
211
|
| `-fJ` | `--format pretty-json` | Output as pretty-printed JSON |
|
|
208
212
|
| `-fj` | `--format json` | Output as single-line JSON |
|
|
209
213
|
| `-f y` | `--format yaml` | Output as YAML |
|
|
210
|
-
| `-f ap` | `--format
|
|
214
|
+
| `-f ap` | `--format amazing_print` | Output using AmazingPrint | |
|
|
211
215
|
| `-s` | `--source MODE` | Include source code |
|
|
212
216
|
|
|
213
217
|
**Output (default format):**
|
|
214
218
|
```
|
|
215
219
|
File: app/models/order.rb
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
220
|
+
Coverage: 6/7 lines (85.71%)
|
|
221
|
+
|
|
222
|
+
┌──────┬──────┬─────────┐
|
|
223
|
+
│ Line │ Hits │ Covered │
|
|
224
|
+
├──────┼──────┼─────────┤
|
|
225
|
+
│ 6 │ 1 │ yes │
|
|
226
|
+
│ 7 │ 1 │ yes │
|
|
227
|
+
│ 8 │ 1 │ yes │
|
|
228
|
+
│ 11 │ 1 │ yes │
|
|
229
|
+
│ 12 │ 1 │ yes │
|
|
230
|
+
│ 15 │ 1 │ yes │
|
|
231
|
+
│ 16 │ 0 │ no │
|
|
232
|
+
└──────┴──────┴─────────┘
|
|
225
233
|
```
|
|
226
234
|
|
|
227
235
|
**Output (JSON format):**
|
|
@@ -242,7 +250,7 @@ File: app/models/order.rb
|
|
|
242
250
|
"total": 7,
|
|
243
251
|
"percentage": 85.71
|
|
244
252
|
},
|
|
245
|
-
"stale":
|
|
253
|
+
"stale": "ok"
|
|
246
254
|
}
|
|
247
255
|
```
|
|
248
256
|
|
|
@@ -269,7 +277,7 @@ File: app/models/order.rb
|
|
|
269
277
|
{
|
|
270
278
|
"file": "app/models/order.rb",
|
|
271
279
|
"lines": [null, null, null, null, null, 1, 1, 1, null, null, 1, 1, null, null, 1, 0, null, null, null, null],
|
|
272
|
-
"stale":
|
|
280
|
+
"stale": "ok"
|
|
273
281
|
}
|
|
274
282
|
```
|
|
275
283
|
|
|
@@ -290,22 +298,73 @@ clp -g "lib/ops/jobs/*.rb" totals # -g = --tracked-globs
|
|
|
290
298
|
|
|
291
299
|
**Output (default format):**
|
|
292
300
|
```
|
|
293
|
-
|
|
294
|
-
|
|
301
|
+
Tracked globs:
|
|
302
|
+
- lib/**/*.rb
|
|
303
|
+
- app/**/*.rb
|
|
304
|
+
- src/**/*.rb
|
|
305
|
+
|
|
306
|
+
Totals
|
|
307
|
+
┌──────────┬───────┬─────────┬───────────┬────────┐
|
|
308
|
+
│ Metric │ Total │ Covered │ Uncovered │ % │
|
|
309
|
+
├──────────┼───────┼─────────┼───────────┼────────┤
|
|
310
|
+
│ Lines │ 47 │ 38 │ 9 │ 80.85% │
|
|
311
|
+
│ Files │ 7 │ 7 │ 0 │ │
|
|
312
|
+
└──────────┴───────┴─────────┴───────────┴────────┘
|
|
313
|
+
|
|
314
|
+
File breakdown:
|
|
315
|
+
With coverage: 7 total, 7 ok, 0 stale
|
|
316
|
+
Stale: missing on disk = 0, newer than coverage = 0, line mismatch = 0, unreadable = 0
|
|
317
|
+
Without coverage: 0 total
|
|
318
|
+
Missing from coverage = 0, unreadable = 0, skipped (errors) = 0
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
**Tracked globs (shown when tracking is enabled):**
|
|
322
|
+
```
|
|
323
|
+
Tracked globs:
|
|
324
|
+
- lib/**/*.rb
|
|
325
|
+
- app/**/*.rb
|
|
295
326
|
```
|
|
296
327
|
|
|
297
328
|
**Output (JSON format):**
|
|
298
329
|
```json
|
|
299
330
|
{
|
|
300
|
-
"lines": { "total": 47, "covered": 38, "uncovered": 9 },
|
|
301
|
-
"
|
|
302
|
-
"files": {
|
|
331
|
+
"lines": { "total": 47, "covered": 38, "uncovered": 9, "percent_covered": 80.85 },
|
|
332
|
+
"tracking": { "enabled": true, "globs": ["lib/**/*.rb", "app/**/*.rb"] },
|
|
333
|
+
"files": {
|
|
334
|
+
"total": 7,
|
|
335
|
+
"with_coverage": {
|
|
336
|
+
"total": 7,
|
|
337
|
+
"ok": 7,
|
|
338
|
+
"stale": {
|
|
339
|
+
"total": 0,
|
|
340
|
+
"by_type": {
|
|
341
|
+
"missing_from_disk": 0,
|
|
342
|
+
"newer": 0,
|
|
343
|
+
"length_mismatch": 0,
|
|
344
|
+
"unreadable": 0
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
"without_coverage": {
|
|
349
|
+
"total": 0,
|
|
350
|
+
"by_type": {
|
|
351
|
+
"missing_from_coverage": 0,
|
|
352
|
+
"unreadable": 0,
|
|
353
|
+
"skipped": 0
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
303
357
|
}
|
|
304
358
|
```
|
|
305
359
|
|
|
306
360
|
**Notes:**
|
|
307
|
-
-
|
|
308
|
-
-
|
|
361
|
+
- `lines` are based on fresh coverage entries only.
|
|
362
|
+
- `with_coverage.stale.by_type` uses readable labels: `missing_from_disk`, `newer`,
|
|
363
|
+
`length_mismatch`, `unreadable`.
|
|
364
|
+
- `without_coverage` is only present when tracking is enabled (tracked globs provided).
|
|
365
|
+
- Respects `-g` / `--tracked-globs` when you only want to aggregate a subset of files.
|
|
366
|
+
- Totals exclude stale files (`"missing"`, `"newer"`, `"length_mismatch"`, `"error"`) so the aggregate reflects only fresh coverage data.
|
|
367
|
+
- Honors `-S` / `--raise-on-stale` to raise if coverage data is out of date.
|
|
309
368
|
|
|
310
369
|
### `version`
|
|
311
370
|
|
|
@@ -329,14 +388,14 @@ These options work with all subcommands.
|
|
|
329
388
|
|
|
330
389
|
Path to the `.resultset.json` file or a directory containing it.
|
|
331
390
|
|
|
332
|
-
For a detailed explanation of how to configure the resultset location, including the default search path, environment variables, and MCP configuration, see the [Configuring the Resultset](../
|
|
391
|
+
For a detailed explanation of how to configure the resultset location, including the default search path, environment variables, and MCP configuration, see the [Configuring the Resultset](../index.md#configuring-the-resultset) section in the main README.
|
|
333
392
|
|
|
334
393
|
### `-R, --root PATH`
|
|
335
394
|
|
|
336
395
|
Project root directory (default: current directory).
|
|
337
396
|
|
|
338
397
|
```sh
|
|
339
|
-
clp
|
|
398
|
+
clp -R /path/to/project # -R = --root
|
|
340
399
|
```
|
|
341
400
|
|
|
342
401
|
### `-fJ`
|
|
@@ -387,7 +446,7 @@ clp -s u uncovered lib/api/client.rb # u = uncovered
|
|
|
387
446
|
|
|
388
447
|
### `-c, --context-lines N`
|
|
389
448
|
|
|
390
|
-
Number of context lines around uncovered code (for `--source uncovered`). Must be a non-negative integer.
|
|
449
|
+
Number of context lines around uncovered code (for `-s uncovered` / `--source uncovered`). Must be a non-negative integer.
|
|
391
450
|
|
|
392
451
|
```sh
|
|
393
452
|
clp -s u -c 3 uncovered lib/api/client.rb # -s u = uncovered, -c = --context-lines
|
|
@@ -395,49 +454,115 @@ clp -s u -c 3 uncovered lib/api/client.rb # -s u = uncovered, -c = --context-li
|
|
|
395
454
|
|
|
396
455
|
**Default:** 2 lines
|
|
397
456
|
|
|
398
|
-
### `--color` / `--
|
|
457
|
+
### Boolean Flags (`--color` / `-C`, `--raise-on-stale`)
|
|
399
458
|
|
|
400
|
-
|
|
459
|
+
These options require explicit boolean values. Recognized literals:
|
|
460
|
+
|
|
461
|
+
| true | false |
|
|
462
|
+
|--------|---------|
|
|
463
|
+
| `yes` | `no` |
|
|
464
|
+
| `y` | `n` |
|
|
465
|
+
| `true` | `false` |
|
|
466
|
+
| `t` | `f` |
|
|
467
|
+
| `on` | `off` |
|
|
468
|
+
| `+` | `-` |
|
|
469
|
+
| `1` | `0` |
|
|
401
470
|
|
|
402
471
|
```sh
|
|
403
|
-
clp
|
|
404
|
-
clp
|
|
472
|
+
clp --color false # disable color
|
|
473
|
+
clp --raise-on-stale yes # enforce stale coverage failures
|
|
405
474
|
```
|
|
406
475
|
|
|
407
|
-
|
|
476
|
+
### `-C, --color BOOLEAN`
|
|
408
477
|
|
|
409
|
-
|
|
478
|
+
Enable or disable ANSI color codes in source output. Requires an explicit boolean value.
|
|
410
479
|
|
|
411
|
-
|
|
480
|
+
```sh
|
|
481
|
+
clp uncovered lib/api/client.rb -s uncovered --color true
|
|
482
|
+
clp uncovered lib/api/client.rb -s uncovered -C false
|
|
483
|
+
```
|
|
412
484
|
|
|
413
|
-
**
|
|
485
|
+
**Default:** Colors enabled if output is a TTY
|
|
486
|
+
|
|
487
|
+
### `-S, --raise-on-stale BOOLEAN`
|
|
414
488
|
|
|
415
|
-
|
|
416
|
-
|-------|---------|----------------------------------------------------------|
|
|
417
|
-
| `o` | `off` | Detect and mark stale files, but don't raise error (default) |
|
|
418
|
-
| `e` | `error` | Detect stale files and raise error |
|
|
489
|
+
Raise error if coverage is stale. Requires an explicit boolean value. Default is `false` (only report staleness in output).
|
|
419
490
|
|
|
420
491
|
```sh
|
|
421
|
-
#
|
|
422
|
-
clp
|
|
423
|
-
clp -
|
|
492
|
+
# Enable raising an error if coverage is stale
|
|
493
|
+
clp -S true
|
|
494
|
+
clp --raise-on-stale yes
|
|
495
|
+
|
|
496
|
+
# Explicitly disable raising an error (useful to override COV_LOUPE_OPTS)
|
|
497
|
+
clp --raise-on-stale false
|
|
424
498
|
```
|
|
425
499
|
|
|
426
500
|
**Staleness conditions:**
|
|
427
|
-
- **
|
|
428
|
-
- **
|
|
429
|
-
- **
|
|
501
|
+
- **"missing"** (Missing): Source file no longer exists on disk
|
|
502
|
+
- **"newer"** (Timestamp): Source file modified after coverage was generated
|
|
503
|
+
- **"length_mismatch"** (Length): Source file line count differs from coverage data
|
|
504
|
+
- **"error"** (Error): Staleness check failed due to permission or I/O errors
|
|
430
505
|
- Tracked files missing from coverage (with --tracked-globs)
|
|
431
506
|
|
|
432
507
|
### `-g, --tracked-globs PATTERNS`
|
|
433
508
|
|
|
434
509
|
Comma-separated glob patterns for files that should be tracked.
|
|
435
510
|
|
|
511
|
+
**Default:** `[]` (empty - shows all files in the resultset)
|
|
512
|
+
|
|
513
|
+
**Why no default patterns?**
|
|
514
|
+
1. **Transparency** - Shows all coverage data without hiding files that don't match assumptions
|
|
515
|
+
2. **Avoids false positives** - Broad patterns like `**/*.rb` flag migrations, bin scripts, etc. as "missing"
|
|
516
|
+
3. **Project variety** - Coverage patterns vary by project structure (lib/, app/, src/, config/, etc.)
|
|
517
|
+
|
|
518
|
+
**Important:** Files lacking any coverage at all (not loaded during tests) will not appear in the resultset and therefore won't be visible with the default empty array. To detect such files, you must set `--tracked-globs` to match the files you expect to have coverage.
|
|
519
|
+
|
|
520
|
+
**Best practice:** Match your SimpleCov configuration by setting `COV_LOUPE_OPTS`:
|
|
521
|
+
|
|
522
|
+
```ruby
|
|
523
|
+
# In spec_helper.rb or similar
|
|
524
|
+
SimpleCov.start do
|
|
525
|
+
add_filter '/spec/'
|
|
526
|
+
add_filter '/test/'
|
|
527
|
+
track_files 'lib/**/*.rb'
|
|
528
|
+
track_files 'app/**/*.rb'
|
|
529
|
+
end
|
|
530
|
+
```
|
|
531
|
+
|
|
436
532
|
```sh
|
|
437
|
-
|
|
533
|
+
# In your shell config (.bashrc, .zshrc, etc.)
|
|
534
|
+
# Match the track_files patterns above
|
|
535
|
+
export COV_LOUPE_OPTS="--tracked-globs lib/**/*.rb,app/**/*.rb"
|
|
438
536
|
```
|
|
439
537
|
|
|
440
|
-
|
|
538
|
+
**Usage:**
|
|
539
|
+
|
|
540
|
+
```sh
|
|
541
|
+
# Use environment variable for project-wide default
|
|
542
|
+
export COV_LOUPE_OPTS="--tracked-globs lib/**/*.rb,app/**/*.rb"
|
|
543
|
+
clp list # Uses globs from env var
|
|
544
|
+
|
|
545
|
+
# Or specify per-command
|
|
546
|
+
clp -g "lib/api/**/*.rb" list
|
|
547
|
+
|
|
548
|
+
# Multiple patterns
|
|
549
|
+
clp -g "lib/**/*.rb,app/models/**/*.rb" list
|
|
550
|
+
|
|
551
|
+
# Export for CI (with globs to match SimpleCov)
|
|
552
|
+
clp -g "lib/**/*.rb,app/**/*.rb" -fJ list > coverage.json
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
**Use cases:**
|
|
556
|
+
- **Exclude unwanted results** - Narrow focus to a subsystem or layer
|
|
557
|
+
- **Include files without coverage** - Report files that should be tracked but aren't in the resultset
|
|
558
|
+
- **CI validation** - Use with `-S`/`--raise-on-stale` to catch coverage gaps
|
|
559
|
+
|
|
560
|
+
**Important:** The `missing_tracked_files` array (in `list` output) only includes files that:
|
|
561
|
+
1. Match the tracked globs
|
|
562
|
+
2. Exist in the filesystem
|
|
563
|
+
3. Are NOT in the coverage resultset
|
|
564
|
+
|
|
565
|
+
Without globs, this array is empty (no expectations = no violations).
|
|
441
566
|
|
|
442
567
|
### `-l, --log-file PATH`
|
|
443
568
|
|
|
@@ -451,7 +576,9 @@ clp -l stderr # Log to standard error
|
|
|
451
576
|
|
|
452
577
|
**Default:** `./cov_loupe.log`
|
|
453
578
|
|
|
454
|
-
|
|
579
|
+
**Warning:** Log files may grow unbounded in long-running or CI usage. Consider using a log rotation tool or periodically cleaning up the log file if this is a concern.
|
|
580
|
+
|
|
581
|
+
### `-e, --error-mode MODE`
|
|
455
582
|
|
|
456
583
|
Error handling verbosity.
|
|
457
584
|
|
|
@@ -465,14 +592,62 @@ Error handling verbosity.
|
|
|
465
592
|
|
|
466
593
|
```sh
|
|
467
594
|
clp --error-mode debug summary lib/api/client.rb
|
|
595
|
+
clp -e debug summary lib/api/client.rb # -e = --error-mode
|
|
596
|
+
clp -edebug summary lib/api/client.rb # attached short option form
|
|
468
597
|
```
|
|
469
598
|
|
|
470
|
-
###
|
|
599
|
+
### `-O, --output-chars MODE`
|
|
600
|
+
|
|
601
|
+
Control output character encoding for ASCII-only environments.
|
|
602
|
+
|
|
603
|
+
**Modes:**
|
|
604
|
+
|
|
605
|
+
| Short | Long | Description |
|
|
606
|
+
|-------|-------------|---------------------------------------------------|
|
|
607
|
+
| `d` | `default` | Auto-detect terminal UTF-8 support (default) |
|
|
608
|
+
| `f` | `fancy` | Force Unicode output with box-drawing characters |
|
|
609
|
+
| `a` | `ascii` | Force ASCII-only output with transliteration |
|
|
610
|
+
|
|
611
|
+
```sh
|
|
612
|
+
# Default mode (auto-detect)
|
|
613
|
+
clp list
|
|
614
|
+
|
|
615
|
+
# Force ASCII mode (for legacy terminals or CI)
|
|
616
|
+
clp -O ascii list
|
|
617
|
+
clp -O a list # a = ascii
|
|
618
|
+
|
|
619
|
+
# Force fancy mode (Unicode characters)
|
|
620
|
+
clp -O fancy list
|
|
621
|
+
clp -O f list # f = fancy
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
**What gets converted in ASCII mode:**
|
|
625
|
+
- Table borders (│ ─ ┌ ┐ └ ┘ ├ ┤ ┬ ┴ ┼ → | - + + + + + + + + +)
|
|
626
|
+
- Source code markers (✓ · → + -)
|
|
627
|
+
- Error messages and file paths
|
|
628
|
+
- All formatted output (tables, source, JSON, YAML)
|
|
629
|
+
|
|
630
|
+
**What does NOT get converted:**
|
|
631
|
+
- Log files (preserved in original encoding for debugging fidelity)
|
|
632
|
+
- Gem post-install message
|
|
633
|
+
|
|
634
|
+
**Use cases:**
|
|
635
|
+
- **CI/CD systems** with ASCII-only terminals: `clp -O ascii list`
|
|
636
|
+
- **Windows** with legacy encoding: `clp -O ascii summary lib/api/client.rb`
|
|
637
|
+
- **Piped output** to files: `clp -O ascii list > coverage.txt`
|
|
638
|
+
- **Force Unicode** even if terminal detection fails: `clp -O fancy list`
|
|
639
|
+
|
|
640
|
+
**Note:** The default mode auto-detects whether your terminal supports UTF-8. If Unicode characters appear garbled or as question marks, try `clp -O ascii`.
|
|
641
|
+
|
|
642
|
+
### `-m, --mode MODE`
|
|
471
643
|
|
|
472
|
-
|
|
644
|
+
Specify execution mode: `cli` or `mcp` (default: `cli`). Use `--mode mcp` to run as an MCP server.
|
|
645
|
+
In v4.0.0+, automatic mode detection was removed; you must explicitly specify `--mode mcp` to run the MCP server.
|
|
473
646
|
|
|
474
647
|
```sh
|
|
475
|
-
clp
|
|
648
|
+
clp -m mcp # MCP server mode (required for MCP), short option form
|
|
649
|
+
clp --mode mcp # MCP server mode (required for MCP), long option form
|
|
650
|
+
clp -m cli list # CLI mode (default), can use to override environment variable
|
|
476
651
|
```
|
|
477
652
|
|
|
478
653
|
### `validate` Subcommand
|
|
@@ -506,21 +681,21 @@ bundle exec cov-loupe validate coverage_policy.rb
|
|
|
506
681
|
**String mode (inline code):**
|
|
507
682
|
```sh
|
|
508
683
|
# Simple inline validation
|
|
509
|
-
clp validate -i '->(m) { m.
|
|
684
|
+
clp validate -i '->(m) { m.list.all? { |f| f["percentage"] >= 80 } }'
|
|
510
685
|
|
|
511
686
|
# With global options
|
|
512
|
-
clp
|
|
687
|
+
clp -r coverage validate -i '->(m) { m.list.size > 0 }'
|
|
513
688
|
```
|
|
514
689
|
|
|
515
690
|
**Example predicate file:**
|
|
516
691
|
```ruby
|
|
517
692
|
# coverage_policy.rb
|
|
518
693
|
->(model) do
|
|
519
|
-
model.
|
|
694
|
+
model.list.all? { |f| f['percentage'] >= 80 }
|
|
520
695
|
end
|
|
521
696
|
```
|
|
522
697
|
|
|
523
|
-
See [examples/success_predicates/](
|
|
698
|
+
See [examples/success_predicates/](../examples/success_predicates.md) for more examples.
|
|
524
699
|
|
|
525
700
|
## Output Formats
|
|
526
701
|
|
|
@@ -548,15 +723,15 @@ Machine-readable output. Paths are relative to project root.
|
|
|
548
723
|
"total": 7,
|
|
549
724
|
"percentage": 85.71
|
|
550
725
|
},
|
|
551
|
-
"stale":
|
|
726
|
+
"stale": "ok"
|
|
552
727
|
}
|
|
553
728
|
```
|
|
554
729
|
|
|
555
730
|
**Staleness values:**
|
|
556
|
-
- `
|
|
557
|
-
- `"
|
|
558
|
-
- `"
|
|
559
|
-
- `"
|
|
731
|
+
- `"ok"` - Coverage data is current
|
|
732
|
+
- `"missing"` - File missing (no longer exists on disk)
|
|
733
|
+
- `"newer"` - Timestamp mismatch (file modified after coverage)
|
|
734
|
+
- `"length_mismatch"` - Length mismatch (line count differs)
|
|
560
735
|
|
|
561
736
|
### Source Display
|
|
562
737
|
|
|
@@ -589,22 +764,22 @@ clp summary lib/api/client.rb # Automatically uses options above
|
|
|
589
764
|
# Environment sets -fJ; explicit CLI options still take precedence
|
|
590
765
|
export COV_LOUPE_OPTS="-fJ"
|
|
591
766
|
clp summary lib/api/client.rb # Uses JSON (from env)
|
|
592
|
-
clp summary lib/api/client.rb -
|
|
767
|
+
clp summary lib/api/client.rb -f table # Explicit override to table format
|
|
593
768
|
```
|
|
594
769
|
|
|
595
770
|
**Examples:**
|
|
596
771
|
```sh
|
|
597
772
|
# Default resultset location
|
|
598
|
-
export COV_LOUPE_OPTS="
|
|
773
|
+
export COV_LOUPE_OPTS="-r build/coverage"
|
|
599
774
|
|
|
600
775
|
# Enable detailed error logging
|
|
601
776
|
export COV_LOUPE_OPTS="--error-mode debug"
|
|
602
777
|
|
|
603
778
|
# Paths with spaces
|
|
604
|
-
export COV_LOUPE_OPTS='
|
|
779
|
+
export COV_LOUPE_OPTS='-r "/path with spaces/coverage"'
|
|
605
780
|
|
|
606
781
|
# Multiple options
|
|
607
|
-
export COV_LOUPE_OPTS="
|
|
782
|
+
export COV_LOUPE_OPTS="-r coverage -S -fJ"
|
|
608
783
|
```
|
|
609
784
|
|
|
610
785
|
|
|
@@ -614,11 +789,11 @@ export COV_LOUPE_OPTS="--resultset coverage --staleness error -fJ"
|
|
|
614
789
|
### Basic Coverage Check
|
|
615
790
|
|
|
616
791
|
```sh
|
|
617
|
-
# Show all files sorted by
|
|
792
|
+
# Show all files sorted by highest coverage first (default)
|
|
618
793
|
clp
|
|
619
794
|
|
|
620
|
-
# Find the 5 files with worst coverage
|
|
621
|
-
clp list |
|
|
795
|
+
# Find the 5 files with worst coverage (account for header/footer)
|
|
796
|
+
clp list | tail -7
|
|
622
797
|
```
|
|
623
798
|
|
|
624
799
|
### Detailed File Investigation
|
|
@@ -631,7 +806,7 @@ clp summary lib/payments/refund_service.rb
|
|
|
631
806
|
clp uncovered lib/payments/refund_service.rb
|
|
632
807
|
|
|
633
808
|
# View uncovered code in context
|
|
634
|
-
clp uncovered lib/payments/refund_service.rb
|
|
809
|
+
clp uncovered lib/payments/refund_service.rb -s uncovered -c 3
|
|
635
810
|
|
|
636
811
|
# Get detailed hit counts
|
|
637
812
|
clp detailed lib/payments/refund_service.rb
|
|
@@ -687,36 +862,36 @@ clp -g "lib/payments/**/*.rb" list
|
|
|
687
862
|
|
|
688
863
|
```sh
|
|
689
864
|
# Check if coverage is stale (for CI/CD)
|
|
690
|
-
clp
|
|
865
|
+
clp -S true
|
|
691
866
|
|
|
692
867
|
# Check with specific file patterns
|
|
693
|
-
clp
|
|
868
|
+
clp -S true -g "lib/payments/**/*.rb,lib/ops/jobs/**/*.rb" list
|
|
694
869
|
|
|
695
870
|
# See which files are stale (don't error)
|
|
696
|
-
clp list # Stale
|
|
871
|
+
clp list # Stale column shows missing/newer/length_mismatch/error markers
|
|
697
872
|
```
|
|
698
873
|
|
|
699
874
|
### Source Code Display
|
|
700
875
|
|
|
701
876
|
```sh
|
|
702
877
|
# Show full source with coverage markers
|
|
703
|
-
clp summary lib/api/client.rb
|
|
878
|
+
clp summary lib/api/client.rb -s full
|
|
704
879
|
|
|
705
880
|
# Show only uncovered lines with context
|
|
706
|
-
clp uncovered lib/api/client.rb
|
|
881
|
+
clp uncovered lib/api/client.rb -s uncovered
|
|
707
882
|
|
|
708
883
|
# More context around uncovered code
|
|
709
|
-
clp uncovered lib/api/client.rb
|
|
884
|
+
clp uncovered lib/api/client.rb -s uncovered -c 5
|
|
710
885
|
|
|
711
886
|
# Without colors (for logging)
|
|
712
|
-
clp uncovered lib/api/client.rb
|
|
887
|
+
clp uncovered lib/api/client.rb -s full --color false
|
|
713
888
|
```
|
|
714
889
|
|
|
715
890
|
### CI/CD Integration
|
|
716
891
|
|
|
717
892
|
```sh
|
|
718
893
|
# Fail build if coverage is stale
|
|
719
|
-
clp
|
|
894
|
+
clp -S true || exit 1
|
|
720
895
|
|
|
721
896
|
# Generate JSON report for artifact
|
|
722
897
|
clp -fJ list > artifacts/coverage-report.json
|
|
@@ -731,8 +906,8 @@ clp -R services/api -r services/api/coverage # -R = --root, -r = --resultset
|
|
|
731
906
|
# Verbose error output
|
|
732
907
|
clp --error-mode debug summary lib/api/client.rb
|
|
733
908
|
|
|
734
|
-
# Custom log file
|
|
735
|
-
clp
|
|
909
|
+
# Custom log file (--log-file or -l)
|
|
910
|
+
clp -l /tmp/simplecov-debug.log summary lib/api/client.rb
|
|
736
911
|
|
|
737
912
|
# Check what resultset is being used
|
|
738
913
|
clp --error-mode debug 2>&1 | grep resultset
|
|
@@ -741,7 +916,7 @@ clp --error-mode debug 2>&1 | grep resultset
|
|
|
741
916
|
## Exit Codes
|
|
742
917
|
|
|
743
918
|
- `0` - Success
|
|
744
|
-
- `1` - Error (file not found, coverage data missing, stale coverage with `--
|
|
919
|
+
- `1` - Error (file not found, coverage data missing, stale coverage with `-S` / `--raise-on-stale`, etc.)
|
|
745
920
|
|
|
746
921
|
## Next Steps
|
|
747
922
|
|