fix: ensure that CLI help is formatted deterministically and set defaults are displayed properly (based on preliminary work by @keszybz)#3081
Conversation
…ults are displayed properly
WalkthroughThe pull request involves the removal of a custom Changes
Possibly related PRs
Tip New featuresWalkthrough comment now includes:
Notes:
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
snakemake/common/argparse.py (1)
61-87: Well-implemented class for custom help formatting.The
ArgumentDefaultsHelpFormatterclass is well-implemented with clear documentation and purpose. The method_get_help_stringeffectively handles various default types and conditions to enhance the CLI help output.Consider adding a brief comment within the
_get_help_stringmethod to explain the logic behind each major conditional block for future maintainability.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- snakemake/cli.py (2 hunks)
- snakemake/common/argparse.py (2 hunks)
Additional context used
Path-based instructions (2)
snakemake/common/argparse.py (1)
Pattern
**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.snakemake/cli.py (1)
Pattern
**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.
Additional comments not posted (1)
snakemake/cli.py (1)
365-365: Correct update of formatter class reference.The update to use
snakemake.common.argparse.ArgumentDefaultsHelpFormatterin theget_argument_parserfunction is correct and aligns with the goal of using a shared formatter implementation. Ensure that this change is tested to confirm that the CLI help output behaves as expected with the new formatter.Run the following script to verify the integration of the new formatter class:
Verification successful
Verified integration of the new formatter class.
The
snakemake.common.argparse.ArgumentDefaultsHelpFormatteris correctly integrated into theget_argument_parserfunction insnakemake/cli.py. This change is localized and does not affect other parts of the codebase. Ensure that the CLI help output behaves as expected with this formatter.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the integration of the new formatter class. # Test: Search for the usage of the new formatter class. Expect: Only occurrences of the new class. rg --type python -A 5 $'snakemake.common.argparse.ArgumentDefaultsHelpFormatter'Length of output: 110
Script:
#!/bin/bash # Description: Verify the integration of the new formatter class. # Test: Search for the usage of the new formatter class. Expect: Only occurrences of the new class. rg --glob '*.py' -A 5 'snakemake.common.argparse.ArgumentDefaultsHelpFormatter'Length of output: 426
|
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- snakemake/common/argparse.py (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- snakemake/common/argparse.py
🤖 I have created a release *beep* *boop* --- ## [8.20.2](v8.20.1...v8.20.2) (2024-09-09) ### Bug Fixes * ensure that CLI help is formatted deterministically and set defaults are displayed properly (based on preliminary work by [@keszybz](https://github.com/keszybz)) ([#3081](#3081)) ([cbc2e2c](cbc2e2c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>



QC
docs/) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake).Summary by CodeRabbit