Skip to content

*** remove parameter base from Namer#264

Open
JayBazuzi wants to merge 1 commit into
mainfrom
JayBazuzi/remove-Namer-base
Open

*** remove parameter base from Namer#264
JayBazuzi wants to merge 1 commit into
mainfrom
JayBazuzi/remove-Namer-base

Conversation

@JayBazuzi

@JayBazuzi JayBazuzi commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Please take a close look at the changes to approvaltests/core/scenario_namer.py

Summary by Sourcery

Simplify the Namer API by removing the optional base parameter from filename generation methods and updating all implementations accordingly.

Enhancements:

  • Standardize get_approved_filename and get_received_filename across Namer implementations to derive basenames internally.
  • Adjust ScenarioNamer to construct scenario-specific approved/received filenames directly instead of delegating with a base parameter.

Documentation:

  • Update namer architecture documentation to reflect the new parameterless Namer interface.

Tests:

  • Update existing Namer tests to assert on suffix-based filenames and add an approved scenarios file for manual scenario tests.

@sourcery-ai

sourcery-ai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Reviewer's Guide

Refactors the Namer hierarchy to remove the optional base parameter from filename generation methods, updating concrete implementations, tests, and docs, and changing ScenarioNamer to build its approved/received filenames directly.

File-Level Changes

Change Details Files
Remove the base parameter from Namer interface and all implementations, making filename computation internal to each namer.
  • Change abstract get_received_filename and get_approved_filename signatures on Namer to take no parameters.
  • Update NamerBase to ignore external base and always compute its own basename before appending APPROVED/RECEIVED and the extension.
  • Adjust all concrete namers (CLI, InlineComparator, TemplatedCustomNamer, AssertsNamer) to match the new parameterless interface.
approvaltests/core/namer.py
approvaltests/namer/namer_base.py
approvaltests/namer/cli_namer.py
approvaltests/namer/inline_comparator.py
approvaltests/namer/templated_custom_namer.py
approvaltests/asserts.py
Change ScenarioNamer to construct approved and received filenames itself instead of delegating with a base value.
  • Remove base parameter from ScenarioNamer get_approved_filename/get_received_filename.
  • Use get_basename() plus Namer.APPROVED/Namer.RECEIVED and the base_namer extension to build scenario-specific filenames.
  • Leave extension control delegated to base_namer via set_extension.
approvaltests/core/scenario_namer.py
Update documentation and tests to reflect the new parameterless Namer API and scenario behavior.
  • Update the mermaid class diagram in namer_architecture docs to show parameterless get_approved_filename/get_received_filename on Namer, NamerBase, and TemplatedCustomNamer.
  • Modify StackFrameNamer tests to no longer pass an explicit base and instead assert suffix-based filenames derived from the test name.
  • Add an approved scenario file for manual scenarios with blocking to support ScenarioNamer verification.
docs/explanation/namer_architecture.md
tests/test_namer.py
tests/approved_files/test_scenarios.test_manual_scenarios_with_blocking.approved.txt

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. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the 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 exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In ScenarioNamer, the new string concatenation for approved/received filenames duplicates logic already encapsulated in NamerBase; consider reusing base_namer helpers or a shared utility to keep the filename construction rules in a single place.
  • The updated StackFrameNamer tests only assert filename suffixes; if the intent is to guarantee specific directory or basename behavior, tighten the assertions so they also validate the full path or expected prefix.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `ScenarioNamer`, the new string concatenation for approved/received filenames duplicates logic already encapsulated in `NamerBase`; consider reusing `base_namer` helpers or a shared utility to keep the filename construction rules in a single place.
- The updated `StackFrameNamer` tests only assert filename suffixes; if the intent is to guarantee specific directory or basename behavior, tighten the assertions so they also validate the full path or expected prefix.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

1 participant