Charlie Marsh
227679b5cb
Re-enable the T and C linter prefix selectors ( #3452 )
2023-03-13 08:20:30 -04:00
Charlie Marsh
c2750a59ab
Implement an iterator for universal newlines ( #3454 )
...
# Summary
We need to support CR line endings (as opposed to LF and CRLF line endings, which are already supported). They're rare, but they do appear in Python code, and we tend to panic on any file that uses them.
Our `Locator` abstraction now supports CR line endings. However, Rust's `str#lines` implementation does _not_.
This PR adds a `UniversalNewlineIterator` implementation that respects all of CR, LF, and CRLF line endings, and plugs it into most of the `.lines()` call sites.
As an alternative design, it could be nice if we could leverage `Locator` for this. We've already computed all of the line endings, so we could probably iterate much more efficiently?
# Test Plan
Largely relying on automated testing, however, also ran over some known failure cases, like #3404 .
2023-03-13 00:01:29 -04:00
Charlie Marsh
2a4d6ab3b2
Remove unnecessary Path::new
from fs
calls ( #3476 )
2023-03-12 23:18:23 -04:00
Charlie Marsh
7a80bcec58
Output GitLab paths relative to CI_PROJECT_DIR
( #3475 )
2023-03-13 03:03:37 +00:00
Charlie Marsh
8955e32b5c
Respect ignores for runtime-import-in-type-checking-block (TCH004) ( #3474 )
2023-03-13 02:23:26 +00:00
Jacob Latonis
675227db5c
pylint: E1507 invalid-envvar-value ( #3467 )
2023-03-12 21:43:06 +00:00
Charlie Marsh
a65c6806a6
Avoid respecting noqa directives when RUF100 is enabled ( #3469 )
2023-03-12 14:37:35 -04:00
Xuehai Pan
9858df1ac9
[FIX] PYI011: recognize Bool
/ Float
/ Complex
numbers as simple defaults ( #3459 )
2023-03-12 17:34:09 +00:00
Charlie Marsh
7fb7268e8a
Use a hash to fingerprint GitLab CI output ( #3456 )
2023-03-12 00:22:39 -05:00
Jacob Latonis
0f78f27713
pylint: W1508 invalid-envvar-default ( #3449 )
2023-03-11 16:44:42 -05:00
Charlie Marsh
12a6fc7041
Avoid removing un-aliased exceptions in OSError
-aliased handlers ( #3451 )
2023-03-11 15:24:11 -05:00
Micha Reiser
d2988043af
perf: Optimize UTF8/ASCII byte offset index ( #3439 )
2023-03-11 13:12:10 +01:00
Micha Reiser
cc8b13d3a7
refactor: Replace Vec
in options metadata with static array ( #3433 )
2023-03-11 09:03:56 +00:00
Charlie Marsh
1e081cf9a6
Flag deprecated (but renamed) imports in UP035 ( #3448 )
2023-03-11 01:06:32 -05:00
Charlie Marsh
841bcf1cdd
Remove unnecessary Serde derives ( #3447 )
2023-03-11 00:16:51 -05:00
Jonathan Plasse
8b561313aa
Remove empty line after RUF100 auto-fix ( #3414 )
2023-03-10 22:57:13 +00:00
Florian Best
a3aeec6377
docs(pycodestyle): document rules ( #3407 )
2023-03-10 22:36:38 +00:00
Micha Reiser
b983d5eb3f
fix: method red
not found in release builds ( #3434 )
2023-03-10 10:17:35 +01:00
kyoto7250
bb3bb24b59
Autofix PIE810 rule violations ( #3411 )
2023-03-10 05:17:22 +00:00
Charlie Marsh
872829ca72
When "Args" and "Parameters" are present, prefer NumPy style ( #3430 )
2023-03-10 02:58:05 +00:00
Charlie Marsh
2383228709
Respect --show-fixes
with --fix-only
( #3426 )
2023-03-09 21:37:39 +00:00
Aryaman Marathe
952307d39d
[pylint
] C1901: compare-to-empty-string ( #3405 )
2023-03-09 21:33:34 +00:00
Charlie Marsh
024caca233
Introduce a ruff_diagnostics
crate ( #3409 )
...
## Summary
This PR moves `Diagnostic`, `DiagnosticKind`, and `Fix` into their own crate, which will enable us to further split up Ruff, since sub-linter crates (which need to implement functions that return `Diagnostic`) can now depend on `ruff_diagnostics` rather than Ruff.
2023-03-09 20:48:57 +00:00
DanCardin
08ec11a31e
fix: Emit a more useful error if an extend
points at a non-existent ruff.toml file. ( #3417 )
2023-03-09 19:55:09 +00:00
Micha Reiser
bd05a8a74d
fix: WASM tests ( #3415 )
2023-03-09 11:27:59 +01:00
Micha Reiser
229f1c34cb
refactor: Extract ruff_wasm
( #3401 )
2023-03-09 10:07:39 +00:00
Charlie Marsh
a7f3532395
Ignore multiply-assigned variables in RET504 ( #3393 )
2023-03-08 19:11:55 -05:00
Aaron Cunningham
3349ceb969
[flake8-bugbear
] Add flake8-bugbear
's B030 rule ( #3400 )
2023-03-08 20:41:29 +00:00
Charlie Marsh
da1f83fe32
Remove core
module from ruff_python_formatter
( #3373 )
2023-03-08 19:11:39 +00:00
Charlie Marsh
0a9d259f9c
Remove copied core
modules from ruff_python_formatter
( #3371 )
2023-03-08 19:03:40 +00:00
Charlie Marsh
130e733023
Implement From<Located>
for Range
( #3377 )
2023-03-08 18:50:20 +00:00
Charlie Marsh
ff2c0dd491
Use shared leading_quote
implementation in ruff_python_formatter ( #3396 )
2023-03-08 18:21:59 +00:00
Charlie Marsh
dfe1cad928
Rename DiagnosticKind#commit
to DiagnosticKind#suggestion
( #3397 )
2023-03-08 18:06:19 +00:00
Charlie Marsh
ffad0bcdaa
Decouple Diagnostic
from "all violations" enumeration ( #3352 )
2023-03-08 17:51:37 +00:00
Jonathan Plasse
bc869d4f52
Fix PIE802 broken auto-fix with trailing comma ( #3402 )
2023-03-08 12:49:01 -05:00
Micha Reiser
a3de791f0a
Make ruff_cli
binary a small wrapper around lib
( #3398 )
2023-03-08 12:11:55 +01:00
Charlie Marsh
d9dfec30eb
Catch RET504 usages via decorators ( #3395 )
2023-03-08 00:38:01 +00:00
Charlie Marsh
3f04def3a5
Remap ChainMap, Counter, and OrderedDict imports to collections ( #3392 )
2023-03-07 23:53:35 +00:00
Charlie Marsh
98177754de
Handle multi-line fixes for byte-string prefixing ( #3391 )
2023-03-07 23:33:47 +00:00
Charlie Marsh
bad6bdda1f
Create a rust_python_ast
crate ( #3370 )
...
This PR productionizes @MichaReiser's suggestion in https://github.com/charliermarsh/ruff/issues/1820#issuecomment-1440204423 , by creating a separate crate for the `ast` module (`rust_python_ast`). This will enable us to further split up the `ruff` crate, as we'll be able to create (e.g.) separate sub-linter crates that have access to these common AST utilities.
This was mostly a straightforward copy (with adjustments to module imports), as the few dependencies that _did_ require modifications were handled in #3366 , #3367 , and #3368 .
2023-03-07 15:18:40 +00:00
Charlie Marsh
a5d302fcbf
Pass Range
struct by value ( #3376 )
2023-03-07 09:53:31 -05:00
Charlie Marsh
bced58ce40
Rename runtime-evaluated-baseclasses
to runtime-evaluated-base-classes
( #3379 )
2023-03-07 09:51:12 -05:00
Aaron Cunningham
10e252e2fb
Updated forced-separate type from Rust to abstract ( #3380 )
2023-03-07 09:35:39 -05:00
Sasan Jacob Rasti
4dead7541f
Implement configuration options runtime-evaluated-decorators
and runtime-evaluated-baseclasses
for flake8-type-checking
( #3292 )
2023-03-06 23:34:19 -05:00
Charlie Marsh
fea1af5a63
Include entire prefix when reporting rule selector errors ( #3375 )
2023-03-07 00:04:52 +00:00
Charlie Marsh
c0ad875339
Remove unnecessary quote-stripping method ( #3372 )
2023-03-06 18:28:20 -05:00
Charlie Marsh
8437399496
Remove AST checker's dependency on resolver ( #3368 )
2023-03-06 21:45:09 +00:00
StefanBRas
074f5634a5
Remove duplicate info in azure format ( #3369 )
2023-03-06 16:40:03 -05:00
Charlie Marsh
694d41897a
Move visibility
module into ast
crate ( #3367 )
2023-03-06 20:14:47 +00:00
Charlie Marsh
e1ebd9130d
Don't enforce typing-import rules in .pyi files ( #3362 )
2023-03-06 15:03:34 -05:00