差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

java:sonarlint:eclipse_hellow_world [2020/08/02 15:15]
tony
java:sonarlint:eclipse_hellow_world [2023/06/25 09:48]
行 1: 行 1:
-{{tag>​SonarLint}} +
-====== SonarLint | Eclipse HelloWorld ====== +
-===== Introduction ===== +
-本篇文章分享SonarLint的基本使用方法。 +
-===== Installation ===== +
-至Help > Eclipse Marketplace搜尋sonarlint,接著如同其它plugin安裝方式即可完成:​\\ +
-{{:​java:​sonarlint:​sonarlint_installation.png|}} +
-===== Scan Workset/​Project/​File ===== +
-你可以選擇Workset、Project或者是File,可以根據你選擇的所有項目或者是有改變的項目去做分析:​\\ +
-{{:​java:​sonarlint:​sonarlint_run_scan.png|}} +
-===== Check Report ===== +
-分析完畢後,可以在SonarLint Report的View中確認結果:​\\ +
-{{:​java:​sonarlint:​sonarlint_check_report.png|}}\\ +
-\\ +
-它能夠幫你找到Bugs、Code Smells、Security Vulnerability等問題,而icon的含義可以參考下圖(參考於[[https://​www.tatvasoft.com/​blog/​introduction-to-sonarqube-sonarlint/​|link]]):​\\ +
-{{:​java:​sonarlint:​sonarqube-category.png|}}\\ +
-\\ +
-嚴重程度Blocker > Critical > Major > Minor > Info。假如看不到SonarLint Report,可以在Window > Show View > Other中,搜尋SonarLint看看。 +
-===== Fix Issues ===== +
-在SonarLint Report中點擊issue後,它會連結到對應的source code,有問題的地方會標上藍色底線;將滑鼠移至有問題的地方後,它會提供修正問題的方式或直接取消這條規則:​\\ +
-{{:​java:​sonarlint:​sonarlint_check_bug.png|}}\\ +
-\\ +
-在你點擊Open description of rule後,它會提供範例與對應的修正方式:​\\ +
-{{:​java:​sonarlint:​sonarlint_hint.png|}} +
-===== Summary ===== +
-以目前的使用情況來說,被找出來的問題幾乎都是code smell,security與bug的部分較少;有部分的code smell較為嚴格,像是變數修飾字宣告的順序、Lambda寫法需使用method reference、去除不必要的變數assignment等。\\ +
-\\ +
-如果以建立寫code良好習慣為出發點,可以嘗試安裝這個plugin在你的eclipse上;反正如果你厭煩了某些rule,你是可以deactive那條rule的。\\ +
-\\ +
-另外這套tool是有支援中央server,讓你制定專案或者是團隊所需要規則;也有支援jenkins plugin,讓你進行持續整合。這些東西如果以後有用到會再分享。 +
-===== Reference ===== +
-  * [[https://​www.tatvasoft.com/​blog/​introduction-to-sonarqube-sonarlint/​|Introduction to SonarQube & SonarLint]] +
-=====    ===== +
----- +
-\\ +
-~~DISQUS~~+