Skip to content

Rename refactoring allow the use of Python keywords #698

Closed

Description

@jonh-copin

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.

Activity

  1. added
    bugUnexpected or incorrect user-visible behavior
    on Jun 18, 2023
  2. lieryan commented on Jun 19, 2023

    @lieryan
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnexpected or incorrect user-visible behaviorrename-refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions