差異處
這裏顯示兩個版本的差異處。
java:sonarlint:eclipse_filter_configs:filter_folder_or_files [2020/08/02 00:11] tony |
java:sonarlint:eclipse_filter_configs:filter_folder_or_files [2023/06/25 09:48] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | {{tag>SonarLint}} | + | |
- | ====== SonarLint - How to filter folder or files in Eclipse? ====== | + | |
- | ===== Problem ===== | + | |
- | 起初在使用SonarLint掃描專案時,必定會將測試內容也一同列出來:\\ | + | |
- | {{:java:sonarlint:eclipse_filter_configs:sonarlint_lint_test_files.png|}}\\ | + | |
- | \\ | + | |
- | 如果不想處理這些東西,或者是由於想暫時濾掉某些你不想看到的內容;本篇文章將分享給大家在Eclipse上如何設定,可以讓SonarLint忽略某些資料夾與檔案。 | + | |
- | ===== How to? ===== | + | |
- | ==== Exclude file ==== | + | |
- | 第一個方式是直接對你想忽略的檔案按滑鼠右鍵,接著找SonarLint > Exclude即可:\\ | + | |
- | {{:java:sonarlint:eclipse_filter_configs:sonarlint_exclude_file.png|}}\\ | + | |
- | \\ | + | |
- | 在你設定完成後,進入Project的Properties中,可以在SonarLint > File Exclusions中找到對應設定:\\ | + | |
- | {{:java:sonarlint:eclipse_filter_configs:sonarlint_exclude_file_of_project_properties.png|}}\\ | + | |
- | \\ | + | |
- | 如果反悔要還原直接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~~ | + |