Rename Field refactoring allows you to change the method parameter, causing inconsistent override

Ouverte
#767 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 7 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
25/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
python
Domaine
tooling

Piste de recherche

Start by reproducing the issue with the BaseTagger and PatternTagger snippet, then apply Rename Field to the 'text' parameter of PatternTagger.tag. The payload does not name the rope source files, so locate the rename-field refactoring code yourself. Done means rope either warns or refuses when the renamed parameter belongs to a method that overrides a base-class method, and the snippet shows that behavior.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

bug rename-refactor

Rename Field refactoring allows you to change the method parameter, causing inconsistent override
It would be nice if Rope sent an alert to prevent the user from changing the overridden method signature

  1. Steps to reproduce the behavior:
from abc import abstractmethod


class BaseTagger:
    @abstractmethod
    def tag(self, text, tokenize=True):
        return


class PatternTagger(BaseTagger):
    def tag(self, text, tokenize=True):
        if not isinstance(text, str):
            text = text.raw
        return [text, tokenize]

  1. Apply the Rename Field refactoring with the new name 'tag' to the field 'PatternTagger.tag.text'
Langage dominant
Python
Étoiles
2.2k
Forks
197
Merge moyen
2 j 13 h
PR mergées (30 j)
5

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de python-rope/rope

Toutes les issues de python-rope/rope

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.