Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/configuration/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,23 @@ Conda environment to use for determining whether a package is third-party

Inserts a blank line before a comment following an import.

When a comment follows the final import, the default [`lines_after_imports`](#lines-after-imports) setting can insert a blank line even when this option is `False`. For example, isort changes:

```python
import os
# import sys
```

to:

```python
import os

# import sys
```

Set `lines_after_imports = 0` to keep the comment adjacent when running isort alone. The `black` profile does not run Black; running Black separately adds the blank line again in this example.

**Type:** Bool
**Default:** `False`
**Config default:** `false`
Expand Down
12 changes: 12 additions & 0 deletions scripts/build_config_option_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,18 @@ def __str__(self):
"Generally ` #` (two spaces before a pound symbol) is use, though one space is also common.",
"lines_before_imports": "The number of blank lines to place before imports. -1 for automatic determination",
"lines_after_imports": "The number of blank lines to place after imports. -1 for automatic determination",
"ensure_newline_before_comments": (
"Inserts a blank line before a comment following an import.\n\n"
"When a comment follows the final import, the default "
"[`lines_after_imports`](#lines-after-imports) setting can insert a blank line even "
"when this option is `False`. For example, isort changes:\n\n"
"```python\nimport os\n# import sys\n```\n\n"
"to:\n\n"
"```python\nimport os\n\n# import sys\n```\n\n"
"Set `lines_after_imports = 0` to keep the comment adjacent when running isort "
"alone. The `black` profile does not run Black; running Black separately adds "
"the blank line again in this example."
),
"lines_between_sections": "The number of lines to place between sections",
"lines_between_types": "The number of lines to place between direct and from imports",
"lexicographical": "Lexicographical order is strictly alphabetical order. "
Expand Down