Wednesday, December 3, 2014

Checkstyle GSOC 2014 results

Checkstyle is a development tool which helps Java programmers to write a code that adheres to specific coding standards. This summer our organization participated in GSoC for the first time. Our main idea for GSOC 2014 was to improve Checkstyle ANTLR grammar in order to support Java 8 syntax changes. The next idea was to allow Checkstyle to validate comments and JavaDoc blocks in sources. And the last, we wanted to create Checkstyle config which covers Google’s style guide for Java that would come with Checkstyle distribution. GSoC has offered three student slots, which allowed us to realize our exciting ideas this summer.

ANTLR grammar for Java 8 features  -- Student: Ilja Dubinin

Java 8 is already released , but users who rely on Checkstyle to enforce code standards(style) can not use Java 8 features as Checkstyle is crashing on lambda and default methods appearance. This forces users to choose between using either Java 8 or Checkstyle. Some organizations enforce code standard adherence even on commit hook that makes choice even more acute.
Ilja made it possible to use Checkstyle on Java 8 specific sources. His work did not involve massive coding, however but he did a detailed investigation of all aspects and usages of new Java 8 features. He analyzed massive java grammar and found places where update is essential and performed it without damaging any other parsing features. He did massive testing on open-source projects that already use Java 8 features, one of the examples is reported on openjdk.
My best experience from working with Ilja was that he did most of development without mentor supervision , and he always reported results on time.

By Roman Ivanov, Checkstyle Mentor

ANTLR grammar for comments and Documentation comments (JavaDocs)  -- Student: Baratali Izmailov

    Completion of this project  will allow Java developer to validate their JavaDoc to comply with  specific style guide by Checkstyle. In addition to non configurable JDK DocLint feature that is appeared in Java 8, Checkstyle allows developers to write their own complicated validation rules(example) for JavaDoc and comments easily. This task was divided in 2 parts:  
1. Add to internally created parse tree single-line and multiline comments
2. Add grammar based parser for JavaDoc comments that is a special format of multiline comment.
    For (1) Baratali updated existing Checkstyle ANTLR grammar while for (2) he wrote the separate ANTLR4 grammar and parsing processor which supports standard and custom JavaDoc tags and JavaDoc html4 formatting.
No significant changes were made to Checkstyle API. API update is absolutely compatible, no changes in any existing Checks are required. Comments could be available in parse tree only when Check require comments.
Baratali tested his code by writing UTs and running updated Checkstyle on openjdk8, spring, guava and some another huge opensource projects.

By Daniil Yaroslavtsev and Roman Ivanov, Checkstyle Mentors

Checkstyle configuration for “Google Java Style” guide  -- Student: Maxim Vetrenko

“Google Java Style” guide is the second most popular guide among the open source community. Finally it can be applied and used in projects a lot more easier with the aid of Maxim’s work. If you do not know what style to use or do not want to invent your own style - just use Google’s code standard, as it is proven style from prominent developers.
The main goal of the project was to review requirements of Google’s Java Code Style and to create a Checkstyle configuration for all rules of that guide that could be validated automatically.
The main problem was to instill in student mind best practices of development process. Changing student’s “I will code right away” approach to the “I will understand the problem, ask questions, write tests first, slice and dice big task in small sub-tasks and only then code the program” approach. This led to the “every day” communication practice which played a key role in finishing the project successfully.
Created configuration was tested on Guava Google Core Libraries for Java, final report is here. Detailed Checkstyle coverage report for Google Style is located here.

By Ruslan Diachenko and Roman Ivanov, Checkstyle Mentor

We are pleased to announce that Checkstyle had 3 students who successfully complete at their first  year Google Summer of Code program. If you would like to read more about the work students completed on Checkstyle, during this year’s program, you can check out our mailing list posts or twitter.

By Roman Ivanov Checkstyle Organization Administrator for Google Summer of Code

No comments:

Post a Comment