ruff
a63fe408 - Reuse a callee's qualified name across lint rules (#29916)

Commit
2 days ago
Reuse a callee's qualified name across lint rules (#29916) ## Summary Several lint rules can resolve the same callee while checking a single call. For example, with `import numpy as np`, they can each look up `np.random.randint` in `np.random.randint(10)`. The call checker now resolves the callee once if any rule in the group is enabled, skips the group if resolution fails, and passes the qualified name to each enabled handler. The first three rows count native arm64 instructions spent linting Ruff’s five benchmark files, with parsing and setup excluded. The last row counts the whole `ruff check` process over 686 Python 3.12 standard-library files with default rules and caching disabled. | Workload | Before (million instructions) | After (million instructions) | Change | | --- | ---: | ---: | ---: | | Lint, default rules | 29.02 | 27.41 | −5.53% | | Lint, all stable rules | 58.34 | 53.06 | −9.05% | | Lint, all rules with preview | 71.65 | 66.24 | −7.54% | | Full standard-library check | 3,308.72 | 3,236.85 | −2.17% | ## Test Plan The linter and semantic-model tests passed, and 1,711 rule fixtures produced the same diagnostics and applied fixes, allowing for display order at tied source offsets.
Author
Parents
Loading