ruff/crates
Charlie Marsh de898c52eb
Avoid falsely marking non-submodules as submodule aliases (#6182)
## Summary

We have some code to ensure that if an aliased import is used, any
submodules should be marked as used too. This comment says it best:

```rust
// If the name of a submodule import is the same as an alias of another import, and the
// alias is used, then the submodule import should be marked as used too.
//
// For example, mark `pyarrow.csv` as used in:
//
// ```python
// import pyarrow as pa
// import pyarrow.csv
// print(pa.csv.read_csv("test.csv"))
// ```
```

However, it looks like when we go to look up `pyarrow` (of `import
pyarrow as pa`), we aren't checking to ensure the resolved binding is
_actually_ an import. This was causing us to attribute `print(rm.ANY)`
to `def requests_mock` here:

```python
import requests_mock as rm

def requests_mock(requests_mock: rm.Mocker):
    print(rm.ANY)
```

Closes https://github.com/astral-sh/ruff/issues/6180.
2023-07-30 22:16:25 +00:00
..
flake8_to_ruff Bump version to 0.0.280 (#5965) 2023-07-21 22:36:13 -04:00
ruff Avoid falsely marking non-submodules as submodule aliases (#6182) 2023-07-30 22:16:25 +00:00
ruff_benchmark Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
ruff_cache Only use a single cache file per Python package (#5117) 2023-06-19 17:46:13 +02:00
ruff_cli Skip partial duplicates when applying multi-edit fixes (#6144) 2023-07-29 12:11:57 +00:00
ruff_dev Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
ruff_diagnostics Skip partial duplicates when applying multi-edit fixes (#6144) 2023-07-29 12:11:57 +00:00
ruff_formatter Respect indent when measuring with MeasureMode::AllLines (#6120) 2023-07-27 10:22:13 -04:00
ruff_index Add unreachable code rule (#5384) 2023-07-04 14:27:23 +00:00
ruff_macros Remove parser dependency from ruff-python-ast (#6096) 2023-07-26 17:47:22 +02:00
ruff_python_ast Ignore end-of-line file exemption comments (#6160) 2023-07-29 00:40:32 +00:00
ruff_python_codegen Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
ruff_python_formatter Add global and nonlocal formatting (#6170) 2023-07-29 14:39:42 +00:00
ruff_python_index Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
ruff_python_literal Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
ruff_python_parser Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
ruff_python_resolver Avoid walking past root when resolving imports (#6126) 2023-07-27 10:22:13 -04:00
ruff_python_semantic Avoid falsely marking non-submodules as submodule aliases (#6182) 2023-07-30 22:16:25 +00:00
ruff_python_stdlib Fix logging rules with whitespace around dot (#6022) 2023-07-24 05:14:48 +00:00
ruff_python_trivia Ignore end-of-line file exemption comments (#6160) 2023-07-29 00:40:32 +00:00
ruff_shrinking Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
ruff_source_file Skip BOM when determining Locator's line starts (#6159) 2023-07-29 11:47:13 +00:00
ruff_text_size Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
ruff_wasm Skip partial duplicates when applying multi-edit fixes (#6144) 2023-07-29 12:11:57 +00:00