Skip to content

Conversation

@harshil21
Copy link
Member

@harshil21 harshil21 commented Sep 9, 2023

I noticed multiple times that black doesn't always automatically fix issues where the code has exceeded the line length. This seemed to happen in strings like:

warn(
"blah blah this string will not be formatted no matter how long it gets",
...
)

Which made me find the fix for it: psf/black#1802 (comment)

So this PR enables that and it also fixes a few more things, neat!

@harshil21 harshil21 added the 🛠 code-quality change type: code-quality label Sep 9, 2023
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hey! Looks like you edited the (optional) requirements or the pre-commit hooks. I'm just a friendly reminder to keep the additional dependencies for the hooks in sync with the requirements :)

@github-actions github-actions bot removed the 🛠 code-quality change type: code-quality label Sep 9, 2023
@Bibo-Joshi
Copy link
Member

Bibo-Joshi commented Sep 10, 2023

Hey, interesting findings! I agree that the future features under the --preview flag continue to improve the black style. Black not splitting long string automatically surely is a bit tedious right now, though not really a deal breaker IMO :D

The description of the preview feater states

Experimental, potentially disruptive style changes are gathered under the --preview CLI flag. At the end of each year, these changes may be adopted into the default style, as described in The Black Code Style.

This sounds to me like functionality behind the --preview flag is more likely to be buggy, may change more frequently and may in the end not make it into the stable style. TBH [I do not think] the benefit of the gradually nicer style tweaks is worth this instability risk :/
A one-time change is ofc fine with me as long as the current black version accepts these changes :)

@harshil21 harshil21 added 🛠 code-quality change type: code-quality 📋 pending-merge work status: pending-merge labels Sep 10, 2023
@Bibo-Joshi Bibo-Joshi removed the 📋 pending-merge work status: pending-merge label Sep 15, 2023
@Bibo-Joshi
Copy link
Member

Sorry harshil but I think there is a misunderstanding here. My point is that I don't like the changes in pre-commit-config and pyproject.toml very much …

@harshil21 harshil21 changed the title Use black's --preview flag to fix line length issues Use black's --preview flag once as a test Sep 17, 2023
@harshil21 harshil21 added the 📋 pending-merge work status: pending-merge label Sep 22, 2023
@Bibo-Joshi Bibo-Joshi merged commit ab90cd7 into master Sep 22, 2023
@Bibo-Joshi Bibo-Joshi deleted the use-black-preview branch September 22, 2023 16:19
@harshil21 harshil21 removed the 📋 pending-merge work status: pending-merge label Sep 22, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

🛠 code-quality change type: code-quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants