astral-sh / astral-sh/ruff

Implement `perflint`

Open
#4,789 13 comments 20 reactions 0 assignees View on GitHub
accepted plugin
Dominant language
Rust
Stars
49.7k
Forks
2.4k
Avg merge
2d 1h
Merged PRs (30d)
458

Description

https://github.com/tonybaloney/perflint - Python Linter for performance anti patterns.

- [x] PERF101: Unnecessary list() on already iterable type (unnecessary-list-cast)
- [x] PERF102: Incorrect iterator method for dictionary (incorrect-dictionary-iterator)
- [ ] PERF201: Loop invariant statement (loop-invariant-statement)
- [ ] PERF202: Global name usage in a loop (loop-global-usage)
- [x] PERF203: Try..except blocks have a significant overhead. Avoid using them inside a loop (loop-try-except-usage)
- [ ] PERF204: Looped slicing of bytes objects is inefficient. Use a memoryview() instead (memoryview-over-bytes)
- [ ] PERF205: Importing the "%s" name directly is more efficient in this loop. (dotted-import-in-loop)
- [ ] PERF301: Use tuple instead of list for a non-mutated sequence. (use-tuple-over-list)
- [x] PERF401: Use a list comprehension instead of a for-loop (use-list-comprehension)
- [x] PERF402: Use a list copy instead of a for-loop (use-list-copy)
- [x] PERF403: Use a dictionary comprehension instead of a for-loop (use-dict-comprehension)

Contributor guide

Open the contributing guide

Research direction

Start by reading the linked perflint project and comparing its completed PERF101, PERF102, PERF203, PERF401, PERF402, and PERF403 entries with Ruff's existing lint-rule structure. Determine how the unchecked PERF201, PERF202, PERF204, PERF205, and PERF301 rules should fit, then confirm that each listed anti-pattern is implemented and covered by the project's rule validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
devtools, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.