Giter VIP home page Giter VIP logo

flake8-functions-names's People

Contributors

ember91 avatar gost-serb avatar melevir avatar ryan-thom avatar sobolevn avatar sutyrin avatar thewchan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flake8-functions-names's Issues

FNE005 False Positive on Magic Methods

Magic/dunder methods such as __exit__(self, exc_type, exc_val, exc_tb) -> bool and __contains__(self, x) -> bool raise a FNE005 that is impossible to fix, and I don't want to add #noqa lines to these methods.

FNE005 False Positive on Interface Implementations

from typing import TextIO

from overrides import overrides

class MyTextIO(TextIO):
    ...

    @overrides
    def writable(self) -> bool:
        return True

It would be very cool if there was an option to ignore overridden methods. There isn't much I can do about the names given to 3rd party interface methods, let alone Python stdlib.

FNE005 for built-in dunder methods

Small code example:

def __eq__(self, other: Any) -> bool:
    return str(self) == str(other)

The plugin reports FNE005 Return type of the function is bool, but the name doesn't show it.
Since these are built-in methods, there's no way to rename them. I think in such cases this error shouldn't be reported. Applies also to other methods like __lt__(), __contains__() etc.

Validate async function conventions

Perhaps adding a rule to validate that async functions have some naming convention will be useful. For example have a* prefix. This way the caller can always determine if the function is async or not just by the name

profile is not only a verb

class User:
    @property
    def profile_picture(self):
        return "img.jpg"

Right now the above gives the error: FNE002 The method has a @property decorator, but has a verb in it's name (profile) [flake8-functions-names] - which I think is not really warranted in this case.

I mean it is easy enough to disable for specific cases, but would it make sense to remove such words that can act as both nouns and verbs from the list? Or was it a deliberate decision anyways to include such examples as well?

Plugin gives false-positives for TypeGuards

I am using python 3.10 and my TypeGuard functions are triggering FNE001. Here's an example that fails:

from typing import TypeGuard


class Point:
    x: int
    y: int


class NEQuadrantPoint(Point):
    pass


def is_ne_quadrant(pnt: Point) -> TypeGuard[NEQuadrantPoint]:
    return pnt.x > 0 and pnt.y > 0

Plugin gives false positive on bool-factories

@pytest.fixture
async def is_endpoint_raises_500_factory(client, webhooks_payload_factory):
    async def is_endpoint_raises_500(route, payload_kwargs):
        payload = webhooks_payload_factory(**payload_kwargs)
        resp = await client.post(route, json=payload)
        return resp.status == 500
    return is_endpoint_raises_500

Gives double FNE001 error.

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.