mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-09 22:25:09 +00:00
[pycodestyle
] Whitespace after decorator (E204
) (#12140)
## Summary <!-- What's the purpose of the change? What does it do, and why? --> This is the implementation for the new rule of `pycodestyle (E204)`. It follows the guidlines described in the contributing site, and as such it has a new file named `whitespace_after_decorator.rs`, a new test file called `E204.py`, and as such invokes the `function` in the `AST statement checker` for functions and functions in classes. Linking #2402 because it has all the pycodestyle rules. ## Test Plan <!-- How was it tested? --> The file E204.py, has a `decorator` defined called wrapper, and this decorator is used for 2 cases. The first one is when a `function` which has a `decorator` is called in the file, and the second one is when there is a `class` and 2 `methods` are defined for the `class` with a `decorator` attached it. Test file: ``` python def foo(fun): def wrapper(): print('before') fun() print('after') return wrapper # No error @foo def bar(): print('bar') # E204 @ foo def baz(): print('baz') class Test: # No error @foo def bar(self): print('bar') # E204 @ foo def baz(self): print('baz') ``` I am still new to rust and any suggestion is appreciated. Specially with the way im using native ruff utilities. --------- Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
This commit is contained in:
parent
5e7ba05612
commit
1e07bfa373
9 changed files with 181 additions and 0 deletions
|
@ -86,6 +86,7 @@ KNOWN_FORMATTING_VIOLATIONS = [
|
|||
"unnecessary-class-parentheses",
|
||||
"unnecessary-escaped-quote",
|
||||
"useless-semicolon",
|
||||
"whitespace-after-decorator",
|
||||
"whitespace-after-open-bracket",
|
||||
"whitespace-before-close-bracket",
|
||||
"whitespace-before-parameters",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue