redhat-developer / redhat-developer/vscode-java
java.completion.importOrder (even the default) takes precedence over checkstyle specs
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- TypeScript
- Star
- 2.3k
- Fork
- 546
- Merge trung bình
- 20 giờ 1 phút
- Pull request đã merge (30 ngày)
- 11
Mô tả
The java.completion.importOrder property, documented here
https://github.com/redhat-developer/vscode-java/blob/562afa80c0f705613c6ed3148b4d9eac82093b26/package.json#L519-L527
does not play well with checkstyle. If checkstyle specifies a different sort order for imports, the default importOrder setting will always be used instead. An unsatisfactory workaround is to attempt to specify a matching importOrder via this property. However, it's simply not as expressive as what is possible via Checkstyle, so finding an exact match is impossible.
This situation creates the highly likely event of imports being automatically sorted via the editor, and then the resulting code is in violation of checkstyle constraints, so a CI or regular build process will fail.
Here's an example of just such a sad situation: https://github.com/DSpace/DSpace/pull/8088/commits/23e93ff2857b7099ba8005d0b5b6c3b65f052f1c
Environment
- Operating System: OSX
- JDK version: openjdk version "11.0.2" 2019-01-15
- Visual Studio Code version: 1.63.2
- Java extension version: v1.3.0
Steps To Reproduce
- work on a Java project with a checkstyle configuration (one example: DSpace/DSspace)
- install a checkstyle plugin
- configure the checkstyle plugin to use the project configuration
- open a Java file
- click the yellow light bulb that appears over the Java file's imports, select 'organize imports'
- save the file
- validate the project against the custom checkstyle, it will fail, if the checkstyle specification for import order differs from the default value of the java.completion.importOrder property
Current Result
imports are always sorted to match the order specified by java.completion.importOrder
Expected Result
imports are sorted to match the order specified by checkstyle
Additional Informations
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với tài liệu về java.completion.importOrder trong package.json ở các dòng 519-527 và tái hiện các bước của organize-imports bằng một dự án có cấu hình Checkstyle tùy chỉnh. So sánh các imports thu được với thứ tự do Checkstyle chỉ định. Hoàn thành khi organize-imports không còn áp dụng vô điều kiện thứ tự mặc định khi Checkstyle chỉ định một thứ tự khác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java, typescript
- Lĩnh vực
- developer-experience, tooling
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100