-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove special pre-visit for module docstrings
- Loading branch information
1 parent
74dba3e
commit 0b83fe4
Showing
9 changed files
with
252 additions
and
209 deletions.
There are no files selected for viewing
File renamed without changes.
5 changes: 5 additions & 0 deletions
5
crates/ruff_linter/resources/test/fixtures/pyflakes/F404_1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"""Docstring""" | ||
|
||
"""Non-docstring""" | ||
|
||
from __future__ import absolute_import |
36 changes: 17 additions & 19 deletions
36
crates/ruff_linter/resources/test/fixtures/pyupgrade/UP025.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,28 @@ | ||
# These should change | ||
x = u"Hello" | ||
u"Hello" | ||
|
||
u'world' | ||
x = u"Hello" # UP025 | ||
|
||
print(u"Hello") | ||
u'world' # UP025 | ||
|
||
print(u'world') | ||
print(u"Hello") # UP025 | ||
|
||
import foo | ||
|
||
foo(u"Hello", U"world", a=u"Hello", b=u"world") | ||
print(u'world') # UP025 | ||
|
||
# These should stay quoted they way they are | ||
import foo | ||
|
||
x = u'hello' | ||
x = u"""hello""" | ||
x = u'''hello''' | ||
x = u'Hello "World"' | ||
foo(u"Hello", U"world", a=u"Hello", b=u"world") # UP025 | ||
|
||
# These should not change | ||
u = "Hello" | ||
# Retain quotes when fixing. | ||
x = u'hello' # UP025 | ||
x = u"""hello""" # UP025 | ||
x = u'''hello''' # UP025 | ||
x = u'Hello "World"' # UP025 | ||
|
||
u = u | ||
u = "Hello" # OK | ||
u = u # OK | ||
|
||
def hello(): | ||
return"Hello" | ||
return"Hello" # OK | ||
|
||
f"foo"u"bar" | ||
f"foo" u"bar" | ||
f"foo"u"bar" # OK | ||
f"foo" u"bar" # OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rules__pyflakes__tests__F404_F404.py.snap → ...les__pyflakes__tests__F404_F404_0.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...ter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F404_F404_1.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pyflakes/mod.rs | ||
--- | ||
F404_1.py:5:1: F404 `from __future__` imports must occur at the beginning of the file | ||
| | ||
3 | """Non-docstring""" | ||
4 | | ||
5 | from __future__ import absolute_import | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ F404 | ||
| | ||
|
||
|
Oops, something went wrong.