Rename Method refactoring does not change the name of the super method in the classes that override it

Aberta
#770 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 7 dias

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
45/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
python
Domínio
tooling

Direção de pesquisa

Reproduce with the two-class snippet in the issue: apply Rename Method to BaseFormat.to_iterable and confirm DelimitedFormat.to_iterable keeps its old name. The issue does not name the rope source files, so locate the rename logic yourself. Done means the overriding method in the subclass is renamed too, and the base method's NotImplementedError body is left intact.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

bug rename-refactor

Rename Method refactoring applied to a method defined in a super class does not modify the signature of the method in the classes that override it

  1. Steps to reproduce the behavior:
class BaseFormat(object):
    def __init__(self, fp, **kwargs):
        pass

    def to_iterable(self):
        raise NotImplementedError('Must implement a "to_iterable" method.')


class DelimitedFormat(BaseFormat):
    def __init__(self, fp, **kwargs):
        BaseFormat.__init__(self, fp, **kwargs)

    def to_iterable(self):
        return None

  1. Apply the Rename Method refactoring with any new name to 'BaseFormat.to_iterable'

  2. Expected code after refactoring:

class BaseFormat(object):
    def __init__(self, fp, **kwargs):
        pass

    def new_method_name(self):
        raise NotImplementedError('Must implement a "to_iterable" method.')


class DelimitedFormat(BaseFormat):
    def __init__(self, fp, **kwargs):
        BaseFormat.__init__(self, fp, **kwargs)

    def new_method_name(self):
        return None

  1. The method that overrides the original method in the subclass is not renamed
Linguagem predominante
Python
Estrelas
2.2k
Forks
197
Merge médio
2d 13h
PRs com merge (30d)
5

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de python-rope/rope

Todas as issues de python-rope/rope

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.