Giter Site home page Giter Site logo

Comments (6)

ambv avatar ambv commented on July 16, 2024 3

I'm only worried about the additional overhead for just this one check. lib2to3 is in Python so it's going to slow down Bugbear a bit. We can do it and measure how bad that slowdown is but I have a feeling this is a better job for Black to always insert parentheses around single-element tuples to make this obvious.

from flake8-bugbear.

gaul avatar gaul commented on July 16, 2024 1

Not to deter adding this to bugbear, but flake8_tuple finds unintended tuples.

from flake8-bugbear.

ambv avatar ambv commented on July 16, 2024

That would be neat, indeed. Sadly, it's not trivial since our AST doesn't include this information.

from flake8-bugbear.

carljm avatar carljm commented on July 16, 2024

It is possible, though, since flake8 can give access to the raw source, and then can use Python's parser module to get a parse tree and work on that.

from flake8-bugbear.

ambv avatar ambv commented on July 16, 2024

If you use http://github.com/ambv/black/, it will helpfully wrap one-tuples in parentheses to make this more obvious. So if this wasn't intentional, it will be easier to spot.

from flake8-bugbear.

DylanYoung avatar DylanYoung commented on July 16, 2024

https://pypi.org/project/flake8-commas/ is another option.

from flake8-bugbear.

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.