PyCQA / PyCQA/isort

Line Length Ignores Comments

Open
#2,124 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7k
Forks
687
Avg merge
4h 56m
Merged PRs (30d)
2

Description

I've been trying to deploy isort to my code repository using the black profile, but when it ran it would merge the comments inside our imports and add them to the same line as the import location which violates the line length significantly.
This is what It looks like initially.

from os.path import (
join,
# this is a really really really really really really really really 
# really really really really really really long comment
getsize,
)

This is what happens after it runs.

from os.path import (  # this is a really really really really really really really really; really really really really really really long comment
    getsize,
    join,
)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two import examples with isort's black profile and inspect the import-formatting path that handles comments. Done means comments inside parenthesized imports are not merged onto the import line when that would violate the configured line length; add or update a regression test for the shown case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.