PyCQA / PyCQA/isort

section headers and footers do not abide by comment_prefix setting

Open
#1,922 1 comment 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

Section headers and footers do not currently abide by the comment_prefix setting, and as such, can break region folding if used for the section headers/footers as seen below.

example config:

comment_prefix = ""
import_heading_stdlib = "#region Standard Library"
import_footer_stdlib = "#endregion Standard Library"

expected output:

#region Standard Library

import sys

#endregion Standard Library

actual output:

# #region Standard Library

import sys

# #endregion Standard Library

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 tracing how comment_prefix is applied to import_heading_stdlib and import_footer_stdlib, then add a regression test for the configuration and expected output shown here. Done means section headers and footers are emitted without an extra comment prefix when comment_prefix is empty, while the existing behavior remains covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.