Skip to content

Make B006 fixes inserted after import #7616

@hoxbro

Description

@hoxbro

When running ruff --select=B006 b006.py --fix on a function like this

def test(arg=[]):
    import os

the fix would be:

def test(arg=None):
    if arg is None:
        arg = []
    import os

I would like to see the fix move below the import like this:

def test(arg=None):
    import os
    if arg is None:
        arg = []

For my own enjoyment, I have already started implementing this here. Though, as this is the first time I have written any Rust, it could likely be improved upon 😅

Metadata

Metadata

Assignees

Labels

acceptedReady for implementationruleImplementing 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