Micha Reiser
e376c3ff7e
Split implicit concatenated strings before binary expressions ( #7145 )
2023-09-08 06:51:26 +00:00
Greger
9671922e40
Do not use code location for Gitlab fingerprints. ( #7203 )
2023-09-08 08:25:26 +02:00
konsti
45f9fca228
Reuse locator in formatter comments ( #7227 )
...
**Summary** The comment visitor used to rebuild the locator for every
comment. Instead, we now keep the locator on the builder. Follow-up to
#6813 .
**Test Plan** No formatting changes.
2023-09-07 20:08:28 +02:00
Charlie Marsh
6661be2c30
Use full range for SIM105 fixes ( #7221 )
...
Avoids inserting an accidental extra newline after the fix _and_
addresses the case of a trailing semicolon.
2023-09-07 16:16:43 +01:00
Charlie Marsh
97f945651d
Change SIM118 to delete .keys()
rather than replace expression ( #7223 )
...
Also improves the suggestion text. Closes
https://github.com/astral-sh/ruff/issues/7200 .
2023-09-07 16:16:24 +01:00
Charlie Marsh
5cea43731e
Add required space for FLY002 fixes ( #7222 )
...
Closes https://github.com/astral-sh/ruff/issues/7197 .
2023-09-07 14:32:43 +00:00
Jaap Roes
7971e0b0ee
Add extend-ignore-names
for flake8-self
( #7194 )
...
## Summary
Add a configuration option to extend the list of names that can be
accessed without triggering SLF001.
Fixes issue #7018
## Test Plan
Manually tested by creating a python file (`test.py`):
```python
def foo(obj):
obj._meta
```
and a `ruff.toml` file:
```toml
select = ["SLF"]
[flake8-self]
extend-ignore-names = ["_meta"]
```
Then running `cargo run -p ruff_cli -- check test.py --no-cache` (once
with the `extend-ignore-names` line comment out) to see if the
configuration option works.
---------
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2023-09-07 13:41:22 +00:00
Micha Reiser
842ff0212e
Add Lexer emoji test case ( #7213 )
2023-09-07 10:02:50 +00:00
Micha Reiser
f1a4eb9c28
Use the unicode-ident crate ( #7212 )
2023-09-07 08:19:25 +00:00
Victor Hugo Gomes
041cdb95e0
Update identifier Unicode character validation to match Python spec ( #7209 )
...
Co-authored-by: Micha Reiser <micha@reiser.io>
2023-09-07 07:08:42 +00:00
Charlie Marsh
fda48afc23
Add required space to C416 fix ( #7204 )
...
Closes https://github.com/astral-sh/ruff/issues/7196 .
2023-09-06 16:25:02 +00:00
Charlie Marsh
c1af1c291d
Add required space to UP006 and UP007 fixes ( #7202 )
...
We're removing a set of brackets here so we need to pad the fix.
Closes https://github.com/astral-sh/ruff/issues/7201 .
2023-09-06 16:06:02 +00:00
Micha Reiser
171b66cb43
Lexer: Add skip whitespace fastpath ( #7184 )
2023-09-06 16:14:01 +02:00
Charlie Marsh
fa0b6f4813
Avoid attempting to fix SIM105 violations with multi-statement lines ( #7191 )
...
I may revisit this and fix it "properly", but so rare that it's worth
disabling for now: https://github.com/astral-sh/ruff/issues/7123 .
2023-09-06 13:35:46 +00:00
Charlie Marsh
eab85aea1a
Use structured types for C417 comprehension target ( #7190 )
...
Rather than manually joining the arguments as a comma-separated string,
and treating that comma-separated string as a name.
2023-09-06 13:20:04 +00:00
Charlie Marsh
5b31524920
Parenthesize C417 targets if necessary ( #7189 )
...
Closes https://github.com/astral-sh/ruff/issues/7121 .
2023-09-06 12:56:47 +00:00
Charlie Marsh
6d0469638c
Avoid attempting to fix NPY001 with overridden builtins ( #7187 )
2023-09-06 12:24:37 +00:00
Charlie Marsh
29ba2bb943
Add required space when fixing C404 ( #7185 )
2023-09-06 13:05:39 +01:00
Charlie Marsh
f0ea40a68d
Restructure signatures of flake8_comprehensions
fixers ( #7186 )
2023-09-06 12:04:50 +00:00
Charlie Marsh
a3a531e0d4
Add alpha instructions to the ruff_python_formatter
README ( #7064 )
2023-09-06 11:55:16 +00:00
Tom Kuson
b3e8eca871
Rename PLR1714
to repeated-equality-comparison
( #7182 )
2023-09-06 12:46:48 +01:00
konsti
447b7cb0e2
Formatter: Show preceding, following and enclosing nodes of comments, Attempt 2 ( #6813 )
2023-09-06 12:26:13 +02:00
konsti
e3114a144c
Ignore single quote docstrings with newline escape ( #7173 )
2023-09-06 10:51:50 +02:00
Dhruv Manilawala
04f2842e4f
Move ExprConstant::kind
to StringConstant::unicode
( #7180 )
2023-09-06 07:39:25 +00:00
Micha Reiser
31990b8d3f
Checker: Remove unnecessary unreachable ( #7181 )
2023-09-06 07:21:03 +00:00
Micha Reiser
5f59101811
Memoize text width ( #6552 )
2023-09-06 07:10:13 +00:00
Dhruv Manilawala
fa6bff0078
Add inline documentation for Ipy*
AST nodes ( #7178 )
2023-09-06 12:07:34 +05:30
Dhruv Manilawala
ea7c394817
Copy the starred argument as is for PLW3301
autofix ( #7177 )
2023-09-06 08:57:05 +05:30
Charlie Marsh
264d9159f8
Add required space when fixing UP024 ( #7171 )
2023-09-05 17:37:09 +00:00
Charlie Marsh
37dfb205b1
Remove autofix for ambiguous unicode rules ( #7168 )
2023-09-05 17:22:18 +00:00
Charlie Marsh
f8e4e1d562
Fix named expression precedence in generator ( #7170 )
2023-09-05 17:06:57 +00:00
Charlie Marsh
89be850b73
Add required space when fixing SIM300 ( #7167 )
2023-09-05 17:00:07 +00:00
Zanie Blue
d68041ba24
Fix B006 when function docstring is followed by whitespace but no newline ( #7160 )
2023-09-05 11:10:57 -05:00
Charlie Marsh
b60b37e866
Split within not
, rather than outside of not
, for PT018 ( #7151 )
2023-09-05 14:50:16 +00:00
konsti
5a95edab45
Use ruff line-length in format_dev ( #6870 )
2023-09-05 16:19:17 +02:00
Dhruv Manilawala
1adde24133
Rename parser mode from Jupyter
to Ipython
( #7153 )
2023-09-05 14:12:26 +00:00
konsti
e02d76f070
Use insta_cmd ( #6737 )
2023-09-05 12:21:27 +00:00
Charlie Marsh
7ead2c17b1
Add required space when fixing C402 ( #7152 )
2023-09-05 12:19:33 +00:00
Charlie Marsh
e428099e4c
Add required space when fixing SIM118 ( #7150 )
2023-09-05 11:51:34 +00:00
Charlie Marsh
7a83fd9926
Insert required space when fixing B013 ( #7148 )
2023-09-05 12:49:11 +01:00
Charlie Marsh
e8f78fa2cf
Avoid fixing UP022 when capture_output
is provided ( #7149 )
2023-09-05 11:44:17 +00:00
Charlie Marsh
955501f267
Use generator for UP007 autofix ( #7137 )
2023-09-05 11:41:53 +00:00
Micha Reiser
175b3702c3
Reduce comments.clone
calls ( #7144 )
2023-09-05 11:32:56 +02:00
Nicholas Grisafi
40ee4909b5
Added argfile test and documentation ( #7138 )
...
Co-authored-by: konsti <konstin@mailbox.org>
2023-09-05 11:13:58 +02:00
Charlie Marsh
10a8e4a225
Remove output-file and target-version from formatter CLI ( #7135 )
2023-09-05 09:04:18 +00:00
konsti
0465b03282
Better formatter CLI verbose output ( #7129 )
2023-09-05 00:25:16 +02:00
Dhruv Manilawala
154fe7bdcc
Add lexer benchmark ( #7132 )
2023-09-04 13:18:36 +00:00
Charlie Marsh
ece30e7c69
Preserve parentheses around partial call chains ( #7109 )
2023-09-04 10:57:04 +01:00
Charlie Marsh
7be28a38c5
Cache comment lookups in suite.rs
( #7092 )
2023-09-04 08:45:14 +00:00
Charlie Marsh
5ec73a6137
Avoid triggering N806 on TypeAlias
assignments ( #7119 )
2023-09-04 08:44:28 +00:00