Google Summer of Code 2024 Final Report

Project: Refine Google Style Guide Implementation

Student: Mauryan Kansara

Organization: Checkstyle

Mentors: Roman Ivanov, Ruslan Diachenko

GSoC Proposal: here


Project Goals

The project aims to update the implement of google java style guide to latest version. The google_checks.xml is the xml file where google style guide is implemented. The previous version we supported was May 23 2018. After that there was a major update of style guide released on Feb 03 2022. The project’s main goal was to implement this newer version of style guide and update to coverage page according to it. The other goals were transitioning our google style tests from per-module approach to whole-config approach, solving bugs in existing implementation and we also updated the coverage page’s style.


What I Did During GSoC

  1. Researched about updated sections of style guide: I began my research about finding out what parts of style guide was updated in the latest version by creating a diff PR. The PR contained diff between the older version of style guide and newer version. It helped us to identify what sections were changed and which modules needs to be updated to follow the new rules. It served as foundation to open new issues and discuss the approach to implement the new rules.

  2. Updating Coverage Table: In first week, we discussed the updated parts in the diff PR and separate issues were opened to indicate the defects in our implementation. Coverage table was updated for each sections which were changed with a message & its corresponding issue, specifying that the section’s implementation is based on the previous version and it will be updated to the latest version as part of its referenced issue.

  3. Migrating Google Style Guide Tests: Google style guide implementation’s tests were implemented based on per-module approach. All tests needed to be transitioned to whole-config testing for better coverage of the style guide. We decided to migrate tests to chapter-wise testing first and then to whole-config testing to ease the migration process. All tests were migrated to chapter-wise testing approach as part of issue #14937. After this, support for testing the input file against whole google_checks.xml was added at #15026, later all tests were migrated to whole-config testing approach as part of #14937.

  4. Comparing Input Files against google-java-format: We added support to compare google style guide input files against google-java-format in CI. This helps us to find any false-negatives/positives easily. Support for google-java-format was added at #15237. Separate InputFormattedXxxxx files were created as part of #15340 to be compared against google-java-format. During this, we also found some bugs in google-java-format which were reported to them.

  5. Standardizing Content of Coverage Table:
    • Fixing Inconsistent Spacing: Previously, coverage table had inconsistent spacing and didn’t had a proper way to display configs of the different Checks used and their input files, it was resolved as part of #14930.
    • Removing Closed Referenced Issues: All the closed referenced issues were removed from each sections as part of #15442.
    • Updating Validation Tests of Coverage Table: Content of coverage table was simplified and it’s validation tests were updated as part of #14968.
  6. Implementation of new rules:
    • Adding missing or new sections: Missing or newly introduced sections in the latest version were added to the coverage table.
    • Updating implementation of Style Guide: Based on the new requirements, google_checks.xml and required Checks were updated. Different issues were opened to discuss the approach for updating implementation. Many bugs/defect were found & solved during this process.
    • Handling Lack of Coverage: Some new rules were not able to be fully implemented by us due to limitations of Checkstyle. For such sections, coverage table was updated with a message explaining the reason behind lack of coverage.

Current Status and Future Work

The project is currently in stable state, with majority of successful implementation of new rules and extending style guide tests by implementing whole-config testing approach. The new coverage table has a more simple way of referencing configs of different modules used and their input files.

However, there are several areas for future enhancements:


Code Contributions

The release notes can be found here: 10.18.0, 10.18.1, 10.18.2, 10.19.0.


What I Learned During GSoC

Technical Skills:

Non-Technical Skills:

Overall, This experience has been incredibly enriching, both technically and personally. I’ve gained valuable skills in project management, communication, and teamwork, along with a deeper understanding of how large open-source projects are maintained. These lessons have boosted my confidence and will serve as a strong foundation for my future career in software development.


Acknowledgements

I would like to express my deepest gratitude to my mentors, Roman Ivanov and Ruslan Diachenko, for their unwavering support and guidance throughout this project. Their calm and understanding nature made it easy for me to ask questions, I got to learn so much from their experience. I also want to thank Richard Veach, who was always willing to help and provided detailed explanations to clear my doubts. This project would not have been possible without their invaluable mentorship and assistance. I am looking forward to keep contributing to Checkstyle and help other new comers to get their open-source journey started.