PyCQA/isort

bug: iSort repeating the last line of code when adding new line between imports

Opened this issue · 0 comments

When I am trying to use isort in this particular code

from django.contrib import admin
from .models import Category, Channel, Server

# Register your models here.
admin.site.register(Channel)
admin.site.register(Server)
admin.site.register(Category)

After saving the file when iSort runs then it is giving this code

from django.contrib import admin

from .models import Category, Channel, Server

# Register your models here.
admin.site.register(Channel)
admin.site.register(Server)
admin.site.register(Category)
admin.site.register(Category)

It add the last of code, due to which admin.site.register(Category) appears twice in the end.

My vscode isort config:

    "isort.args": ["--profile", "black"],
    "black-formatter.args": ["--line-length", "119"],
    "flake8.args": ["--max-line-length", "119"],
    "[python]": {
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "ms-python.black-formatter",
        "editor.codeActionsOnSave": {
            "source.organizeImports": "always"
        }
    },

How to fix this issue?