Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename refactoring allow the use of Python keywords #698

Closed
researcher175 opened this issue Jun 18, 2023 · 1 comment · Fixed by #777
Closed

Rename refactoring allow the use of Python keywords #698

researcher175 opened this issue Jun 18, 2023 · 1 comment · Fixed by #777
Labels
bug Unexpected or incorrect user-visible behavior rename-refactor

Comments

@researcher175
Copy link

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.

@researcher175 researcher175 added the bug Unexpected or incorrect user-visible behavior label Jun 18, 2023
@lieryan
Copy link
Member

lieryan commented Jun 19, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected or incorrect user-visible behavior rename-refactor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants