Skip to content

conflicting option names - #1049

Merged
phlptp merged 8 commits into
CLIUtils:mainfrom
phlptp:configurable_names
Jun 3, 2024
Merged

phlptp merged 8 commits into
CLIUtils:mainfrom
phlptp:configurable_names

Conversation

@phlptp

@phlptp phlptp commented May 31, 2024

Copy link
Copy Markdown
Collaborator

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

phlptp commented May 31, 2024 •

Copy link
Copy Markdown
Collaborator Author

This will fix #1047
This will resolve #1048

@codecov

codecov Bot commented May 31, 2024 •

Copy link
Copy Markdown

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
phlptp force-pushed the configurable_names branch from 397e2f4 to 9be9cba Compare May 31, 2024 15:37
@phlptp

phlptp commented May 31, 2024

Copy link
Copy Markdown
Collaborator Author

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.

Comment thread .pre-commit-config.yaml
hooks:
- id: codespell
args: ["-L", "atleast,ans,doub,inout"]
args: ["-L", "atleast,ans,doub,inout,AtMost"]

Copy link
Copy Markdown
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
Copy Markdown
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 ' ' No newline at end of file

Copy link
Copy Markdown
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
Copy Markdown
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
@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