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

Đang mở
#690 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 7 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
devtools

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Python
Star
2.2k
Fork
197
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
5

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của python-rope/rope

Tất cả issue của python-rope/rope

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.