Commit 004f40c3 authored by 谢森's avatar 谢森

<dev> 删除注释代码

parent 4e0789d8
Pipeline #14465 failed with stages
in 20 seconds
......@@ -21,39 +21,32 @@ public class MaskUtil {
* 姓名正则
*/
static Pattern namePattern = Pattern.compile("([\\u4e00-\\u9fa5]{1,20}|[a-zA-Z\\.\\s]{1,20})");
// Pattern namePattern = Pattern.compile(maskRegexConfig.getNameRegExp());
/**
* 手机号正则
*/
static Pattern mobilePattern = Pattern.compile("((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|(147))" +
"\\d{8}");
// Pattern mobilePattern = Pattern.compile(maskRegexConfig.getMobileRegExp());
/**
* 电话号码正则
*/
static Pattern phonePattern = Pattern.compile("(\\d{3,4}-)?\\d{6,8}");
// Pattern phonePattern = Pattern.compile(maskRegexConfig.getPhoneRegExp());
/**
* 邮箱正则
*/
static Pattern emailPattern = Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
// Pattern emailPattern = Pattern.compile(maskRegexConfig.getEmailRegExp());
/**
* 身份证号码(15位)正则
*/
static Pattern idPattern15 = Pattern.compile("[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}");
// Pattern idPattern15 = Pattern.compile(maskRegexConfig.getIdRegExp15());
/**
* 身份证号码(18位)正则
*/
static Pattern idPattern18 = Pattern.compile("[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}" +
"([0-9Xx])");
// Pattern idPattern18 = Pattern.compile(maskRegexConfig.getIdRegExp18());
/**
* 家庭住址正则
*/
static Pattern addressPattern = Pattern.compile("([\\u4E00-\\u9FA5A-Za-z0-9_]+(省|市|区|县|道|路|街|号|弄|条|室)){2,}");
// Pattern addressPattern = Pattern.compile(maskRegexConfig.getAddressRegExp());
/**
* ip地址正则
* // static Pattern ipPattern = Pattern.compile("^((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]|[*])\\.){3}
......@@ -61,13 +54,11 @@ public class MaskUtil {
*/
static Pattern ipPattern = Pattern.compile("((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}" +
"(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)");
// Pattern ipPattern = Pattern.compile(maskRegexConfig.getIpRegExp());
/**
* mac地址正则
*/
static Pattern macPattern = Pattern.compile("([A-Fa-f0-9]{2}-){5}[A-Fa-f0-9]{2}");
// Pattern macPattern = Pattern.compile(maskRegexConfig.getMacRegExp());
static List<Pattern> patterns = new ArrayList<Pattern>() {{
add(macPattern);
......@@ -91,7 +82,6 @@ public class MaskUtil {
for (int i = 0; i < matcher.group().length(); i++) {
replaceStr = replaceStr.concat("*");
}
// System.out.println(replaceStr);
value = value.replace(matcher.group(), replaceStr);
}
}
......@@ -116,23 +106,5 @@ public class MaskUtil {
map.put("message", "王海鹰,372925199008075158#15000101879");
map.put("messid", "0000011404342B32233DDCDA");
System.out.println(maskUtil.mask(map));
// String mobile = "15000101879";
//
// Pattern pattern = Pattern.compile("(13\\d|14[579]|15[^4\\D]|17[^49\\D]|18\\d)\\d{8}");
// Matcher m = pattern.matcher(mobile);
////
// System.out.println(m.matches());
// if(m.matches()){
// System.out.println(m.group());
//
// String replaceStr = "";
// for(int i=0; i < m.group().length(); i++){
// replaceStr = replaceStr.concat("*");
// }
// System.out.println(replaceStr);
// mobile = mobile.replaceAll(m.group(), replaceStr);
// System.out.println(mobile);
// }
}
}
......@@ -209,7 +209,6 @@ public class AvroSerializer {
} catch (Exception e) {
System.out.println("序列化失败" + e);
}
// GenericRecord s = AvroDeserializerFactory.getTopicmetadataDeserializer().deserializing(returnstr);
return byteArray;
}
......
  • SonarQube analysis reported 155 issues

    • 🚫 17 critical
    • 90 major
    • 🔽 47 minor
    • 1 info

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