Skip to content
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

conflicting option names #1049

Merged
merged 8 commits into from
Jun 3, 2024
Merged

conflicting option names #1049

merged 8 commits into from
Jun 3, 2024

Conversation

phlptp
Copy link
Collaborator

@phlptp phlptp commented May 31, 2024

Take the configurability of an option into account when determining ambiguous names and conflicts.

@phlptp phlptp requested a review from henryiii May 31, 2024 02:04
@phlptp
Copy link
Collaborator Author

phlptp commented May 31, 2024

This will fix #1047
This will resolve #1048

Copy link

codecov bot commented May 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (e4ee3af) to head (a87a5da).
Report is 29 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##              main     #1049    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           17        17            
  Lines         4546      4583    +37     
  Branches         0       981   +981     
==========================================
+ Hits          4546      4583    +37     

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

@phlptp
Copy link
Collaborator Author

phlptp commented May 31, 2024

I made the changes in PR #1049. There were a few edge cases to work through that the fuzzer caught.
There is probably a bit more to do to take into account whether the subcommand or app itself is not configurable. That might require some additional thought. But for now this will resolve the --h issue and any other case where one of the options is not configurable, and hence wouldn't present an ambiguity in the config files.

hooks:
- id: codespell
args: ["-L", "atleast,ans,doub,inout"]
args: ["-L", "atleast,ans,doub,inout,AtMost"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, did this bug get fixed in 2.3.0? It used to be you had to put all lower case versions here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Didn't know there was a bug, but this resolved the pre-commit issue

@@ -0,0 +1 @@
config ' '
Copy link
Collaborator

Choose a reason for hiding this comment

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

Haven't followed the fuzzer that closely, what does this do?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right now the fuzzer has a large number of options, and some limited mechanics to generate new ones. It processes the options making sure there is nothing that generates a seg fault or other bad condition. Then generates a config file from the results and reads that config file back in. This led to all kinds of inconsistencies that got fixed a few months ago. At some point I will make it so it checks to make sure the values read from the config file are actually the same as the original values, then I might consider submitting it to OSS-Fuzz. The current test just runs a quick_fuzz ~6 minutes and can catch some issues especially when changing some internal mechanics or other things. I will keep adding to it as I have time.

This particular test caught an issue with creating a positional option named config, which was newly allowed. This then triggered an error as it was trying to match with the config option which was not configurable, so had to make it so it checked for other options if some were not configurable.

@phlptp phlptp merged commit 4ecbdd8 into CLIUtils:main Jun 3, 2024
55 checks passed
@phlptp phlptp deleted the configurable_names branch June 3, 2024 16:23
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.

2 participants