ruff/crates
Micha Reiser af6ea2f5e4
[pycodestyle]: Make blank lines in typing stub files optional (E3*) (#10098)
## Summary

Fixes https://github.com/astral-sh/ruff/issues/10039

The [recommendation for typing stub
files](https://typing.readthedocs.io/en/latest/source/stubs.html#blank-lines)
is to use **one** blank line to group related definitions and
otherwise omit blank lines. 

The newly added blank line rules (`E3*`) didn't account for typing stub
files and enforced two empty lines at the top level and one empty line
otherwise, making it impossible to group related definitions.

This PR implements the `E3*` rules to:

* Not enforce blank lines. The use of blank lines in typing definitions
is entirely up to the user.
* Allow at most one empty line, including between top level statements. 

## Test Plan

Added unit tests (It may look odd that many snapshots are empty but the
point is that the rule should no longer emit diagnostics)
2024-03-05 12:48:50 +01:00
..
ruff Move shell expansion into --config lookup (#10219) 2024-03-04 12:45:50 -05:00
ruff_benchmark Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_cache Make all dependencies workspace dependencies (#9333) 2024-01-02 13:41:59 +00:00
ruff_dev Make --config and --isolated global flags (#10150) 2024-03-04 11:19:40 +00:00
ruff_diagnostics Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_formatter Add cold attribute to less likely printer queue branches (#10121) 2024-02-26 08:19:40 +01:00
ruff_index Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_linter [pycodestyle]: Make blank lines in typing stub files optional (E3*) (#10098) 2024-03-05 12:48:50 +01:00
ruff_macros Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_notebook Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_python_ast Remove Expr postfix from ExprNamed, ExprIf, and ExprGenerator (#10229) 2024-03-04 12:55:01 +01:00
ruff_python_codegen [pycodestyle] Respect isort settings in blank line rules (E3*) (#10096) 2024-03-05 10:09:15 +00:00
ruff_python_formatter Remove Expr postfix from ExprNamed, ExprIf, and ExprGenerator (#10229) 2024-03-04 12:55:01 +01:00
ruff_python_index Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_python_literal Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_python_parser Remove Expr postfix from ExprNamed, ExprIf, and ExprGenerator (#10229) 2024-03-04 12:55:01 +01:00
ruff_python_resolver Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_python_semantic Remove Expr postfix from ExprNamed, ExprIf, and ExprGenerator (#10229) 2024-03-04 12:55:01 +01:00
ruff_python_stdlib Split CallPath into QualifiedName and UnqualifiedName (#10210) 2024-03-04 09:06:51 +00:00
ruff_python_trivia Implement RUF028 to detect useless formatter suppression comments (#9899) 2024-02-28 19:21:06 +00:00
ruff_shrinking Bump version to v0.3.0 (#10151) 2024-02-29 16:05:20 +01:00
ruff_source_file [pycodestyle] Respect isort settings in blank line rules (E3*) (#10096) 2024-03-05 10:09:15 +00:00
ruff_text_size Range formatting: Fix invalid syntax after parenthesizing expression (#9751) 2024-02-02 17:56:25 +01:00
ruff_wasm Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_workspace Accept a PEP 440 version specifier for required-version (#10216) 2024-03-03 18:43:49 -05:00