ruff
b9b09486 - [`pylint`] Fix false positives, add missing methods, and support positional-only parameters (`PLE0302`) (#16263)

Comment changes are shownComment changes are hidden
Commit
117 days ago
[`pylint`] Fix false positives, add missing methods, and support positional-only parameters (`PLE0302`) (#16263) ## Summary Resolves 3/4 requests in #16217: - ✅ Remove not special methods: `__cmp__`, `__div__`, `__nonzero__`, and `__unicode__`. - ✅ Add special methods: `__next__`, `__buffer__`, `__class_getitem__`, `__mro_entries__`, `__release_buffer__`, and `__subclasshook__`. - ✅ Support positional-only arguments. - ❌ Add support for module functions `__dir__` and `__getattr__`. As mentioned in the issue the check is scoped for methods rather than module functions. I am hesitant to expand the scope of this check without a discussion. ## Test Plan - Manually confirmed each example file from the issue functioned as expected. - Ran cargo nextest to ensure `unexpected_special_method_signature` test still passed. Fixes #16217.
Author
Parents
  • crates/ruff_linter
    • resources/test/fixtures/pylint
      • File
        unexpected_special_method_signature.py
    • src/rules/pylint
      • rules
        • File
          unexpected_special_method_signature.rs
      • snapshots
        • ruff_linter__rules__pylint__tests__PLE0302_unexpected_special_method_signature.py.snap