Git Product home page Git Product logo

Comments (6)

warsaw avatar warsaw commented on July 18, 2024

I personally think getting formatting like this right 100% of the time is impossible. I suggest adding explicit skip comments to prevent reformatting those lines.

Although, come to think about it, it might be interesting to implement something like # fmt: black and #fmt: blue markers to defer formatting certain sections to black's preferences.

from blue.

phumke avatar phumke commented on July 18, 2024

Yeah that's fair - especially given the number of permutations here. The explicit skip helps me in this instance, thank you.

I like the idea of # fmt: black/blue but what about including a config option for json: black/blue - default blue. That way all json blobs in the codebase are formatted consistently without needing to comment them all.

from blue.

warsaw avatar warsaw commented on July 18, 2024

I guess the problem with that is that blue (or black AFAIK) doesn't really semantically know that this is JSON. It just looks like a function call with an argument set to a dictionary.

from blue.

phumke avatar phumke commented on July 18, 2024

Yeah good point - instead of json, maybe a dict: blue/black option?

from blue.

grantjenks avatar grantjenks commented on July 18, 2024

Are you on the most recent version of black? I’m guessing there’s something different about the trailing comma handling. Notice that the “type” field doesn’t have a trailing comma in the first post.

from blue.

phumke avatar phumke commented on July 18, 2024

That's a good eye, the code was originally formatted using black v 20.8b1

from blue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.