RemoveArgument - refactoring produces syntax errors at callsite if original code contains comments

Ouverte
#690 3 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
35/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
À l'abandon
Stack technique
python
Domaine
devtools

Piste de recherche

Reproduce with rope 1.8.0 by removing the logger argument from save_list_of_dataframes_to_xlsx using RemoveArgument, on a call site that has comments between the arguments as in the issue. Compare the output with the expected output in the issue, which keeps each argument and comment on its own line without the logger argument. Done means the call site stays valid Python with its comments in place.

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

Description

bug

Describe the bug
When removing an argument from a function, the code at the callsite goes into syntax errors if comments exist at the callsite.

To Reproduce
Steps to reproduce the behavior:

  1. Code before refactoring:
    at the callsite:
save_list_of_dataframes_to_xlsx(list_of_dfs,
                                        folder_path=folder_path,
                                        # filename=self.__class__.__name__,  # old (GIANNAM, 2021-10-21, 19:02)
                                        filename=self.xlsx_out_filename,     # new (GIANNAM, 2021-10-22, 10:19)
                                        sheetname_list=sheetname_list,
                                        logger=self.logger_obj.logger)
  1. Describe the refactoring you want to do

remove Argument - logger (on the function definition, not the callsite)

  1. Expected code after refactoring:
save_list_of_dataframes_to_xlsx(list_of_dfs,
                                        folder_path=folder_path,
                                        # filename=self.__class__.__name__,  # old (GIANNAM, 2021-10-21, 19:02)
                                        filename=self.xlsx_out_filename,     # new (GIANNAM, 2021-10-22, 10:19)
                                        sheetname_list=sheetname_list)
  1. Describe the error or unexpected result that you are getting

The code gets compressed into one line with the comments mixed in.

 save_list_of_dataframes_to_xlsx(list_of_dfs,folder_path, # filename=self.__class__.__name__,  # old (GIANNAM, 2021-10-21, 19=self.xlsx_out_filename, # new (GIANNAM, 2021-10-22, 10=sheetname_list)

Editor information (please complete the following information):

  • Project Python version: 3.7.9
  • Rope Python version: 3.7.9
  • Rope version: 1.8.0
  • Text editor/IDE and version: (no editor, using rope as a library)

Additional context
still fantastic library thanks a lot

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.