Git Product home page Git Product logo

pmd-bluej's Introduction

PMD - source code analyzer

PMD Logo

Join the chat Build Status Maven Central Reproducible Builds Coverage Status Codacy Badge Contributor Covenant Documentation (latest)

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.

Currently, PMD supports Java, JavaScript, Salesforce.com Apex and Visualforce, Kotlin, Swift, Modelica, PLSQL, Apache Velocity, JSP, WSDL, Maven POM, HTML, XML and XSL. Scala is supported, but there are currently no Scala rules available.

Additionally, it includes CPD, the copy-paste-detector. CPD finds duplicated code in 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 Visualforce, Scala, Swift, T-SQL, Typescript, Apache Velocity, WSDL, XML and XSL.

๐Ÿš€ Installation and Usage

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

Execute bin/pmd check or bin\pmd.bat check.

See also Getting Started

Demo:

This shows how PMD analyses openjdk:

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

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

See credits for the complete list.

๐Ÿ“ License

BSD Style

pmd-bluej's People

Contributors

adangel avatar dependabot[bot] avatar tmittelstaedt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pmd-bluej's Issues

Support BlueJ 5

This extension is one of the most popular extensions that people install in BlueJ.

We recently released BlueJ 5.0.0 which includes a breaking modification to the extensions API, so your existing extension will not run in BlueJ 5. As you may know, BlueJ 1-3 used Swing for its GUI and thus the extension API was based around Swing. BlueJ 4 had an awkward hybrid of Swing and JavaFX (which already caused problems with some extensions). BlueJ 5 has now fully transitioned to JavaFX and removed support for the old extensions API in favour of a very similar one based on JavaFX.

We have made a guide on how to convert extensions to BlueJ 5 here: https://bluej.org/extensions/writingextensions2.html#BJ5 The quick summary is that you need to update some package names, change any Swing GUI to the JavaFX equivalent and recompile against BlueJ 5. The effort involved will thus be proportionate to how much Swing GUI code you have in your extension.

If you have any questions about converting your extension, please let us know.

PMD distribution changed the name of the entry point script from run.sh to pmd

Problem: When attempting to set the location through the extension preference window of PMD for BlueJ 5.x or launching the extension from a context menu, a file not found exception occurs.

Cause: As the title notes, the main PMD distribution changed the entry-point script name for Linux/Mac from <pmd distro>/bin/run.sh or variations to just <pmd distro>/bin/pmd a while back (at least PMD v6.55 which is current in Homebrew, but also applies to the latest snapshot 7.x from the main website).

Reference:

These three spots were the only obvious references I found on cursory look.

pathToExecutable = new File(selectedFile, "bin/run.sh");

+ " a PMD installation. E.g. the file bin/pmd.bat or bin/run.sh is missing.");

String mycommand = preferences.getPMDPath() + "/bin/run.sh pmd " + preferences.getPMDOptions() + " -d " + javaFileName;

Resolution: As a workaround, it works for my needs (in the extension by adding a symbolic link in the bin folder of the distribution (ln -s pmd run.sh.

For a more permanent resolution, switching to the current entry-point script name in code would probably be the forward-thinking way to handle it, and warn if using an older PMD distribution where the older expected entry point is present, but continue to execute the underlying, older PMD distribution.

BlueJ Won't Start

On line 20 of "PMDExecExt.java" the method call "bluej.getCurrentFrame()" returns a null. BlueJ updated their source code, version 4.0.0 changed this methods return. This method now returns a null and this prevents PMD from working in BlueJ.

bluej.setMenuGenerator(new MenuBuilder(bluej.getCurrentFrame(), pmdPreferences));

no PMD item in context menu on BlueJ 4.0.1 on a Mac

I've installed the PMD plugin and configured it (configuration options show in the preferences). My PMD is working or at least it is running, but in BlueJ I don't see the PMD option in the class context menu.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.