rope icon indicating copy to clipboard operation
rope copied to clipboard

Rename refactoring allow the use of Python keywords

Open jonh-copin opened this issue 2 years ago • 1 comments

Rename refactoring is successfully executed using any Python keyword in B.text.

Steps to reproduce the behavior:

  1. Code before refactoring:
class B:

    def a(self) -> None:
        text = 'hello'

  1. Apply the Rename refactoring to the variable "text"

  2. Expected to Rope emit an error due to the use of a Python keyword.

jonh-copin avatar Jun 18 '23 15:06 jonh-copin

Adding a validation here makes sense to me. It seems like it should be fairly straightforward to add validation here in rename.py to validate that new_name should be checked against keyword.iskeyword().

Would you want to take a bite at implementing this?

lieryan avatar Jun 19 '23 05:06 lieryan