2024-11-22 14:59:02 +05:00
Added line: 197
Added line: 3456
Added line: 996
Added line: 3641
2021-08-20 16:12:05 +02:00
# PMD - source code analyzer
2024-11-22 14:59:02 +05:00
Added line: 9948
2012-11-17 17:00:27 +01:00
2024-09-26 16:26:26 +02:00
![PMD Logo ](https://raw.githubusercontent.com/pmd/pmd/main/docs/images/logo/pmd-logo-300px.png )
2024-11-22 14:59:02 +05:00
Added line: 6023
Added line: 6752
2020-09-17 11:02:02 +02:00
2024-11-22 14:59:02 +05:00
Added line: 1666
2023-02-17 09:12:32 +01:00
[![Join the chat ](https://img.shields.io/gitter/room/pmd/pmd )](https://app.gitter.im/#/room/#pmd_pmd:gitter.im?utm_source=badge& utm_medium=badge& utm_campaign=pr-badge& utm_content=badge)
2024-09-26 15:54:08 +02:00
[![Build Status ](https://github.com/pmd/pmd/actions/workflows/build.yml/badge.svg?branch=main )](https://github.com/pmd/pmd/actions)
2024-11-22 14:59:02 +05:00
Added line: 9428
Added line: 8307
Added line: 5656
Added line: 9073
Added line: 379
Added line: 7887
Added line: 5565
Added line: 9358
Added line: 3986
2017-02-03 16:27:38 -03:00
[![Maven Central ](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd/badge.svg )](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd)
2024-11-22 14:59:02 +05:00
Added line: 7996
Added line: 5862
2024-05-03 19:57:57 +02:00
[![Reproducible Builds ](https://img.shields.io/badge/Reproducible_Builds-ok-green?labelColor=blue )](https://github.com/jvm-repo-rebuild/reproducible-central/tree/master/content/net/sourceforge/pmd#readme)
2024-10-03 17:47:01 -03:00
[![Coverage Status ](https://coveralls.io/repos/github/pmd/pmd/badge.svg?branch=main )](https://coveralls.io/github/pmd/pmd?branch=main)
2024-05-03 19:57:57 +02:00
[![Codacy Badge ](https://app.codacy.com/project/badge/Grade/ea550046a02344ec850553476c4aa2ca )](https://app.codacy.com/organizations/gh/pmd/dashboard)
2020-04-17 16:13:34 +02:00
[![Contributor Covenant ](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg )](code_of_conduct.md)
2024-11-22 14:59:02 +05:00
Added line: 9600
Added line: 3596
Added line: 6847
Added line: 9652
2023-03-30 15:28:56 +02:00
[![Documentation (latest) ](https://img.shields.io/badge/docs-latest-green )](https://docs.pmd-code.org/latest/)
2024-11-22 14:59:02 +05:00
Added line: 9163
2015-11-14 17:53:52 +01:00
2024-11-22 14:59:02 +05:00
Added line: 1822
2024-05-03 19:47:22 +02:00
**PMD** is an extensible multilanguage static code analyzer. It finds common programming flaws like unused variables,
empty catch blocks, unnecessary object creation, and so forth. It's mainly concerned with **Java and
Apex**, but **supports 16 other languages** . It comes with **400+ built-in rules** . 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.
2024-11-22 14:59:02 +05:00
Added line: 5219
2024-05-03 19:47:22 +02:00
Currently, PMD supports Java, JavaScript, Salesforce.com Apex and Visualforce,
2024-11-22 14:59:02 +05:00
Added line: 4152
Added line: 5266
Added line: 1747
Added line: 8657
Added line: 1802
Added line: 6277
Added line: 411
2024-05-03 19:47:22 +02:00
Kotlin, Swift, Modelica, PLSQL, Apache Velocity, JSP, WSDL, Maven POM, HTML, XML and XSL.
2024-11-22 14:59:02 +05:00
Added line: 707
Added line: 2944
2022-11-10 23:33:08 +00:00
Scala is supported, but there are currently no Scala rules available.
2012-11-17 17:00:27 +01:00
2024-11-22 14:59:02 +05:00
Added line: 7518
2023-02-16 19:24:32 +01:00
Additionally, it includes **CPD** , the copy-paste-detector. CPD finds duplicated code in
2024-05-03 19:47:22 +02:00
Coco, C/C++, C#, Dart, Fortran, Gherkin, Go, Groovy, HTML, Java, JavaScript, JSP, Julia, Kotlin,
Lua, Matlab, Modelica, Objective-C, Perl, PHP, PLSQL, Python, Ruby, Salesforce.com Apex and
2024-11-22 14:59:02 +05:00
Added line: 826
2024-05-03 19:47:22 +02:00
Visualforce, Scala, Swift, T-SQL, Typescript, Apache Velocity, WSDL, XML and XSL.
2021-08-20 16:12:05 +02:00
2024-11-22 14:59:02 +05:00
Added line: 7368
Added line: 4
2021-08-20 16:12:05 +02:00
## 🚀 Installation and Usage
2024-11-22 14:59:02 +05:00
Added line: 306
2021-08-20 16:12:05 +02:00
Download the latest binary zip from the [releases ](https://github.com/pmd/pmd/releases/latest )
2024-11-22 14:59:02 +05:00
Added line: 2410
Added line: 2360
Added line: 8378
Added line: 1631
2021-08-20 16:12:05 +02:00
2024-11-22 14:59:02 +05:00
Added line: 5829
2023-03-30 15:28:56 +02:00
Execute `bin/pmd check` or `bin\pmd.bat check` .
2021-08-20 16:12:05 +02:00
2024-11-22 14:59:02 +05:00
Added line: 4259
2023-03-30 15:28:56 +02:00
See also [Getting Started ](https://docs.pmd-code.org/latest/pmd_userdocs_installation.html )
2024-11-22 14:59:02 +05:00
Added line: 6755
2021-08-20 16:12:05 +02:00
**Demo:**
2024-03-01 08:29:30 +01:00
This shows how PMD analyses [openjdk ](https://github.com/openjdk/jdk ):
2021-08-20 16:12:05 +02:00
2021-09-02 12:20:34 +02:00
![Demo ](docs/images/userdocs/pmd-demo.gif )
2021-08-20 16:12:05 +02:00
There are plugins for Maven and Gradle as well as for various IDEs.
2023-03-30 15:28:56 +02:00
See [Tools / Integrations ](https://docs.pmd-code.org/latest/pmd_userdocs_tools.html )
2021-08-20 16:12:05 +02:00
## ℹ ️ How to get support?
2024-11-22 14:59:02 +05:00
Added line: 9673
Added line: 4858
Added line: 8880
2020-02-15 19:07:20 +01:00
2021-01-07 12:09:10 +01:00
* How do I? -- Ask a question on [StackOverflow ](https://stackoverflow.com/questions/tagged/pmd )
2024-11-22 14:59:02 +05:00
Added line: 4996
2021-01-07 12:09:10 +01:00
* I got this error, why? -- Ask a question on [StackOverflow ](https://stackoverflow.com/questions/tagged/pmd )
or on [discussions ](https://github.com/pmd/pmd/discussions ).
2024-11-22 14:59:02 +05:00
Added line: 283
2020-02-15 19:07:20 +01:00
* I got this error and I'm sure it's a bug -- file an [issue ](https://github.com/pmd/pmd/issues ).
2024-11-22 14:59:02 +05:00
Added line: 8625
Added line: 1481
2021-01-07 12:09:10 +01:00
* I have an idea/request/question -- create a new [discussion ](https://github.com/pmd/pmd/discussions ).
2024-11-22 14:59:02 +05:00
Added line: 4762
2023-02-17 09:12:32 +01:00
* I have a quick question -- ask in our [Gitter room ](https://app.gitter.im/#/room/#pmd_pmd:gitter.im ).
2024-11-22 14:59:02 +05:00
Added line: 390
Added line: 3080
Added line: 124
Added line: 3074
2023-03-30 15:28:56 +02:00
* Where's your documentation? -- < https: // docs . pmd-code . org / latest />
2024-11-22 14:59:02 +05:00
Added line: 7903
2020-02-15 19:07:20 +01:00
2024-11-22 14:59:02 +05:00
Added line: 3362
Added line: 3918
2021-08-20 16:12:05 +02:00
## 🤝 Contributing
2024-11-22 14:59:02 +05:00
Added line: 2452
Added line: 2952
Added line: 7325
2021-08-20 16:12:05 +02:00
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
2024-11-22 14:59:02 +05:00
Added line: 3190
2013-05-01 14:56:22 +02:00
2017-01-05 11:27:08 +01:00
Our latest source of PMD can be found on [GitHub ](https://github.com/pmd/pmd ). Fork us!
2024-11-22 14:59:02 +05:00
Added line: 9208
2015-11-14 17:53:52 +01:00
2024-11-22 14:59:02 +05:00
Added line: 4065
2017-01-05 11:27:08 +01:00
* [How to build PMD ](BUILDING.md )
2024-11-22 14:59:02 +05:00
Added line: 5883
Added line: 577
Added line: 634
Added line: 5011
Added line: 5941
2017-01-05 11:27:08 +01:00
* [How to contribute to PMD ](CONTRIBUTING.md )
2015-11-14 17:53:52 +01:00
2019-03-03 11:54:41 +01:00
The rule designer is developed over at [pmd/pmd-designer ](https://github.com/pmd/pmd-designer ).
2024-11-22 14:59:02 +05:00
Added line: 4274
2019-03-03 11:54:41 +01:00
Please see [its README ](https://github.com/pmd/pmd-designer#contributing ) for
developer documentation.
2024-11-22 14:59:02 +05:00
Added line: 1263
2021-09-09 15:03:32 +02:00
## 💵 Financial Contributors
2021-08-20 16:12:05 +02:00
2024-11-22 14:59:02 +05:00
Added line: 1554
2021-08-20 16:12:05 +02:00
Become a financial contributor and help us sustain our community. [Contribute ](https://opencollective.com/pmd/contribute )
2024-11-22 14:59:02 +05:00
Added line: 7776
2021-08-20 16:12:05 +02:00
2021-08-20 16:16:31 +02:00
## ✨ Contributors
2024-11-22 14:59:02 +05:00
Added line: 8951
2021-09-09 14:50:32 +02:00
This project follows the [all-contributors ](https://github.com/all-contributors/all-contributors ) specification.
2024-11-22 14:59:02 +05:00
Added line: 6606
2021-09-09 14:50:32 +02:00
Contributions of any kind welcome!
2024-11-22 14:59:02 +05:00
Added line: 7479
Added line: 9128
Added line: 1345
Added line: 1060
Added line: 7873
Added line: 902
Added line: 1538
2021-09-09 14:50:32 +02:00
See [credits ](docs/pages/pmd/projectdocs/credits.md ) for the complete list.
2024-11-22 14:59:02 +05:00
Added line: 1414
2021-08-20 16:16:31 +02:00
2024-11-22 14:59:02 +05:00
Added line: 5382
2021-08-20 16:12:05 +02:00
## 📝 License
2015-11-14 17:53:52 +01:00
2024-11-22 14:59:02 +05:00
Added line: 5436
Added line: 7077
2021-08-20 16:12:05 +02:00
[BSD Style ](LICENSE )
2024-11-22 14:59:02 +05:00
Added line: 7917