Charlie Marsh
16d1e63a5e
Respect 'is not' operators split across newlines ( #4977 )
2023-06-09 05:07:45 +00:00
Micha Reiser
39a1f3980f
Upgrade RustPython ( #4900 )
2023-06-08 05:53:14 +00:00
Charlie Marsh
8938b2d555
Use `qualified_name` terminology in more structs for consistency ( #4873 )
2023-06-05 19:06:48 +00:00
Ryan Yang
72245960a1
implement E307 for pylint invalid str return type ( #4854 )
2023-06-05 17:54:15 +00:00
qdegraaf
fcbf5c3fae
Add PYI034 for `flake8-pyi` plugin ( #4764 )
2023-06-02 02:15:57 +00:00
Charlie Marsh
ab26f2dc9d
Use saturating_sub in more token-walking methods ( #4773 )
2023-06-01 17:16:32 -04:00
Charlie Marsh
9d0ffd33ca
Move universal newline handling into its own crate ( #4729 )
2023-05-31 12:00:47 -04:00
Micha Reiser
6c1ff6a85f
Upgrade RustPython ( #4747 )
2023-05-31 08:26:35 +00:00
Charlie Marsh
9741f788c7
Remove globals table from `Scope` ( #4686 )
2023-05-27 22:35:20 -04:00
Charlie Marsh
0f610f2cf7
Remove dedicated ScopeKind structs in favor of AST nodes ( #4648 )
2023-05-25 19:31:02 +00:00
Micha Reiser
daadd24bde
Include decorators in `Function` and `Class` definition ranges ( #4467 )
2023-05-22 17:50:42 +02:00
Ville Skyttä
2e2ba2cb16
Avoid some false positives in dunder variable assigments ( #4508 )
2023-05-19 02:11:20 +00:00
Charlie Marsh
e9c6f16c56
Move unparse utility methods onto Generator ( #4497 )
2023-05-18 15:00:46 +00:00
Charlie Marsh
73efbeb581
Invert quote-style when generating code within f-strings ( #4487 )
2023-05-18 14:33:33 +00:00
Micha Reiser
fa26860296
Refactor range from `Attributed` to `Node`s ( #4422 )
2023-05-16 06:36:32 +00:00
Jeong, YunWon
be6e00ef6e
Re-integrate RustPython parser repository ( #4359 )
...
Co-authored-by: Micha Reiser <micha@reiser.io>
2023-05-11 07:47:17 +00:00
Charlie Marsh
fd34797d0f
Add a specialized `StatementVisitor` ( #4349 )
2023-05-10 12:42:20 -04:00
Micha Reiser
cab65b25da
Replace row/column based `Location` with byte-offsets. ( #3931 )
2023-04-26 18:11:02 +00:00
Jonathan Plasse
df77595426
Move `Truthiness` into `ruff_python_ast` ( #4071 )
2023-04-24 04:54:31 +00:00
Charlie Marsh
7fa1da20fb
Support relative imports in `banned-api` enforcement ( #4025 )
2023-04-19 14:30:13 -04:00
Micha Reiser
381203c084
Store source code on message ( #3897 )
2023-04-11 07:57:36 +00:00
Charlie Marsh
d919adc13c
Introduce a `ruff_python_semantic` crate ( #3865 )
2023-04-04 16:50:47 +00:00
Charlie Marsh
5625410936
Remove `uses_magic_variable_access` dependence on `Checker` ( #3864 )
2023-04-03 12:22:06 -04:00
Charlie Marsh
3744e9ab3f
Remove `contains_effect`'s dependency on `Context` ( #3855 )
2023-04-03 12:08:13 -04:00
Charlie Marsh
d822e08111
Move `CallPath` into its own module ( #3847 )
2023-04-01 11:25:04 -04:00
Charlie Marsh
2f90157ce2
Move logging resolver into `logging.rs` ( #3843 )
2023-04-01 03:50:44 +00:00
Charlie Marsh
6d80c79bac
Combine `operations.rs` and `helpers.rs` ( #3841 )
2023-04-01 03:40:34 +00:00
Charlie Marsh
27e40e9b31
Remove `helpers.rs` dependency on `Binding` ( #3839 )
2023-04-01 03:19:45 +00:00
Charlie Marsh
b6276e2d95
Move f-string identification into rule module ( #3838 )
2023-03-31 23:10:11 -04:00
Charlie Marsh
cf7e1ddd08
Remove some `usize` references ( #3819 )
2023-03-30 17:35:42 -04:00
Charlie Marsh
22d5b0071d
Rename `end_of_statement` to `end_of_last_statement` ( #3775 )
2023-03-28 12:31:06 -04:00
Dhruv Manilawala
63adf9f5e8
Allow aliased `logging` module as a logger candidate ( #3718 )
2023-03-24 17:19:09 -04:00
Charlie Marsh
e8d17d23cb
Expand the scope of useless-expression (B018) ( #3455 )
2023-03-23 18:33:58 -04:00
Charlie Marsh
1b3e54231c
Flag, but don't fix, unused imports in `ModuleNotFoundError` blocks ( #3658 )
2023-03-22 13:03:30 -04:00
Micha Reiser
dedf4cbdeb
refactor: Move scope and binding types to `scope.rs` ( #3573 )
2023-03-17 17:31:33 +01:00
Micha Reiser
685c242761
refactor(ruff_python_ast): Split `get_argument` ( #3478 )
2023-03-13 18:18:25 +01: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
130e733023
Implement `From<Located>` for `Range` ( #3377 )
2023-03-08 18:50:20 +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