Skip to content

use latest System.CommandLine version (GA?) #1660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Bertk
Copy link
Collaborator

@Bertk Bertk commented May 27, 2024

Update coverlet.console for latest version of System.CommandLine API.

Note

New version 2.0.0-beta5.25306.1 of System.CommandLine nuget package is available since 19th June 2025.

>coverlet.console.exe --help
Description:
  Cross platform .NET Core code coverage tool

Usage:
  coverlet.console <path> [options]

Arguments:
  <path>  Path to the test assembly or application directory.

Options:
  -?, -h, --help                                                     Show help and usage information
  --version                                                          Show version information
  -t, --target (REQUIRED)                                            Path to the test runner application.
  -a, --targetargs                                                   Arguments to be passed to the test runner.
  -o, --output                                                       Output of the generated coverage report
  -v, --verbosity <Detailed|Minimal|Normal|Quiet>                    Sets the verbosity level of the command. Allowed values are quiet, minimal, normal, detailed. [default: Normal]
  -f, --format <cobertura|json|lcov|opencover|teamcity>              Format of the generated coverage report. [default: json]
  --threshold                                                        Exits with error if the coverage % is below value.
  --threshold-type <branch|line|method>                              Coverage type to apply the threshold to. [default: line|branch|method]
  --threshold-stat <Average|Minimum|Total>                           Coverage statistic used to enforce the threshold value. [default: Minimum]
  --exclude                                                          Filter expressions to exclude specific modules and types.
  --include                                                          Filter expressions to include only specific modules and types.
  --exclude-by-file                                                  Glob patterns specifying source files to exclude.
  --include-directory                                                Include directories containing additional assemblies to be instrumented.
  --exclude-by-attribute                                             Attributes to exclude from code coverage.
  --include-test-assembly                                            Specifies whether to report code coverage of the test assembly.
  --single-hit                                                       Specifies whether to limit code coverage hit reporting to a single hit for each location
  --skipautoprops                                                    Neither track nor record auto-implemented properties.
  --merge-with                                                       Path to existing coverage result to merge.
  --use-source-link                                                  Specifies whether to use SourceLink URIs in place of file system paths.
  --does-not-return-attribute                                        Attributes that mark methods that do not return
  --exclude-assemblies-without-sources <MissingAll|MissingAny|None>  Specifies behavior of heuristic to ignore assemblies with missing source documents. [default: MissingAll]
  --source-mapping-file                                              Specifies the path to a SourceRootsMappings file.
  -?, -h, --help                                                     Show help and usage information
  --version                                                          Show version information

@Bertk Bertk changed the title use latest System.CommandLine (GA version?) use latest System.CommandLine version (GA?) May 28, 2024
@Bertk Bertk force-pushed the commandline-ga branch from 598a646 to 5c2a245 Compare May 28, 2024 07:30
@Bertk Bertk force-pushed the commandline-ga branch 2 times, most recently from 9a4226e to df2b821 Compare November 6, 2024 09:28
@Bertk Bertk marked this pull request as ready for review April 1, 2025 10:22
@Bertk Bertk marked this pull request as draft April 13, 2025 08:40
@Bertk Bertk requested a review from Copilot June 6, 2025 07:04
Copilot

This comment was marked as outdated.

@Bertk Bertk marked this pull request as ready for review June 7, 2025 07:55
@Bertk Bertk marked this pull request as draft June 7, 2025 09:05
@Bertk Bertk marked this pull request as ready for review June 22, 2025 04:10
- Upgraded `System.CommandLine` package version.
- Clarified documentation in `GlobalTool.md` regarding options and exit codes.
- Modified Azure Pipelines YAML for package restoration and authentication.
- Removed `PackageIconUrl` from `coverlet.collector.csproj`.
- Updated `CommandExitCodes` enum in `ExitCodes.cs`.
- Refactored `Program.cs` to utilize the new `System.CommandLine` API.
- Changed command exit code handling to use a static variable.
- Added new package references in `coverlet.console.csproj` and `coverlet.core.csproj`.
- Revised integration tests for expected output and error handling.
- Adjusted coverage output assertions in tests.
- Improved directory handling and file deletion logic in `DeterministicBuild.cs`.
- Added reference to `coverlet.console` in `coverlet.integration.tests.csproj`.
@Bertk Bertk requested a review from Copilot August 21, 2025 08:05
Copy link

@Copilot 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 updates the coverlet console application to use the latest version of System.CommandLine (2.0.0-beta6) and makes necessary code changes to support the API changes in the newer version.

  • Updates System.CommandLine package from 2.0.0-beta4 to 2.0.0-beta6
  • Refactors console application argument parsing to use new CommandLine API patterns
  • Updates test assertions and adds integration test coverage for console commands
  • Fixes various project configurations and package versions

Reviewed Changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/coverlet.console/Program.cs Major refactoring to use new System.CommandLine API patterns, switching from synchronous to async main method
test/coverlet.integration.tests/DotnetTool.cs Enhanced test coverage with exit code validation and improved error handling
test/coverlet.integration.tests/Msbuild.cs Updated test assertions to reflect new expected coverage percentages (50% instead of 100%)
Directory.Packages.props Updated System.CommandLine package version and other dependency versions
test/coverlet.integration.template/DeepThought.cs Added untested method to support threshold testing scenarios

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant