Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/1389/ensure new line before comments bug #1390

Conversation

sztamas
Copy link
Collaborator

@sztamas sztamas commented Aug 18, 2020

Fixes #1389.

Changes existing test's configuration so it has no lines between
sections.
The default of 1 masks the error.
@@ -172,6 +166,9 @@ def sorted_imports(
else:
pending_lines_before = pending_lines_before or not no_lines_before

if config.ensure_newline_before_comments:
Copy link
Collaborator Author

@sztamas sztamas Aug 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't sure whether we want to insert an empty line before on a comment above the first import as well.
It looks a bit strange to me to have it there, so I opted for not having an empty line in this special case.

In case you want it just move these 2 lines below the stripping of empty lines that follows next. I tested that it works there as well.

@codecov-commenter
Copy link

Codecov Report

Merging #1390 into develop will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##           develop     #1390   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           36        36           
  Lines         2481      2488    +7     
=========================================
+ Hits          2481      2488    +7     

@timothycrosley timothycrosley merged commit f960ee8 into PyCQA:develop Aug 22, 2020
@sztamas sztamas deleted the issue/1389/ensure_new_line_before_comments-bug branch August 23, 2020 08:13
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.

ensure_newline_before_comments shouldn't rely on the default lines between sections config
3 participants