最近接手了很多老项目代码review和重构的任务。作为程序员的通病,最难接手的是别人的代码,最难看懂的也是其他人的代码,最想吐槽的也是其他人的代码。(哈哈,其他人也包括之前的自己)
因此整理了在代码review时几个好用的插件。
代码扫描:SonarLint

代码生成时序图:SequenceDiagram

伪代码生成设计图(时序图,流程图):PlantUML integration

时序图: https://plantuml.com/sequence-diagram
@startuml
'https://plantuml.com/sequence-diagram
autonumber
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response
@enduml
效果图:
流程图:https://plantuml.com/activity-diagram-beta
@startuml
'https://plantuml.com/activity-diagram-beta
start
:ClickServlet.handleRequest();
:new page;
if (Page.onSecurityCheck) then (true)
:Page.onInit();
if (isForward?) then (no)
:Process controls;
if (continue processing?) then (no)
stop
endif
if (isPost?) then (yes)
:Page.onPost();
else (no)
:Page.onGet();
endif
:Page.onRender();
endif
else (false)
endif
if (do redirect?) then (yes)
:redirect process;
else
if (do forward?) then (yes)
:Forward request;
else (no)
:Render page template;
endif
endif
stop
@enduml
效果图:
SonarLint、SequenceDiagram和PlantUML integration基本能搞定代码review和重构。
版权声明:本文为qq659301274原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。