Commit f32f595c authored by 王海鹰's avatar 王海鹰

修复sonar规范问题

parent 68df7337
Pipeline #14547 passed with stages
in 2 minutes and 27 seconds
......@@ -11,7 +11,7 @@ import java.io.Serializable;
* @Date 2020/10/21 14:33
*/
@Data
public class HDFSLogQueryParam implements Serializable {
public class HdfsLogQueryParam implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -23,7 +23,7 @@ public class HDFSLogQueryParam implements Serializable {
private Long startTime;
private Long endTime;
public HDFSLogQueryParam(String source, String hdfsSrc, String hdfsDest, String core, String date, Long startTime,
public HdfsLogQueryParam(String source, String hdfsSrc, String hdfsDest, String core, String date, Long startTime,
Long endTime) {
this.source = source;
this.hdfsSrc = hdfsSrc;
......
......@@ -5,7 +5,7 @@ import com.alibaba.fastjson.TypeReference;
import com.zorkdata.datamask.constant.ParamConstants;
import com.zorkdata.datamask.constant.StrConstants;
import com.zorkdata.datamask.domain.LogData;
import com.zorkdata.datamask.domain.HDFSLogQueryParam;
import com.zorkdata.datamask.domain.HdfsLogQueryParam;
import com.zorkdata.datamask.domain.TransactionLog;
import com.zorkdata.datamask.util.DateUtils;
import com.zorkdata.datamask.util.MaskUtil;
......@@ -63,7 +63,7 @@ public class HadoopMask {
env.setParallelism(1);
JobConf jobConf = new JobConf();
jobConf.set("avro.output.schema", TransactionLog.SCHEMA$.toString(true));
HDFSLogQueryParam hdfsLogQueryParam = ParamUtils.initHadoopConf(conf);
HdfsLogQueryParam hdfsLogQueryParam = ParamUtils.initHadoopConf(conf);
ParameterTool parameterTool = ParameterTool.fromMap(conf);
env.getConfig().setGlobalJobParameters(parameterTool);
......
......@@ -126,15 +126,15 @@ public class MaskUtil implements Serializable {
Map map = new HashMap(DEFAULT_MAP_CAPACITY);
map.put("姓名", "王海鹰");
// map.put("身份证号", "372925199008075158");
// map.put("手机号", "15000101879");
// map.put("电话", "021-61341606");
// map.put("邮箱", "wanghaiying@zork.com");
// map.put("住址", "上海市浦东新区碧波路690号1弄");
// map.put("住址2", "上海市浦东新区张江微电子港304-2室");
// map.put("ip地址", "192.168.70.2");
// map.put("mac地址", "3c-78-43-25-80-bd");
// map.put("message", "王海鹰,372925199008075158#15000101879");
map.put("身份证号", "372925199008075158");
map.put("手机号", "15000101879");
map.put("电话", "021-61341606");
map.put("邮箱", "wanghaiying@zork.com");
map.put("住址", "上海市浦东新区碧波路690号1弄");
map.put("住址2", "上海市浦东新区张江微电子港304-2室");
map.put("ip地址", "192.168.70.2");
  • 🔽 Make this IP "192.168.70.2" address configurable. 📘

    By sonarqube on 2020-10-22T02:04:38 (imported from GitLab project)

  • 🔽 Make this IP "192.168.70.2" address configurable. 📘

    By sonarqube on 2020-10-22T02:04:38 (imported from GitLab project)

Please register or sign in to reply
map.put("mac地址", "3c-78-43-25-80-bd");
map.put("message", "王海鹰,372925199008075158#15000101879");
map.put("messid", "0000011404342B32233DDCDA");
map.put("bsflag", "0000011404342B32233DDCDA");
map.put("normalFields", "13811110000-110101199003075517-上海市浦东新区张江微电子港-zorkdata@163.com-123456789-wanghaiying123-王海鹰-192.168.1.1-00-50-56-C0-00-08-6227002470170278192");
......
......@@ -2,7 +2,7 @@ package com.zorkdata.datamask.util;
import com.zorkdata.datamask.constant.ParamConstants;
import com.zorkdata.datamask.constant.RegExpConstants;
import com.zorkdata.datamask.domain.HDFSLogQueryParam;
import com.zorkdata.datamask.domain.HdfsLogQueryParam;
import com.zorkdata.datamask.domain.KafkaMsgQueryParam;
import java.util.HashMap;
......@@ -21,7 +21,7 @@ public class ParamUtils {
*
* @param conf
*/
public static HDFSLogQueryParam initHadoopConf(Map conf) {
public static HdfsLogQueryParam initHadoopConf(Map conf) {
String source = String.valueOf(conf.get(ParamConstants.SOURCE)).trim();
String hdfsSrc = String.valueOf(conf.get(ParamConstants.HDFS_SRC)).trim();
String hdfsDest = String.valueOf(conf.get(ParamConstants.HDFS_DEST)).trim();
......@@ -29,7 +29,7 @@ public class ParamUtils {
String date = String.valueOf(conf.get(ParamConstants.DATE)).trim();
Long startTime = Long.parseLong(String.valueOf(conf.get(ParamConstants.START_TIME)).trim());
Long endTime = Long.parseLong(String.valueOf(conf.get(ParamConstants.END_TIME)).trim());
return new HDFSLogQueryParam(source, hdfsSrc, hdfsDest, core, date, startTime, endTime);
return new HdfsLogQueryParam(source, hdfsSrc, hdfsDest, core, date, startTime, endTime);
}
public static KafkaMsgQueryParam initKafkaConf(Map conf) {
......
  • SonarQube analysis reported 149 issues

    • 🚫 19 critical
    • 80 major
    • 🔽 49 minor
    • 1 info

    Watch the comments in this conversation to review them.

    Top 30 extra issues

    Note: The following issues were found on lines that were not modified in the commit. Because these issues can't be reported as line comments, they are summarized here:

    1. 🚫 Move constants to a class or enum. 📘
    2. 🚫 Move constants to a class or enum. 📘
    3. 🚫 Move constants to a class or enum. 📘
    4. 🚫 Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation. 📘
    5. 🚫 Change this "try" to a try-with-resources. (sonar.java.source not set. Assuming 7 or greater.) 📘
    6. 🚫 Refactor this code to not throw exceptions in finally blocks. 📘
    7. 🚫 Refactor this code to not throw exceptions in finally blocks. 📘
    8. 🚫 Make "patterns" private or transient. 📘
    9. 🚫 Define a constant instead of duplicating this literal "序列化失败" 15 times. 📘
    10. 🚫 Define a constant instead of duplicating this literal " {\n" 7 times. 📘
    11. 🚫 [Define a constant instead of duplicating this literal " "type": \n" 7 times. 📘
    12. 🚫 Define a constant instead of duplicating this literal " "string",\n" 4 times. 📘
    13. 🚫 Define a constant instead of duplicating this literal " "null"\n" 4 times. 📘
    14. 🚫 [Define a constant instead of duplicating this literal " ]\n" 7 times.](https://git.zorkdata.com/wanghaiying/transactionlogmask/blob/f32f595c6afdc62d4c48f8b4c50824fb6175ef8a/src/main/java/com/zorkdata/datamask/util/avro/LogAvroMacroDef.java#L20) 📘
    15. 🚫 Define a constant instead of duplicating this literal " },\n" 6 times. 📘
    16. 🚫 Define a constant instead of duplicating this literal " "null",\n" 3 times. 📘
    17. 🚫 Define a constant instead of duplicating this literal " {\n" 3 times. 📘
    18. 🚫 Define a constant instead of duplicating this literal " "type": "map",\n" 3 times. 📘
    19. 🚫 Define a constant instead of duplicating this literal " }\n" 3 times. 📘
    20. Define and throw a dedicated exception instead of using a generic one. 📘
    21. Remove this unused "source" private field. 📘
    22. Remove this unused "hdfsSrc" private field. 📘
    23. Remove this unused "hdfsDest" private field. 📘
    24. Remove this unused "core" private field. 📘
    25. Remove this unused "date" private field. 📘
    26. Remove this unused "startTime" private field. 📘
    27. Remove this unused "endTime" private field. 📘
    28. Remove this unused "servers" private field. 📘
    29. Remove this unused "zookeeper" private field. 📘
    30. Remove this unused "topic" private field. 📘
    • ... 118 more

    By sonarqube on 2020-10-22T02:04:38 (imported from GitLab project)

  • SonarQube analysis reported 149 issues

    • 🚫 19 critical
    • 80 major
    • 🔽 49 minor
    • 1 info

    Watch the comments in this conversation to review them.

    Top 30 extra issues

    Note: The following issues were found on lines that were not modified in the commit. Because these issues can't be reported as line comments, they are summarized here:

    1. 🚫 Move constants to a class or enum. 📘
    2. 🚫 Move constants to a class or enum. 📘
    3. 🚫 Move constants to a class or enum. 📘
    4. 🚫 Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation. 📘
    5. 🚫 Change this "try" to a try-with-resources. (sonar.java.source not set. Assuming 7 or greater.) 📘
    6. 🚫 Refactor this code to not throw exceptions in finally blocks. 📘
    7. 🚫 Refactor this code to not throw exceptions in finally blocks. 📘
    8. 🚫 Make "patterns" private or transient. 📘
    9. 🚫 Define a constant instead of duplicating this literal "序列化失败" 15 times. 📘
    10. 🚫 Define a constant instead of duplicating this literal " {\n" 7 times. 📘
    11. 🚫 [Define a constant instead of duplicating this literal " "type": \n" 7 times. 📘
    12. 🚫 Define a constant instead of duplicating this literal " "string",\n" 4 times. 📘
    13. 🚫 Define a constant instead of duplicating this literal " "null"\n" 4 times. 📘
    14. 🚫 [Define a constant instead of duplicating this literal " ]\n" 7 times.](https://git.zorkdata.com/wanghaiying/transactionlogmask/blob/f32f595c6afdc62d4c48f8b4c50824fb6175ef8a/src/main/java/com/zorkdata/datamask/util/avro/LogAvroMacroDef.java#L20) 📘
    15. 🚫 Define a constant instead of duplicating this literal " },\n" 6 times. 📘
    16. 🚫 Define a constant instead of duplicating this literal " "null",\n" 3 times. 📘
    17. 🚫 Define a constant instead of duplicating this literal " {\n" 3 times. 📘
    18. 🚫 Define a constant instead of duplicating this literal " "type": "map",\n" 3 times. 📘
    19. 🚫 Define a constant instead of duplicating this literal " }\n" 3 times. 📘
    20. Define and throw a dedicated exception instead of using a generic one. 📘
    21. Remove this unused "source" private field. 📘
    22. Remove this unused "hdfsSrc" private field. 📘
    23. Remove this unused "hdfsDest" private field. 📘
    24. Remove this unused "core" private field. 📘
    25. Remove this unused "date" private field. 📘
    26. Remove this unused "startTime" private field. 📘
    27. Remove this unused "endTime" private field. 📘
    28. Remove this unused "servers" private field. 📘
    29. Remove this unused "zookeeper" private field. 📘
    30. Remove this unused "topic" private field. 📘
    • ... 118 more

    By sonarqube on 2020-10-22T02:04:38 (imported from GitLab project)

Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment