ruff/crates/ruff_python_semantic/src
Charlie Marsh b23414e3cc
Resolve classes and functions relative to script name (#10965)
## Summary

If the user is analyzing a script (i.e., we have no module path), it
seems reasonable to use the script name when trying to identify paths to
objects defined _within_ the script.

Closes https://github.com/astral-sh/ruff/issues/10960.

## Test Plan

Ran:

```shell
check --isolated --select=B008 \
    --config 'lint.flake8-bugbear.extend-immutable-calls=["test.A"]' \
    test.py
```

On:

```python
class A: pass

def f(a=A()):
    pass
```
2024-04-18 01:42:50 +00:00
..
analyze Resolve classes and functions relative to script name (#10965) 2024-04-18 01:42:50 +00:00
binding.rs Track ranges of names inside __all__ definitions (#10525) 2024-03-22 18:38:40 +00:00
branches.rs Add branch detection to the semantic model (#6694) 2023-08-19 21:28:17 +00:00
context.rs Remove separate ReferenceContext enum (#4631) 2023-05-24 15:12:38 +00:00
definition.rs Resolve classes and functions relative to script name (#10965) 2024-04-18 01:42:50 +00:00
globals.rs Refine SemanticModel lifetime bounds (#10221) 2024-03-04 09:21:13 +01:00
lib.rs Use a single node hierarchy to track statements and expressions (#6709) 2023-08-21 21:32:57 -04:00
model.rs Resolve classes and functions relative to script name (#10965) 2024-04-18 01:42:50 +00:00
nodes.rs Move {AnyNodeRef, AstNode} to ruff_python_ast crate root (#8030) 2023-10-18 00:01:18 +00:00
reference.rs Correctly handle references in __all__ definitions when renaming symbols in autofixes (#10527) 2024-03-22 20:06:35 +00:00
scope.rs Improve internal documentation for the semantic model (#10788) 2024-04-06 16:28:32 +00:00
star_import.rs Move StarImport to its own module (#5186) 2023-06-20 13:12:46 -04:00