Coder Social home page Coder Social logo

checkidioms's Introduction

checkIdioms checkstyle plugin

This is an experiment at writing a plugin for checkstyle

End goal

This plugin should search legacy code for coding patterns that can be expressed in a more idiomatic way in modern Java.

For example, since Java 7 it's better to use try-with-resources instead of closing resources in a finally block.

Most loop based code can be written more declaratively using filters and maps.

If not, for each can be used instead of indexed for loops or iterators.

Since Java 9, there are many one liners for things that used to require verbose blocks of code.

How to test

java -classpath ./build/libs/checkIdioms-1.0-SNAPSHOT.jar:checkstyle-${projectVersion}-all.jar \
    com.puppycrawl.tools.checkstyle.Main -c example-config.xml myproject

See https://checkstyle.sourceforge.io/writingchecks.html#Integrate_your_Check for more details.

Versioning

This is still a work in progress. Don't rely on it working.

Further reading

This project was inspired by Source Code Rejuvenation is not Refactoring.

License

All code is free to use under the MIT license.

checkidioms's People

Contributors

matmoore avatar

Watchers

 avatar  avatar

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.