Skip to content

New rule: Decimal with float argument #11840

@kbaskett248

Description

@kbaskett248

I'm interested in adding a new rule to check for Decimal being called with a float literal argument. For example:

# Don't
d = Decimal(1.234)
# Do
d = Decimal('1.234')

This seems like a generally useful check. I searched for open issues and PRs involving Decimal and didn't find any mention of this type of check. I'm happy to work on a PR, but wanted to make sure this check makes sense in ruff. Please let me know if I'm missing something or there's any reason this check wouldn't be accepted.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions