<dev>
1. 优化功能逻辑
Showing
| ... | ... | @@ -28,7 +28,7 @@ |
| <includes> | ||
| <include>*.yml</include> | ||
| <include>*.properties</include> | ||
| <include>regular</include> | ||
| <!-- <include>regular</include>--> | ||
|
||
| </includes> | ||
| </fileSet> | ||
| ... | ... | |
| ... | ... | @@ -134,4 +134,39 @@ public class DesensitizationFunctionTest { |
| log.info(JSON.toJSONString(map)); | ||
| } | ||
| @Test | ||
| public void test4() { | ||
| Map<String, String> conf = new HashMap<>(8); | ||
| conf.put(ConfigConstants.JOB_NAME, "jobName"); | ||
| conf.put(ConfigConstants.SOURCE_PARALLELISM, "1"); | ||
| conf.put(ConfigConstants.TRANSFORMER_PARALLELISM, "1"); | ||
| conf.put(ConfigConstants.SINK_PARALLELISM, "1"); | ||
| conf.put(ConfigConstants.HDFS_URI, "1"); | ||
| conf.put(ConfigConstants.HDFS_USER, "1"); | ||
| conf.put(ConfigConstants.HDFS_SRC, "1"); | ||
| conf.put(ConfigConstants.HDFS_DEST, "1"); | ||
| conf.put(ConfigConstants.MATCH_HOSTNAME, "*"); | ||
| conf.put(ConfigConstants.START_TIME, "2020-11-07 21:22:20"); | ||
| conf.put(ConfigConstants.END_TIME, "2020-11-07 23:40:30"); | ||
| conf.put(ConfigConstants.NAME_KEY, "custname,otherlinkman,longname,YXYHMC,deputyname"); | ||
| conf.put(ConfigConstants.MOBILE_KEY, "netaddr,telno,mobileno,faxno,hometelno,worktelno,fax,mobil,call"); | ||
| conf.put(ConfigConstants.PHONE_KEY, "netaddr,telno,mobileno,faxno,hometelno,worktelno,fax,mobil,call"); | ||
| conf.put(ConfigConstants.EMAIL_KEY, "email"); | ||
| conf.put(ConfigConstants.ID_KEY, "idno,deputyidno"); | ||
| conf.put(ConfigConstants.BANK_CARD_KEY, "lmbankid"); | ||
| conf.put(ConfigConstants.ADDRESS_KEY, "addr,workaddr,otheraddr,othertelno"); | ||
| conf.put(ConfigConstants.IP_KEY, "printip,ipaddr,operipaddr,clientip"); | ||
| conf.put(ConfigConstants.MAC_KEY, "netaddr,clientmac"); | ||
| conf.put(ConfigConstants.PASSWORD_KEY, "trdpwd,newpwd,oldfundpwd,newfundpwd,bankpwd,dynamicpwd1,dynamicpwd2,dynamicpwd,fundpwd,newbankpwd"); | ||
| conf.put(ConfigConstants.POSITION_KEY, "orderamt,orderqty,orderprice,fundeffect,stkeffect,profitcost,oddqty,sumqty,ordercount,orderqty,orderamt,fundbal,fundavl,marketvalue,fund,stkvalue,stkqty,stkbal,stkavl,mktval,matchamt,fundeffect,fee_yhs,fee_jsxf,fee_sxf,fee_ghf,fee_qsf,fee_jygf,feefront,fee_jsf,fee_zgf,fundbjhgavl,bb_matchclearamt,nHQSBSL,fundeffect,fundbal,fundeffect,bondbal,bondavl,maxdraw,marketvalue,matchqty,funddraw"); | ||
| JobInitConfig jobInitConfig = new JobInitConfig(conf); | ||
| JobConfig jobConfig = new JobConfig(jobInitConfig); | ||
| DesensitizationFunction<Object, Object> desensitizationFunction = new DesensitizationFunction(jobConfig); | ||
| Map<String, String> map = new HashMap<>(8); | ||
| String message = "20201227-202920 Req: NodeId=6007, QueueId=304, MsgId=6000000604B2949123C20B24, Len=346,Buf=01280000000000000000100000000000000040F2E92B8E7AKCXP00 GV2gODkBbGg= 410570 00220000000 010_CA=2.3&_ENDIAN=0&funid=12345&trdpwd=&netaddr=12345678 Ans: NodeId=6007, QueueId=304, MsgId=6000000604B2949123C20E24, Len=1284, Buf=01300000000000000000306007060070600740F2E92B8E7AKCXP00 GV2gODkBbGg=5FE87E20006007000005013147410570 01158000000 010_CA=2.3&_SYSID=6007&_ENDIAN=0&_RS_1=MESSAGE;3;LEVEL,CODE,MSG;funid, custname, lmbankid, addr, orderamt;1234,廖鸣韬,464512324564564,123456789,fadfad,1234,廖鸣韬,464512324564564,123456789,fadfad&_EORS_2=2&_RC=2&_CC=48&_TL=3:1;48:1;"; | ||
|
||
| map.put(GeneralConstants.MESSAGE, message); | ||
| desensitizationFunction.desensitizationNormalFieldMessage(map); | ||
| log.info(JSON.toJSONString(map)); | ||
| } | ||
| } | ||
| \ No newline at end of file | ||
-
SonarQube analysis reported 180 issues
-
⛔ 2 blocker -
🚫 24 critical -
⚠ 131 major -
🔽 20 minor -
ℹ 3 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:
-
⛔ Remove this hard-coded password.📘 -
🚫 Define a constant instead of duplicating this literal " {\n" 11 times.📘 -
🚫 [Define a constant instead of duplicating this literal " "type": \n" 11 times.📘 -
🚫 Define a constant instead of duplicating this literal " "string",\n" 6 times.📘 -
🚫 Define a constant instead of duplicating this literal " "null"\n" 6 times.📘 -
🚫 [Define a constant instead of duplicating this literal " ]\n" 11 times.](https://git.zorkdata.com/liaomingtao/transaction-log-desensitization/blob/4ac51ac782f1aa64c5bb00279445640186789ac7/src/main/java/com/zorkdata/desensitization/avro/AvroSchemaDef.java#L23)📘 -
🚫 Define a constant instead of duplicating this literal " },\n" 9 times.📘 -
🚫 Define a constant instead of duplicating this literal " "null",\n" 5 times.📘 -
🚫 Define a constant instead of duplicating this literal " {\n" 5 times.📘 -
🚫 Define a constant instead of duplicating this literal " "type": "map",\n" 5 times.📘 -
🚫 Define a constant instead of duplicating this literal " "values": "string"\n" 3 times.📘 -
🚫 Define a constant instead of duplicating this literal " }\n" 5 times.📘 -
🚫 Define a constant instead of duplicating this literal "序列化失败" 13 times.📘 -
🚫 Refactor this method to reduce its Cognitive Complexity from 22 to the 15 allowed.📘 -
🚫 Refactor this method to reduce its Cognitive Complexity from 98 to the 15 allowed.📘 -
🚫 Refactor this method to reduce its Cognitive Complexity from 22 to the 15 allowed.📘 -
🚫 Refactor this method to reduce its Cognitive Complexity from 22 to the 15 allowed.📘 -
🚫 Refactor this method to reduce its Cognitive Complexity from 19 to the 15 allowed.📘 -
🚫 Change this "try" to a try-with-resources. (sonar.java.source not set. Assuming 7 or greater.)📘 -
🚫 Refactor this code to not throw exceptions in finally blocks.📘 -
🚫 Refactor this code to not throw exceptions in finally blocks.📘 -
🚫 Change this "try" to a try-with-resources. (sonar.java.source not set. Assuming 7 or greater.)📘 -
🚫 Define a constant instead of duplicating this literal "jobName" 4 times.📘 -
🚫 Define a constant instead of duplicating this literal "2020-11-07 21:22:20" 4 times.📘 -
🚫 Define a constant instead of duplicating this literal "2020-11-07 23:40:30" 4 times.📘 -
⚠ Rename "jsonObject" which hides the field declared at line 39.📘 -
⚠ Remove this expression which always evaluates to "true"📘 -
⚠ Remove this expression which always evaluates to "true"📘 -
⚠ This block of commented-out lines of code should be removed.📘 -
⚠ 及时清理不再使用的代码段或配置信息。📘
- ... 148 more
-