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

- F move verify_argument_parser scrubber to caller #185

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JayBazuzi
Copy link
Contributor

@JayBazuzi JayBazuzi commented Nov 10, 2024

Not every user of verify_argument_parser wants to scrub the options header, or if they want to scrub it they may want to scrub it differently (e.g. [OPTIONS HEADER]), or they may want to scrub based on the version of Python (if sys.version_info >= (3, 10)...).

@JayBazuzi JayBazuzi marked this pull request as draft November 10, 2024 19:39
Copy link

sourcery-ai bot commented Nov 10, 2024

Reviewer's Guide by Sourcery

The PR moves the responsibility of providing the scrubber function from the verify_argument_parser function to its callers. This simplifies the verify_argument_parser implementation by removing the default scrubber logic and making it the caller's responsibility to handle text scrubbing if needed.

Sequence diagram for verify_argument_parser call with scrubber

sequenceDiagram
    participant Caller
    participant verify_argument_parser
    participant Options

    Caller->>verify_argument_parser: Call with parser and Options().with_scrubber(scrubber)
    verify_argument_parser->>Options: Use scrubber from Options
    verify_argument_parser->>verify_argument_parser: Format help with parser
    verify_argument_parser->>Caller: Return verification result
Loading

Updated class diagram for verify_argument_parser function

classDiagram
    class verify_argument_parser {
        -parser: ArgumentParser
        -options: Optional[Options]
        +verify_argument_parser(parser, options)
    }

    class Options {
        +with_scrubber(scrubber)
    }

    verify_argument_parser --> Options: uses
    note for verify_argument_parser "Scrubber logic moved to caller"
Loading

File-Level Changes

Change Details Files
Simplified verify_argument_parser by removing built-in scrubber functionality
  • Removed default Options creation and scrubber function
  • Simplified verify call to only pass parser.format_help()
  • Moved scrubber definition to test files
approvaltests/approvals.py
Updated test files to provide scrubber function explicitly
  • Added explicit scrubber function definition in test files
  • Modified verify_argument_parser calls to include Options with scrubber
tests/test_verify_argument_parser.py
tests/test_find_stale_approved_files.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@JayBazuzi JayBazuzi force-pushed the jaybazuzi/verify_argument_parser_scrubber branch 4 times, most recently from 2343a93 to 9e5cdfe Compare November 10, 2024 20:52
@nitsanavni
Copy link
Contributor

@JayBazuzi is this still WIP? or can we merge?

@JayBazuzi
Copy link
Contributor Author

JayBazuzi commented Nov 12, 2024

@JayBazuzi is this still WIP? or can we merge?

It needs discussion. Llewellyn said he likes things as is. Some people I work with have a very slight preference for this proposed change; I thought it might be a blocking concern from them but they decided it was acceptable.

@JayBazuzi JayBazuzi force-pushed the jaybazuzi/verify_argument_parser_scrubber branch from 9e5cdfe to cc0423b Compare November 12, 2024 19:37
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