Eclipse-Java代碼規範和品質檢查外掛程式-PMD

來源:互聯網
上載者:User

標籤:target   object   版本   項目   c++   檢測   選擇   pmd   ports   

PMD是一個原始碼分析器。 它發現常見的編程缺陷,如未使用的變數、空catch塊、不必要的對象建立等等。 它支援Java、JavaScript、Salesforce.com Apex、PLSQL、Apache Velocity、XML、XSL等。

此外,它包括CPD(copy-paste-detector,複製粘貼檢測器)。 CPD在Java、C、C++、C#、Groovy、PHP、Ruby、Fortran、JavaScript、PLSQL、Apache Velocity、Scala、Objective C、Matlab、Python、Go、Swift 和 Salesforce.com Apex 中能夠發現重複的代碼。

本文介紹了如何在 Eclipse 裡面安裝、使用PMD外掛程式的過程。

安裝

有幾種方式來安裝 Eclipse Checkstyle Plugin。

1、通過update site

在 Eclipse (Help -> Install New Software…)

輸入:https://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site/

選擇下載PMD Eclipse外掛程式 。

2、通過離線外掛程式包

官方:https://github.com/pmd/pmd-eclipse-plugin/releases

離線版本:()

項目設定

在Windows->Preferences對PMD進行設定

使用

右鍵項目,選擇PMD->Check code with PMD即可。

要運行重複代碼檢測器,請按右鍵項目節點,然後選擇PMD->Find suspect cut and paste。報告將放置在名為reports目錄下的cpd-report.txt的檔案中。

 

參考:

https://waylau.com/use-pmd-for-eclipse/(以上內容轉自此篇文章)

Eclipse-Java代碼規範和品質檢查外掛程式-PMD

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.