pmd/README.md
2021-09-09 14:43:57 +02:00

220 KiB
Raw Blame History

PMD - source code analyzer

Join the chat at https://gitter.im/pmd/pmd Build Status Maven Central Reproducible Builds Coverage Status Codacy Badge Contributor Covenant Documentation (latest)

PMD is a source code analyzer. It finds common programming flaws like unused variables, empty catch blocks, unnecessary object creation, and so forth. It supports many languages. It can be extended with custom rules. It uses JavaCC and Antlr to parse source files into abstract syntax trees (AST) and runs rules against them to find violations. Rules can be written in Java or using a XPath query.

It supports Java, JavaScript, Salesforce.com Apex and Visualforce, Modelica, PLSQL, Apache Velocity, XML, XSL, Scala.

Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code in C/C++, C#, Dart, Fortran, Go, Groovy, Java, JavaScript, JSP, Kotlin, Lua, Matlab, Modelica, Objective-C, Perl, PHP, PLSQL, Python, Ruby, Salesforce.com Apex, Scala, Swift, Visualforce and XML.

In the future we hope to add support for data/control flow analysis and automatic (quick) fixes where it makes sense.

🚀 Installation and Usage

Download the latest binary zip from the releases and extract it somewhere.

Execute bin/run.sh pmd or bin\pmd.bat.

See also Getting Started

Demo:

This shows how PMD can detect for loops, that can be replaced by for-each loops.

Demo

There are plugins for Maven and Gradle as well as for various IDEs. See Tools / Integrations

How to get support?

🤝 Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Our latest source of PMD can be found on GitHub. Fork us!

The rule designer is developed over at pmd/pmd-designer. Please see its README for developer documentation.

🪙 Financial Contributors

Become a financial contributor and help us sustain our community. Contribute

Contributors

Thanks goes to these wonderful people (emoji key):


0xflotus

💻 🐛

1henni

🐛

ALiNew

🐛

Abhijit Sarkar

🐛

Abhishek Kumar

🐛

Adam

🐛

Adam Carroll

🐛

Adam Obuchowicz

🐛

Adrian Price

🐛

Adrien Lecharpentier

🐛

Aidan Harding

🐛

Akshat Bahety

💻 🐛

Akshay Thapa

🐛

Alan Buttars

🐛

Alan Hohn

🐛

Alberto Fernández

💻 🐛

Alex Rentz

🐛

Alex Saveau

🐛

Alex Shesterov

💻 🐛

Alexey Markevich

🐛

Alexey Naumov

🐛

Alexey Yudichev

🐛

Alix

🐛

Alix

🐛

Amish Shah

🐛

Amit Prasad

🐛

Amitosh Swain Mahapatra

🐛

Anand Subramanian

💻 🐛

Anatoly Trosinenko

💻 🐛

Andi Pabst

💻 🐛

Andrea

🐛

Andrea Aime

🐛

Andreas Dangel

💻 📖 🐛 🚧

Andreas Markussen

🐛

Andreas Schmid

🐛

Andreas Turban

🐛

Andrei Paikin

🐛

Andrew

🐛

Andrew Green

🐛

Andrey Fomin

🐛

Andrey Hitrin

🐛

Andrey Mochalov

💻 🐛

Andro72

🐛

Andrwyw

🐛

Andrés Catalán

🐛

Andy Pattenden

🐛

Andy Ray

🐛

Andy Robinson

🐛

Andy-2639

🐛

Ankush Somani

🐛

Anmol Kumar

🐛

Anthony Whitford

🐛

AnthonyKot

🐛

Aravind Hegde

🐛

Arda Aslan

🐛

Ari Fogel

🐛

Arnaud Jeansen

💻 🐛

Arpit Koolwal

🐛

Artem

💻 🐛

Artem

🐛

Artem Sheremet

🐛

Artur

🐛

Artur Bosch

🐛

Artur Dryomov

🐛

Artur Ossowski

🐛

AshTheMash

🐛

Ashish Rana

🐛

Atul Kaushal

🐛

August Boland

🐛

Aurel Hudec

🐛

Austin Shalit

🐛

Austin Tice

🐛

Ayoub Kaanich

🐛

BBG

💻 📖 🐛

Barthélemy L.

🐛

Basavaraj K N

🐛

Basil Peace

🐛

Belle

🐛

Ben Lerner

🐛

Ben Manes

🐛

Ben McCann

🐛

Bendegúz Nagy

🐛

Bennet S Yee

🐛

Benoit Lacelle

🐛

Bernardo Macêdo

🐛

Bernd Farka

🐛

Betina Cynthia Mamani

🐛

Bhanu Prakash Pamidi

💻 🐛

Bhargav Thanki

🐛

Binu R J

🐛

Björn Kautler

💻 🐛

Blightbuster

🐛

Bo Zhang

🐛

Bob "Wombat" Hogg

🐛

Bobby Wertman

🐛

Bolarinwa Saheed Olayemi

💻 🐛

Boris Petrov

🐛

Brad Kent

🐛

Brandon Mikeska

🐛

Brian Batronis

🐛

Brian Johnson

🐛

Brice Dutheil

💻 🐛

Bruno Ferreira

🐛

Bruno Ritz

🐛

Cameron Donaldson

🐛

Carlos Macasaet

🐛

Carsten Otto

🐛

Charlie Housh

🐛

Charlie Jonas

🐛

Chas Honton

🐛

Chen Yang

🐛

Chotu

🐛

Chris Smith

🐛

Christian Hujer

🐛

Christian Pontesegger

🐛

ChristianWulf

🐛

Christofer Dutz

💻

Christoffer Anselm

🐛

Christophe Vidal

🐛

Christopher Dancy

🐛

Clemens Prill

🐛

Clint Chester

💻 🐛

Clément Fournier

💻 📖 🐛 🚧

Codacy Badger

🐛

Code-Nil

🐛

ColColonCleaner

🐛

Colin Ingarfield

🐛

Craig Andrews

🐛

Craig Muchinsky

🐛

Cyril

💻 🐛

Dale

💻

Damien Jiang

🐛

Dan Berindei

🐛

Dan Rollo

🐛

Dan Ziemba

🐛

Daniel Jipa

🐛

Daniel Reigada

🐛

Danilo Pianini

🐛

Darko

🐛

David

🐛

David Atkinson

🐛

David Burström

💻 🐛

David Goaté

🐛

David Golpira

🐛

David Kovařík

🐛

David M. Karr (fullname at gmail.com)

🐛

David Renz

💻 🐛

David Renz

🐛

Deleted user

🐛

Dell Green

🐛

Dem Pilafian

🐛

Den

🐛

Denis Borovikov

💻 🐛

Dennie Reniers

💻 🐛

Dennis Kieselhorst

🐛

Derek P. Moore

🐛

Dichotomia

🐛

Dionisio Cortés Fernández

💻 🐛

Dmitri Bourlatchkov

🐛

Dmitriy Kuzmin

🐛

Dmytro Dashenkov

🐛

Drew Hall

🐛

Dumitru Postoronca

🐛

Dylan Adams

🐛

Eden Hao

🐛

Egor Bredikhin

🐛

Elan P. Kugelmass

🐛

Elder S.

🐛

Emile

🐛

Eric

🐛

Eric Kintzer

🐛

Eric Perret

🐛

Eric Squires

🐛

Erich L Foster

🐛

Erik Bleske

🐛

Ernst Reissner

🐛

F.W. Dekker

🐛

Facundo

🐛

Federico Giust

🐛

Fedor Sherstobitov

🐛

Felix Lampe

🐛

Filip Golonka

🐛

Filipe Esperandio

💻 🐛

Francesco la Torre

🐛

Francisco Duarte

🐛

Frieder Bluemle

🐛

Frits Jalvingh

💻 🐛

G. Bazior

🐛

Gabe Henkes

🐛

Genoud Magloire

🐛

Geoffrey555

🐛

Georg Romstorfer

🐛

Gio

🐛

Gol

🐛

Gonzalo Exequiel Ibars Ingman

💻 🐛

GooDer

🐛

Gregor Riegler

🐛

Grzegorz Olszewski

🐛

Gunther Schrijvers

💻 🐛

Gustavo Krieger

🐛

Guy Elsmore-Paddock

🐛

Görkem Mülayim

🐛

Hanzel Godinez

🐛

Harsh Kukreja

🐛

Heber

🐛

Henning Schmiedehausen

💻 🐛

Henning von Bargen

💻

Hervé Boutemy

🐛

Himanshu Pandey

🐛

Hokwang Lee

🐛

Hooperbloob

💻

Hung PHAN

🐛

IDoCodingStuffs

💻 🐛

Iccen Gan

🐛

Ignacio Mariano Tirabasso

🐛

Igor Melnichenko

🐛

Igor Moreno

🐛

Intelesis-MS

🐛

Iroha_

🐛

Ishan Srivastava

🐛

Ivano Guerini

🐛

Ivar Andreas Bonsaksen

🐛

Ivo Šmíd

🐛

JJengility

🐛

Jake Hemmerle

🐛

James Harrison

🐛

Jan

🐛

Jan Aertgeerts

💻 🐛

Jan Brümmer

🐛

Jan Tříska

🐛

Jan-Lukas Else

🐛

Jason Williams

🐛

Jean-Paul Mayer

🐛

Jean-Simon Larochelle

🐛

Jeff Bartolotta

💻 🐛

Jeff Hube

💻 🐛

Jeff Jensen

🐛

Jeff May

🐛

Jens Gerdes

🐛

Jeroen Borgers

🐛

Jerome Russ

🐛

Jiri Pejchal

🐛

Jithin Sunny

🐛

Jiří Škorpil

🐛

Joao Machado

🐛

Jochen Krauss

🐛

Johan Hammar

🐛

John Karp

🐛

John Zhang

🐛

John-Teng

💻 🐛

Jon Moroney

💻 🐛

Jonas Geiregat

🐛

Jonathan Wiesel

💻 🐛

Jordan

🐛

Jordi Llach

🐛

Jorge Solórzano

🐛

JorneVL

🐛

Jose Palafox

🐛

Jose Stovall

🐛

Joseph

💻

Joseph Heenan

🐛

Josh Feingold

💻 🐛

Josh Holthaus

🐛

Joshua S Arquilevich

🐛

João Ferreira

💻 🐛

João Pedro Schmitt

🐛

Juan Martín Sotuyo Dodero

💻 📖 🐛 🚧

Juan Pablo Civile

🐛

Julian Voronetsky

🐛

Julien

🐛

Julius

🐛

JustPRV

🐛

Jörn Huxhorn

🐛

KThompso

🐛

Kai Amundsen

🐛

Karl-Andero Mere

🐛

Karl-Philipp Richter

🐛

Karsten Silz

🐛

Kazuma Watanabe

🐛

Kev

🐛

Keve Müller

🐛

Kevin Jones

🐛

Kevin Wayne

🐛

Kieran Black

🐛

Kirill Zubov

🐛

Kirk Clemens

💻 🐛

Klaus Hartl

🐛

Koen Van Looveren

🐛

Kris Scheibe

💻 🐛

Kunal Thanki

🐛

Larry Diamond

💻 🐛

Lars Knickrehm

🐛

Leo Gutierrez

🐛

Lintsi

🐛

Linus Fernandes

🐛

Lixon Lookose

🐛

Logesh

🐛

Lorenzo Gabriele

🐛

Loïc Ledoyen

🐛

Lucas Silva

🐛

Lucas Soncini

💻 🐛

Lukasz Slonina

🐛

Lukebray

🐛

Lyor Goldstein

🐛

MCMicS

🐛

Macarse

🐛

Machine account for PMD

💻

Maciek Siemczyk

🐛

Maikel Steneker

💻 🐛

Maksim Moiseikin

🐛

Manfred Koch

🐛

Manuel Moya Ferrer

💻 🐛

Manuel Ryan

🐛

Marat Vyshegorodtsev

🐛

Marcel Härle

🐛

Marcello Fialho

🐛

Marcin Rataj

🐛

Mark Adamcin

🐛

Mark Hall

💻 🐛

Mark Kolich

🐛

Mark Pritchard

🐛

Markus Rathgeb

🐛

Marquis Wang

🐛

Martin Feldsztejn

🐛

Martin Lehmann

🐛

Martin Spamer

🐛

Martin Tarjányi

🐛

MatFl

🐛

Mateusz Stefanski

🐛

Mathieu Gouin

🐛

MatiasComercio

💻 🐛

Matt Benson

🐛

Matt De Poorter

🐛

Matt Harrah

🐛

Matt Nelson

🐛

Matthew Amos

🐛

Matthew Duggan

🐛

Matthew Hall

🐛

Matías Fraga

💻 🐛

Maxime Robert

💻 🐛

Michael

🐛

Michael Bell

🐛

Michael Bernstein

🐛

Michael Clay

🐛

Michael Dombrowski

🐛

Michael Hausegger

🐛

Michael Hoefer

🐛

Michael Möbius

🐛

Michael N. Lipp

🐛

Michael Pellegrini

🐛

Michal Kordas

🐛

Michał Borek

🐛

Michał Kuliński

🐛

Miguel Núñez Díaz-Montes

🐛

Mihai Ionut

🐛

Mirek Hankus

🐛

Mladjan Gadzic

🐛

MrAngry52

🐛

Muminur Choudhury

🐛

Mykhailo Palahuta

💻 🐛

Nagendra Kumar Singh

🐛

Nahuel Barrios

🐛

Nathan Braun

🐛

Nathan Reynolds

🐛

Nathan Reynolds

🐛

Nathanaël

🐛

Nazdravi

🐛

Neha-Dhonde

🐛

Nicholas Doyle

🐛

Nick Butcher

🐛

Nico Gallinal

🐛

Nicola Dal Maso

🐛

Nikita Chursin

🐛

Niklas Baudy

🐛

Nikolas Havrikov

🐛

Nilesh Virkar

🐛

Nimit Patel

🐛

Niranjan Harpale

🐛

Noah Sussman

🐛

Noah0120

🐛

Noam Tamim

🐛

Noel Grandin

🐛

Olaf Haalstra

🐛

Oleg Pavlenko

🐛

Oliver Eikemeier

🐛

Olivier Parent

💻 🐛

Ollie Abbey

💻 🐛

OverDrone

🐛

Ozan Gulle

💻 🐛

PUNEET JAIN

🐛

Parbati Bose

🐛

Paul Berg

🐛

Pavel Bludov

🐛

Pavel Mička

🐛

Pedro Nuno Santos

🐛

Pedro Rijo

🐛

Pelisse Romain

💻 📖 🐛

Pete Davids

🐛

Peter Bruin

🐛

Peter Chittum

💻 🐛

Peter Cudmore

🐛

Peter Kasson

🐛

Peter Kofler

🐛

Pham Hai Trung

🐛

Philip Graf

💻 🐛

Philip Hachey

🐛

Philippe Ozil

🐛

Phinehas Artemix

🐛

Phokham Nonava

🐛

Piotr Szymański

🐛

Piotrek Żygieło

💻 🐛

Pranay Jaiswal

🐛

Prasad Kamath

🐛

Prasanna

🐛

Presh-AR

🐛

Puneet1726

🐛

Rafael Cortês

🐛

RaheemShaik999

🐛

RajeshR

💻 🐛

Ramachandra Mohan

🐛

Raquel Pau

🐛

Ravikiran Janardhana

🐛

Reda Benhemmouche

🐛

Renato Oliveira

💻 🐛

Rich DiCroce

🐛

Riot R1cket

🐛

Rishabh Jain

🐛

RishabhDeep Singh

🐛

Robbie Martinus

💻 🐛

Robert Henry

🐛

Robert Painsi

🐛

Robert Russell

🐛

Robert Sösemann

💻 📖 📢 🐛

Robert Whitebit

🐛

Robin Richtsfeld

🐛

Robin Stocker

💻 🐛

Robin Wils

🐛

RochusOest

🐛

Rodolfo Noviski

🐛

Rodrigo Casara

🐛

Rodrigo Fernandes

🐛

Roman Salvador

💻 🐛

Ronald Blaschke

🐛

Róbert Papp

🐛

Saikat Sengupta

🐛

Saksham Handu

🐛

Saladoc

🐛

Salesforce Bob Lightning

🐛

Sam Carlberg

🐛

Satoshi Kubo

🐛

Scott Kennedy

🐛

Scott Wells

🐛

Sebastian Bögl

🐛

Sebastian Schuberth

🐛

Sebastian Schwarz

🐛

Sergey Gorbaty

🐛

Sergey Kozlov

🐛

Sergey Yanzin

💻 🐛

Shubham

💻 🐛

Simon Xiao

🐛

Srinivasan Venkatachalam

🐛

Stanislav Gromov

🐛

Stefan Birkner

🐛

Stefan Bohn

🐛

Stefan Endrullis

🐛

Stefan Klöss-Schuster

🐛

Stefan Wolf

🐛

Stephan H. Wissel

🐛

Stephen

🐛

Stephen Friedrich

🐛

Stexxe

🐛

Stian Lågstad

🐛

StuartClayton5

🐛

Supun Arunoda

🐛

Suren Abrahamyan

🐛

SwatiBGupta1110

🐛

SyedThoufich

🐛

Szymon Sasin

🐛

T-chuangxin

🐛

TERAI Atsuhiro

🐛

TIOBE Software

💻 🐛

Taylor Smock

🐛

Techeira Damián

💻 🐛

Ted Husted

🐛

TehBakker

🐛

The Gitter Badger

🐛

Theodoor

🐛

Thiago Henrique Hüpner

🐛

Thibault Meyer

🐛

Thomas Güttler

🐛

Thomas Jones-Low

🐛

Thomas Smith

💻 🐛

ThrawnCA

🐛

Thunderforge

💻 🐛

Tim van der Lippe

🐛

Tobias Weimer

💻 🐛

Tom Daly

🐛

Tomer Figenblat

🐛

Tomi De Lucca

💻 🐛

Torsten Kleiber

🐛

TrackerSB

🐛

Ullrich Hafner

🐛

Utku Cuhadaroglu

💻 🐛

Valentin Brandl

🐛

Valeria

🐛

Vasily Anisimov

🐛

Vickenty Fesunov

🐛

Victor Noël

🐛

Vincent HUYNH

🐛

Vincent Maurin

🐛

Vincent Privat

🐛

Vishhwas

🐛

Vitaly

🐛

Vitaly Polonetsky

🐛

Vojtech Polivka

🐛

Vsevolod Zholobov

🐛

Wang Shidong

🐛

Waqas Ahmed

🐛

Wayne J. Earl

🐛

Wchenghui

🐛

Will Winder

🐛

William Brockhus

💻 🐛

Wilson Kurniawan

🐛

Wim Deblauwe

🐛

Woongsik Choi

🐛

XenoAmess

💻 🐛

YaroslavTER

🐛

Young Chan

💻 🐛

YuJin Kim

🐛

Yuri Dolzhenko

🐛

Yurii Dubinka

🐛

Zoltan Farkas

🐛

Zustin

🐛

aaronhurst-google

🐛

alexmodis

🐛

andreoss

🐛

andrey81inmd

💻 🐛

anicoara

🐛

arunprasathav

🐛

asiercamara

🐛

astillich-igniti

💻

avesolovksyy

🐛

avishvat

🐛

avivmu

🐛

axelbarfod1

🐛

b-3-n

🐛

balbhadra9

🐛

base23de

🐛

bergander

🐛

berkam

💻 🐛

breizh31

🐛

caesarkim

🐛

carolyujing

🐛

cesares-basilico

🐛

chrite

🐛

cobratbq

🐛

coladict

🐛

cosmoJFH

🐛

cristalp

🐛

crunsk

🐛

cwholmes

🐛

cyberjj999

🐛

cyw3

🐛

d1ss0nanz

🐛

danbrycefairsailcom

🐛

dariansanity

🐛

darrenmiliband

🐛

davidburstrom

🐛

dbirkman-paloalto

🐛

deepak-patra

🐛

dependabot[bot]

💻 🐛

dinesh150

🐛

diziaq

🐛

dreaminpast123

🐛

duanyanan

🐛

dutt-sanjay

🐛

dylanleung

🐛

dzeigler

🐛

ekkirala

🐛

emersonmoura

🐛

fairy

🐛

foxmason

🐛

frankegabor

🐛

frankl

🐛

freafrea

🐛

fsapatin

🐛

gracia19

🐛

guo fei

🐛

gurmsc5

🐛

gwilymatgearset

💻 🐛

haigsn

🐛

hemanshu070

🐛

henrik242

🐛

hongpuwu

🐛

hvbtup

💻 🐛

igniti GmbH

🐛

ilovezfs

🐛

itaigilo

🐛

jakivey32

🐛

jbennett2091

🐛

jcamerin

🐛

jkeener1

🐛

jmetertea

🐛

josemanuelrolon

💻 🐛

kabroxiko

💻 🐛

karwer

🐛

kaulonline

🐛

kdaemonv

🐛

kenji21

💻 🐛

kfranic

🐛

khalidkh

🐛

krzyk

🐛

lasselindqvist

🐛

lihuaib

🐛

lonelyma1021

🐛

lpeddy

🐛

lyriccoder

🐛

marcelmore

🐛

matchbox

🐛

matthiaskraaz

🐛

meandonlyme

🐛

mikesive

🐛

milossesic

🐛

mriddell95

🐛

mrlzh

🐛

msloan

🐛

mucharlaravalika

🐛

mvenneman

🐛

nareshl119

🐛

nicolas-harraudeau-sonarsource

🐛

noerremark

🐛

novsirion

🐛

oggboy

🐛

oinume

🐛

orimarko

💻 🐛

pallavi agarwal

🐛

parksungrin

🐛

patpatpat123

🐛

patriksevallius

🐛

pbrajesh1

🐛

phoenix384

🐛

piotrszymanski-sc

💻

plan3d

🐛

poojasix

🐛

prabhushrikant

🐛

pujitha8783

🐛

r-r-a-j

🐛

raghujayjunk

🐛

rajeshveera

🐛

rajeswarreddy88

🐛

recdevs

🐛

reudismam

💻 🐛

rijkt

🐛

rillig-tk

🐛

rmohan20

💻 🐛

rxmicro

🐛

ryan-gustafson

💻 🐛

sabi0

🐛

scais

🐛

sebbASF

🐛

sergeygorbaty

💻

shilko2013

🐛

simeonKondr

🐛

snajberk

🐛

sniperrifle2004

🐛

snuyanzin

🐛

sratz

🐛

stonio

🐛

sturton

💻 🐛

sudharmohan

🐛

suruchidawar

🐛

svenfinitiv

🐛

tashiscool

🐛

test-git-hook

🐛

testation21

💻 🐛

thanosa

🐛

tiandiyixian

🐛

tobwoerk

🐛

tprouvot

🐛

trentchilders

🐛

triandicAnt

🐛

trishul14

🐛

tsui

🐛

winhkey

🐛

witherspore

🐛

wjljack

🐛

wuchiuwong

🐛

xingsong

🐛

xioayuge

🐛

xnYi9wRezm

💻 🐛

xuanuy

🐛

xyf0921

🐛

yalechen-cyw3

🐛

yasuharu-sato

🐛

zenglian

🐛

zgrzyt93

💻 🐛

zh3ng

🐛

zt_soft

🐛

ztt79

🐛

zzzzfeng

🐛

Árpád Magosányi

🐛

任贵杰

🐛

This project follows the all-contributors specification. Contributions of any kind welcome!

📝 License

BSD Style