Skip to content

Implement ssort #3946

@JackAshwell11

Description

@JackAshwell11

Since Ruff already implements isort, it would be nice to see ssort implemented as well.

This plugin automatically reorders the contents of a python file so that statements are placed after the things they depend making navigation easier within the file. For example (from the ssort GitHub page):
Before:

from module import BaseClass

def function():
    return _dependency()

def _decorator(fn):
    return fn

@_decorator
def _dependency():
    return Class()

class Class(BaseClass):
    def public_method(self):
        return self

    def __init__(self):
        pass

After:

from module import BaseClass

class Class(BaseClass):
    def __init__(self):
        pass

    def public_method(self):
        return self

    def _decorator(fn):
        return fn

@_decorator
def _dependency():
    return Class()

def function():
    return _dependency()

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedReady for implementationpluginImplementing a known but unsupported plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions