差異處
這裏顯示兩個版本的差異處。
下次修改 | 前次修改 | ||
java:sonarlint:eclipse_filter_configs:filter_folder_or_files [2020/08/01 23:59] tony 建立 |
java:sonarlint:eclipse_filter_configs:filter_folder_or_files [2020/08/02 15:15] tony |
||
---|---|---|---|
行 1: | 行 1: | ||
{{tag>SonarLint}} | {{tag>SonarLint}} | ||
- | ====== SonarLint - How to filter folder or files in Eclipse? ====== | + | ====== SonarLint | How to filter folder or files in Eclipse? ====== |
===== Problem ===== | ===== Problem ===== | ||
- | 起初在使用SonarLint掃描專案時,必定會將測試內容也一同列出來:\\ | + | 剛開始在使用SonarLint掃描專案時,必定會將測試程式碼也一同列出來:\\ |
{{:java:sonarlint:eclipse_filter_configs:sonarlint_lint_test_files.png|}}\\ | {{:java:sonarlint:eclipse_filter_configs:sonarlint_lint_test_files.png|}}\\ | ||
\\ | \\ | ||
- | 如果不想處理這些東西,或者是由於想暫時濾掉某些你不想看到的內容;本篇文章將分享給大家在Eclipse上如何設定,可以讓SonarLint忽略某些資料夾與檔案。 | + | 如果不想處理這些東西,或者是想暫時濾掉某些你不想看到的內容;本篇文章將分享給大家,如何在Eclipse上設定,可以讓SonarLint略過某些資料夾與檔案。 |
===== How to? ===== | ===== How to? ===== | ||
==== Exclude file ==== | ==== Exclude file ==== | ||
行 15: | 行 15: | ||
\\ | \\ | ||
如果反悔要還原直接Remove即可。 | 如果反悔要還原直接Remove即可。 | ||
+ | ==== Exclude folder ==== | ||
+ | 第二個方式適用在於想忽略測試的資料夾。假設我的測試資料夾在src/test,可以在方法一Project的Properties中,使用GLOB type的File Exclusions設定:\\ | ||
+ | {{:java:sonarlint:eclipse_filter_configs:sonarlint_exclude_test_folder.png|}}\\ | ||
+ | \\ | ||
+ | 這樣設定後,再掃一次專案,就可以發現src/test的內容被濾掉了:\\ | ||
+ | {{:java:sonarlint:eclipse_filter_configs:sonarlint_lint_exclude_test_folder.png|}}\\ | ||
+ | ==== Global File Exclusions ==== | ||
+ | 假如你的專案很多,不想設定在各別專案上,那可以直接修改全域的設定。打開Window > Preference,在裡面的SonarLint > File Exclusions中,使用如方法二的設定方式即可:\\ | ||
+ | {{:java:sonarlint:eclipse_filter_configs:sonarlint_global_exclude_test_folder.png|}}\\ | ||
===== ===== | ===== ===== | ||
---- | ---- | ||
\\ | \\ | ||
~~DISQUS~~ | ~~DISQUS~~ |