Visitar URL original
Preserve CRLF blank lines during float-to-top preprocessing by hansu650 · Pull Request #2683 · PyCQA/isort · GitHub
Skip to content

Preserve CRLF blank lines during float-to-top preprocessing - #2683

Merged
DanielNoord merged 3 commits into
PyCQA:mainfrom
hansu650:issue/2681
Sep 27, 2026
Merged

DanielNoord merged 3 commits into
PyCQA:mainfrom
hansu650:issue/2681

Conversation

@hansu650

@hansu650 hansu650 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2681.

Count each trailing CRLF as one complete newline during float-to-top preprocessing, and restore blank lines using the parsed/configured line separator. Previously the scan stopped at \r, so the normal sorting pass restored a lost blank line and reported a change even when the final output was identical to the input. This also made --check fail without a diff.

Added 17 cases covering split/off/on boundaries, inline split comments, spacing counts, configured endings, genuinely unsorted input and a byte-preserving CLI check. Eight fail on unmodified main. This branch is based directly on main and does not depend on #2682.

Validation on Windows / Python 3.13.15:

  • 669 unit tests passed, 5 existing skips; 3 failures reproduced independently on unmodified main (test_gitignore, test_cli_src_path_glob_pattern, test_find_config).
  • 3 local integration/property tests passed; coverage is 99.26%, with core.py at 100% including branches.
  • Locked-version Ruff/format, flake8, isort on tracked Python files excluding the repository-declared CRLF fixture, Linux-targeted mypy, dependency consistency, clean-export wheel/sdist and Twine passed.
  • Bandit still reports the unchanged B101 assertion in parse.py. Compiled wheels and downstream repository-cloning integration tests were not run.
  • A simulated merge with independent Fix split directives on complete multiline imports #2682 is conflict-free; all 34 new cases pass together.

Assisted by OpenAI Codex.

@codecov

codecov Bot commented Sep 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.44%. Comparing base (13758cf) to head (1b761b8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2683   +/-   ##
=======================================
  Coverage   99.44%   99.44%           
=======================================
  Files          41       41           
  Lines        3231     3231           
  Branches      690      690           
=======================================
  Hits         3213     3213           
  Misses         11       11           
  Partials        7        7           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DanielNoord
DanielNoord added this pull request to the merge queue Sep 27, 2026
Merged via the queue into PyCQA:main with commit 6911091 Sep 27, 2026
42 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

float_to_top --check rejects unchanged CRLF input around section boundaries

2 participants