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

Offen
#767 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 7 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
25/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
tooling

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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'
Vorherrschende Sprache
Python
Sterne
2.2k
Forks
197
Ø Merge
2 T. 13 Std.
Gemergte PRs (30 T.)
5

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus python-rope/rope

Alle Issues in python-rope/rope

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.