Skip to content

Conversation

@ulgens
Copy link
Owner

@ulgens ulgens commented Jan 2, 2026

Supersedes #23

ulgens added 2 commits January 3, 2026 02:26
This creates a bit of repetation but will help to create a base class that doesn't depend on a class from black
The goal is to separate black related logic from rest of the code
@codecov
Copy link

codecov bot commented Jan 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (ce01688) to head (6fcc325).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #27   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines          567       579   +12     
  Branches        30        31    +1     
=========================================
+ Hits           567       579   +12     

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

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the class structure of the formatters module by introducing a base class abstraction and changing how BlackFormatter is initialized.

Key Changes:

  • Introduced BaseProcessor base class that extracts common formatting logic from BlackFormatter
  • Changed BlackFormatter API from accepting a Mode parameter to accepting individual formatting options
  • Updated all test cases to use the new parameterless Formatter() constructor instead of Formatter(mode=BLACK_MODE)

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/ruffen_docs/formatters.py Introduces BaseProcessor base class with abstract process_code_block method and refactors BlackFormatter to extend it, accepting individual Mode parameters instead of a Mode object
src/ruffen_docs/init.py Removes direct black import and updates BlackFormatter instantiation to pass formatter options as keyword arguments instead of creating a Mode object
tests/test_ruffen_docs.py Updates all 60+ test cases to instantiate Formatter without the mode parameter, relying on default values

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ulgens ulgens force-pushed the improve-class-structure branch from da309d8 to a43dab6 Compare January 2, 2026 23:43
@ulgens ulgens force-pushed the improve-class-structure branch from a43dab6 to 6fcc325 Compare January 2, 2026 23:53
@ulgens ulgens enabled auto-merge (rebase) January 2, 2026 23:54
@ulgens ulgens merged commit 3cbdee8 into main Jan 2, 2026
7 checks passed
@ulgens ulgens deleted the improve-class-structure branch January 2, 2026 23:54
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