Skip to content

[TASK] Deprecate method forwarding OutputFormat to OutputFormatter #894

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

Merged
merged 1 commit into from
Mar 4, 2025

Conversation

oliverklee
Copy link
Collaborator

Instead, the corresponding method on the formatter should be called directly.

This increases type safety and helps static code analysis. Also, it makes the code easier to understand.

@coveralls
Copy link

coveralls commented Feb 9, 2025

Coverage Status

coverage: 55.726%. remained the same
when pulling 255698a on task/deprecate-forwarding
into 44f1b25 on main.

Copy link
Collaborator

@JakeQZ JakeQZ left a comment

Choose a reason for hiding this comment

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

I think we need to provide chaining methods before we can do this.

If you edit __call() to throw an exception in all cases, there are many test failures.

The chaining methods required are clearly-defined by OutputFormatter. There aren't that many.

I think this would be easier and more preferable than rewriting the tests and changing the API - bear in mind that all users would have to expend similar effort rewriting their code as we would rewriting the tests, if we were to change the API.

@JakeQZ
Copy link
Collaborator

JakeQZ commented Feb 10, 2025

The chaining methods required are clearly-defined by OutputFormatter.

When they are all in place, __call() can simply be removed.

@oliverklee
Copy link
Collaborator Author

I've updated the calls in #898.

@oliverklee oliverklee requested a review from JakeQZ February 10, 2025 09:17
@oliverklee
Copy link
Collaborator Author

I think this would be easier and more preferable than rewriting the tests and changing the API - bear in mind that all users would have to expend similar effort rewriting their code as we would rewriting the tests, if we were to change the API.

I consider the OutputFormatter to be internal to our library (#896), and hence this change should have no effect on users of our library.

@oliverklee oliverklee force-pushed the task/deprecate-forwarding branch from 7d695b6 to ff42244 Compare February 10, 2025 09:23
@JakeQZ
Copy link
Collaborator

JakeQZ commented Feb 10, 2025

I think this would be easier and more preferable than rewriting the tests and changing the API - bear in mind that all users would have to expend similar effort rewriting their code as we would rewriting the tests, if we were to change the API.

I consider the OutputFormatter to be internal to our library (#896), and hence this change should have no effect on users of our library.

I agree, I think. Which is all the more reason to add these methods to OutputFormat so that users don't need to access the underlying OutputFormatter, whether that be by obtaining the object or using __cal().

@JakeQZ
Copy link
Collaborator

JakeQZ commented Feb 10, 2025

I think this would be easier and more preferable than rewriting the tests and changing the API - bear in mind that all users would have to expend similar effort rewriting their code as we would rewriting the tests, if we were to change the API.

I consider the OutputFormatter to be internal to our library (#896), and hence this change should have no effect on users of our library.

I agree, I think. Which is all the more reason to add these methods to OutputFormat so that users don't need to access the underlying OutputFormatter, whether that be by obtaining the object or using __cal().

... unless these methods are all meant for internal use. Will need to check...

@oliverklee oliverklee force-pushed the task/deprecate-forwarding branch from ff42244 to 898fac5 Compare February 10, 2025 10:57
@JakeQZ
Copy link
Collaborator

JakeQZ commented Feb 11, 2025

I've updated the calls in #898.

I think that makes it clear. These are all (only) used by the internal render methods, as a convenience to avoid the extra getFormatter call, and are not intended to be part of the public API. @sabberworm, is that correct?

@oliverklee oliverklee force-pushed the task/deprecate-forwarding branch 6 times, most recently from 21d38b2 to 04a3c1a Compare February 15, 2025 09:40
@oliverklee
Copy link
Collaborator Author

Ping @sabberworm - we need your input here in order to proceed.

@oliverklee oliverklee force-pushed the task/deprecate-forwarding branch 7 times, most recently from 8e900ef to b4d7c71 Compare February 18, 2025 23:02
@oliverklee oliverklee force-pushed the task/deprecate-forwarding branch 16 times, most recently from 079c8f3 to a22aeb4 Compare March 2, 2025 19:33
@oliverklee oliverklee force-pushed the task/deprecate-forwarding branch 3 times, most recently from 3112cbd to c81ffd1 Compare March 3, 2025 13:09
@oliverklee
Copy link
Collaborator Author

Please let's get this merged. @sabberworm And input from your side?

@JakeQZ If there's no input from @sabberworm, please let's move this forward nonetheless.

@oliverklee oliverklee force-pushed the task/deprecate-forwarding branch from c81ffd1 to d4959aa Compare March 3, 2025 16:38
Instead, the corresponding method on the formatter should be called
directly.

This increases type safety and helps static code analysis. Also, it
makes the code easier to understand.
@oliverklee oliverklee force-pushed the task/deprecate-forwarding branch from d4959aa to 255698a Compare March 3, 2025 23:31
@oliverklee oliverklee merged commit 4a12d1f into main Mar 4, 2025
21 checks passed
@oliverklee oliverklee deleted the task/deprecate-forwarding branch March 4, 2025 08:11
oliverklee added a commit that referenced this pull request Mar 4, 2025
JakeQZ pushed a commit that referenced this pull request Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants