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

format: support black >=24 #1829

Merged
merged 6 commits into from
Feb 1, 2024
Merged

format: support black >=24 #1829

merged 6 commits into from
Feb 1, 2024

Conversation

airwoodix
Copy link
Contributor

Fixes #1821

In black >= 24, string processing requires --preview and either all --unstable features, or explicitly enabling string_processing in the unstable features (using --enable-unstable-feature).

There are modifications to the black style between versions 23 and 24, such that the snapshot tests are failing with black 24.1.0. The development dependency is therefore still pinned to version 23.x.y.
@koxudaxi is there a mechanism to test against multiple versions of black (and adapt the snapshots)?

I guess that this code will get reworked or deprecated when #1643 is implemented?

Copy link

codecov bot commented Feb 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (main@1320fcb). Click here to learn what that means.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1829   +/-   ##
=======================================
  Coverage        ?   98.98%           
=======================================
  Files           ?       37           
  Lines           ?     4156           
  Branches        ?      968           
=======================================
  Hits            ?     4114           
  Misses          ?       26           
  Partials        ?       16           
Flag Coverage Δ
unittests 98.65% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link

codspeed-hq bot commented Feb 1, 2024

CodSpeed Performance Report

Merging #1829 will not alter performance

Comparing airwoodix:fix-1821 (bc2027b) with main (1320fcb)

Summary

✅ 29 untouched benchmarks

@koxudaxi
Copy link
Owner

koxudaxi commented Feb 1, 2024

@airwoodix
Thank you for creating the PR 😄

@koxudaxi is there a mechanism to test against multiple versions of black (and adapt the snapshots)

At least on CI, you can set the version matrix here.

black-version: [22.1.0, default]

I guess that this code will get reworked or deprecated when #1643 is implemented?

In the distant future, yes.
However, this project is trying to change the existing behavior as little as possible to reduce the maintenance load on users when the version is updated.
In other words, this PR will continue to be useful for a while.

@koxudaxi
Copy link
Owner

koxudaxi commented Feb 1, 2024

@airwoodix
I have added the black version patterns for 24.1.0.
https://github.com/koxudaxi/datamodel-code-generator/pull/1829/files#diff-faff1af3d8ff408964a57b2e475f69a6b7c7b71c9978cccc8f471798caac2c88R24-R33

We should add a unit test for 24.1.0 or later and skip the existing test when 24.1.0 is installed.

@koxudaxi koxudaxi merged commit 690cb12 into koxudaxi:main Feb 1, 2024
90 checks passed
@airwoodix
Copy link
Contributor Author

@koxudaxi awesome, thanks a lot for the fast merge and the tests adjustments!

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.

Black 24.1.0 breaks code formatting if wrap-string-literal is set
2 participants