Skip to content

False positive on multiline dict inside decorator #97

@nrlulz

Description

@nrlulz
def decorator():
    pass

def func():
    pass

@decorator([
    func(
        data={
            'as': 'df',
        },
    ),
])  # <-- JS102
def test1(self, data):
    pass

@decorator([
    func(
        data={'as': 'df'},
    ),
])  # <-- no warning
def test2(self, data):
    pass

@decorator([
    func(
        something=('a', 'b', 'c'),
        data={
            'as': 'df',
        },
    ),
])  # <-- no warning
def test3(self, data):
    pass

I think I'm seeing a false positive here (using v0.0.18). If I put that data dict in a single line, there is no warning. If I pass any other kwarg to func that has a function call or tuple (in one line), there is no warning. It seems to be when there are only dicts as values like this that I get this warning. We use this pattern often for parameterized tests, and I guess I never noticed this until now because I always had some date object or tuple in the arguments as well, which made it not produce a lint warning. I'm not totally sure which is the intended behavior here, since the square brackets and curly braces in this example indeed do not open and close on the same column.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions