Unexpected handling of lines with less than 100 characters
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
- 45/100
Hướng nghiên cứu
Tái hiện vấn đề với test.java bằng cách sử dụng lệnh gọi dòng lệnh google-java-format-1.9-all-deps.jar được nêu trong báo cáo, đồng thời so sánh đầu ra trước, sau và đầu ra mong đợi. Theo dõi hành vi của formatter đối với các chuỗi SQL nhiều dòng; công việc được xem là hoàn tất khi chỉ dòng quá dài được tách ra, còn các dòng ngắn hơn khác vẫn giữ nguyên định dạng ban đầu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I have some quite large sql multiline string and when one line is over 100 characters it will re-format it onto 2 lines. While I believe this is the correct behaviour to split this long line, it also re-formats all of the other lines of the String which I don't think should happen as they are under 100 characters long, therefore I think this is a bug.
NB: Because of https://github.com/google/google-java-format/issues/566 you can only see this happening using the jar on the command line as per the example below:
before - unformatted file:
package x;
public class test {
static final String MY_SQL_QUERY =
"SELECT "
+ " customer_id AS customer_id, "
+ " customer_id AS customer_id, "
+ " customer_id AS customer_id, "
+ " customer_id AS customer_id, "
+ " customer_id AS customer_id, "
+ " l.some_really_long_column_name AS some_really_looooooooooooooooooooong_column_name, "
+ " customer_id AS customer_id, "
+ " customer_id AS customer_id, ";
public test() {
int x=1;if(x==1){x=2;}else{x=3;}
}
}
apply google java formatting:
/tmp $ java -version
openjdk version "11.0.9" 2020-10-20
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9+11)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9+11, mixed mode)
/tmp $ cksum ~/lib/google-java-format-1.9-all-deps.jar
2002751029 3404610 ~/lib/google-java-format-1.9-all-deps.jar
/tmp $ java -jar ~/lib/google-java-format-1.9-all-deps.jar ./test.java
after - formatted by google java formatter:
package x;
public class test {
static final String MY_SQL_QUERY =
"SELECT customer_id AS customer_id, customer_id AS customer_id, "
+ " customer_id AS customer_id, customer_id AS customer_id, "
+ " customer_id AS customer_id, l.some_really_long_column_name AS"
+ " some_really_looooooooooooooooooooong_column_name, customer_id AS"
+ " customer_id, customer_id AS customer_id, ";
public test() {
int x = 1;
if (x == 1) {
x = 2;
} else {
x = 3;
}
}
}
Expected - this is what I think google java formatter should do:
package x;
public class test {
static final String MY_SQL_QUERY =
"SELECT "
+ " customer_id AS customer_id, "
+ " customer_id AS customer_id, "
+ " customer_id AS customer_id, "
+ " customer_id AS customer_id, "
+ " customer_id AS customer_id, "
+ " l.some_really_long_column_name "
+ "AS some_really_looooooooooooooooooooong_column_name, "
+ " customer_id AS customer_id, "
+ " customer_id AS customer_id, ";
public test() {
int x = 1;
if (x == 1) {
x = 2;
} else {
x = 3;
}
}
}
- Ngôn ngữ chính
- Java
- Star
- 6.2k
- Fork
- 936
- Merge trung bình
- 6 phút
- Pull request đã merge (30 ngày)
- 3
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.
Issue khác của google/google-java-format
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
google/google-java-format#1094 · 1 bình luận ·
-
Complementary Teamups Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
google/google-java-format#1450 · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
google/google-java-format#1439 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
google/google-java-format#1436 · 2 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
google/google-java-format#1428 · 4 bình luận ·
Tất cả issue của google/google-java-format
Issue tương tự
-
executions.Query — startDate and timeRange filters are sent with inverted comparison operators Đang mởarea/plugin
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
kestra-io/plugin-kestra#190 ·
-
litertlm-android AAR ships no consumer ProGuard rules → "mid == null" SIGABRT in minified apps Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Add canonical URLs and a sitemap Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
integra-team-red/meet-map#249 ·
-
[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
apache/rocketmq-dashboard#5064 ·