Skip to content

[CLI-336] Deprecation not always reported#284

Merged
garydgregory merged 5 commits into
apache:masterfrom
Claudenw:CLI-336_Deprecation_not_always_reported
Jun 22, 2024
Merged

[CLI-336] Deprecation not always reported#284
garydgregory merged 5 commits into
apache:masterfrom
Claudenw:CLI-336_Deprecation_not_always_reported

Conversation

@Claudenw

Copy link
Copy Markdown
Contributor

fixes for CLI-336

updated javadoc for OptionGroup.getSelected(), OptionGroup.isSelected() and OptionGroup.select() methods to indicate that deprecated options do not trigger logging of deprecated option usage.

CommandLine methods hasOption(OptionGroup), getOptionValue(OptionGroup), getOptionValues(OptionGroup), and getParsedOptionValue(OptionGroup) methods.

@Claudenw

Copy link
Copy Markdown
Contributor Author

I don't understand how coverage checks can not be met when the added methods are covered based on jacoco report.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 12.50000% with 14 lines in your changes missing coverage. Please review.

Project coverage is 94.87%. Comparing base (9f6b23b) to head (205d7b8).
Report is 223 commits behind head on master.

Files Patch % Lines
.../main/java/org/apache/commons/cli/CommandLine.java 12.50% 13 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #284      +/-   ##
============================================
+ Coverage     91.90%   94.87%   +2.97%     
- Complexity      575      661      +86     
============================================
  Files            22       23       +1     
  Lines          1247     1386     +139     
  Branches        210      227      +17     
============================================
+ Hits           1146     1315     +169     
+ Misses           63       38      -25     
+ Partials         38       33       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aherbert

Copy link
Copy Markdown
Contributor

Codecov is currently broken. Uploads now require an authentication token for the master branch, but apparently not for PR branches. The master build codecov upload failed, see last CI build. So although the codecov uploaded from this PR, there is no record for the base commit and codecov errors with missing coverage.

There is a ticket to resolve this by adding a token to all commons repos: INFRA-25729. However generating an org level token requires an org level github account and apache does not have one. So this is an unresolved issue.

It may require a move away from codecov to some other tool, or negotiation with codecov to provide an alternative authentication mechanism for open source repos.

*/
public String getOptionValue(final OptionGroup optionGroup) {
final String[] values = getOptionValues(optionGroup);
return values == null ? null : values[0];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it possible for the array to be empty?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

No, getOptionValues returns null or an array with a value. In the case where it might return an empty array it returns null.

@garydgregory

garydgregory commented Jun 12, 2024

Copy link
Copy Markdown
Member

I don't understand how coverage checks can not be met when the added methods are covered based on jacoco report.

@Claudenw

You are NOT testing ALL of the new APIs added in this PR.

Run:

mvn clean install site -P jacoco -Dcommons.jacoco.haltOnFailure=false

Then open target/site/jacoco/index.html and navigate to CommandLine and the untested code will be marked in red:

image

@garydgregory

Copy link
Copy Markdown
Member

@Claudenw ping

@Claudenw

Copy link
Copy Markdown
Contributor Author

I am traveling and moving over thenext two weeks. I hope to get to this later this week, time permitting.

@garydgregory

Copy link
Copy Markdown
Member

@Claudenw
Good luck 👍 with the move 💪

@Claudenw Claudenw requested a review from garydgregory June 21, 2024 07:12
@Claudenw

Copy link
Copy Markdown
Contributor Author

Got a clean build ;)

@garydgregory

Copy link
Copy Markdown
Member

Hi @Claudenw
Thank you for your updates 😄
Is this PR ready? If so, you have to change the status from "draft" to "ready for review", then it can be merged.

@Claudenw Claudenw marked this pull request as ready for review June 21, 2024 15:02
@garydgregory garydgregory merged commit 12124d4 into apache:master Jun 22, 2024
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.

4 participants