Skip to content

B018: Find more constants w/o assign #200

@kasium

Description

@kasium

As discussed in #195, I took a look what B018 could potential find, and basically that are all Literals 😄 : https://greentreesnakes.readthedocs.io/en/latest/nodes.html#literals. Also, I guess that check could be extended to also work on module level

@cooperlees : I'm not sure how to do that test wise. Should I just list an example of each in a class and a function? Like

def foo2():
    """my docstring"""
    a = 2
    "str"  # Str
    1j  # Number (complex)
    1  # Number (int)
    1.0  # Number (float)
    b"foo"  # Binary
    f"{int}"  # JoinedStr
    ...  # Ellipsis
    True  # NameConstant (True)
    False  # NameConstant (False)
    None  # NameConstant (None)
```

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions