Skip to content

Conversation

WittierDinosaur
Copy link
Contributor

@WittierDinosaur WittierDinosaur commented Feb 9, 2025

Brief summary of the change made

This PR adds a long-requested rule. It allows the control of how many blank lines there can be in a row. It is configurable to different values inside and outside of a statement.

This changes the default rule set - and so should trigger a minor release.

Fixes #2634

Are there any other side effects of this change that we should be aware of?

No

Pull Request checklist

  • Please confirm you have completed any of the necessary steps below.

  • Included test cases to demonstrate any code changes, which may be one or more of the following:

    • .yml rule test cases in test/fixtures/rules/std_rule_cases.
    • .sql/.yml parser test cases in test/fixtures/dialects (note YML files can be auto generated with tox -e generate-fixture-yml).
    • Full autofix test cases in test/fixtures/linter/autofix.
    • Other.
  • Added appropriate documentation for the change.

  • Created GitHub issues for any relevant followup/future enhancements if appropriate.

@WittierDinosaur WittierDinosaur added the minor release A PR or issue queued for minor release. label Feb 9, 2025
Copy link
Contributor

github-actions bot commented Feb 9, 2025

Coverage Results ✅

Name    Stmts   Miss  Cover   Missing
-------------------------------------
TOTAL   19501      0   100%

249 files skipped due to complete coverage.

layout.newlines:
maximum_empty_lines_between_statements: 1

test_fail_bad_edge_case:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alanmcruickshank here is the edge case that i'd like to avoid

Copy link
Member

Choose a reason for hiding this comment

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

I see what you mean 🤔 . I'm really not sure this is a problem. Personally I feel like the semicolon "belongs" to the preceding statement, but I also think a comma "belongs" to the preceding line. Leaving this open so that we're a bit more lenient on whether the "between statements" gap is before or after the semicolon I think is ok.

I don't think hard coding the behaviour is worth the extra complexity unless we also give people the option to configure it in case they want to do.... leading semicolons?!.

Copy link
Member

@alanmcruickshank alanmcruickshank Mar 30, 2025

Choose a reason for hiding this comment

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

I think I'm trying to say: I think this PR is ok as-is. We can always optionally tighten it later.

Copy link
Member

Choose a reason for hiding this comment

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

I'll add a comment to that test case to explain

Copy link
Member

@alanmcruickshank alanmcruickshank left a comment

Choose a reason for hiding this comment

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

Nice. I don't think the edge case is a problem at the moment. Yeah some people will disagree but I think that's small potatoes and can be handled at a later date. This already adds a bunch of value as-is.

@alanmcruickshank alanmcruickshank added this pull request to the merge queue Mar 30, 2025
Merged via the queue into main with commit 9259c4b Mar 30, 2025
30 checks passed
@alanmcruickshank alanmcruickshank deleted the lt15 branch March 30, 2025 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor release A PR or issue queued for minor release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New rule proposal: avoid several empty lines in a row.
2 participants