diff --git a/pmd-emacs/CHANGELOG b/pmd-emacs/CHANGELOG new file mode 100644 index 0000000000..3cae7fba15 --- /dev/null +++ b/pmd-emacs/CHANGELOG @@ -0,0 +1,14 @@ + +Version 0.1 - + +First version of PMD for Emacs + +Defined one function "pmd-current-buffer" which will +run PMD on the current buffer, and write the output +to *PMD* + +Output format is in XML. I will work in trying to +get a better, easier to read format for everyone. + +Share and Enjoy! + diff --git a/pmd-emacs/INSTALL b/pmd-emacs/INSTALL new file mode 100644 index 0000000000..4a1f6e94be --- /dev/null +++ b/pmd-emacs/INSTALL @@ -0,0 +1,20 @@ +Installing PMD For Emacs: + +1) Download PMD-0.4 from SourceForge, and unpack into a directory. + +2) Copy src/elisp/pmd.el to a directory on your Elisp Path + +3) Inside your ".emacs" file, (require 'pmd) + +4) Set the following variables in ".emacs" + pmd-java - Java binary to run PMD with. + pmd-home - Directory where PMD was installed. + pmd-rulesets - Ruleset to use (must be in the PMD jar.) + +There is a customize group under PMD, which you can also +use to customize PMD installation. + +Also, I'm sure there are others out there who know more about +customizing Emacs than I do. Feel free to chip in here and +there. + diff --git a/pmd-emacs/src/elisp/pmd.el b/pmd-emacs/src/elisp/pmd.el new file mode 100755 index 0000000000..122bc904da --- /dev/null +++ b/pmd-emacs/src/elisp/pmd.el @@ -0,0 +1,30 @@ + +(defgroup pmd nil "PMD" + :group 'emacs) + +(defcustom pmd-java-home "/usr/local/bin/java" + "Java binary to run PMD with." + :type 'file + :group 'pmd ) + +(defcustom pmd-home "~/pmd" + "Directory where PMD is installed." + :type 'directory + :group 'pmd) + +(defcustom pmd-rulesets "rulesets/basic.xml" + "Rulesets to apply" + :type 'string + :group 'pmd) + +(defun pmd-current-buffer () + "Run PMD on the contents of the current buffer." + (interactive) + (let ((file-name (buffer-file-name) ) + (pmd-buffer-create (get-buffer "*PMD*")) + (pmd-jar (concat pmd-home "/lib/pmd-0.4.jar"))) + (shell-command (concat pmd-java-home " -cp " pmd-jar + " net.sourceforge.pmd.PMD " + file-name " xml " pmd-rulesets )))) + +(provide 'pmd)