Skip to content

rvacaru/GsoC-2022-Scalafix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 

Repository files navigation

GSoC 2022 - Scalafix Final Submission

Table of Contents

Project Details

Project name Porting of Scalafix ExplicitResultTypes rule to Scala 3
Organization Scala Center, Scala Center Official Site
Scala Center idea link Project proposal link
Github Issues ExplicitResultType issue, Scalafix cross compiled to scala-3
Project links Scalafix Github repo, Scalafix website
Mentors Meriam Lachkar, Brice Jaglin
Contributor Razvan Vacaru
GSoC Proposal GSoC Link

Scalafix

Scalafix is a linting, code completion and rewriting tool for Scala codebases. The Scalafix tool can be used as a CLI from Terminal, as part of your build with the Maven plugin, Mill plugin or the SBT plugin, and finally Scalafix can run as part of your CICD pipelines.

Scalafix uses Scalameta and SemanticDb to parse the target source code into a traversable AST data structure. Scalafix then modifies the AST by applying its rules and then converts it back into Scala source code, with no change in the behaviour of the original source of course.

Scalafix is also an important part of the set of migration tools which will make it easier to migrate Scala code to Scala 3.

Benefits to the Community

The good reasons for porting Scalafix and ExplicitResultTypes to Scala 3 are:

  • Linting and re-writing code capabilities will be available for Scala 3 projects
    • More readability of Scala3 code
    • Better developer experience
    • Better maintainability of Scala3 projects
  • Scalafix rules written in Scala 3 will be compatible and compilable in Scala 2
  • Scalafix helps in migrating code between Scala 2 and Scala 3 versions

Status before the GSoC project

Scalafix is currently build in Scala versions 2.11, 2.12 and 2.13. It relies on the Scala 2 compiler for:

Since Scalafix uses the Scala compiler, porting Scalafix or ExplicitResultTypes to Scala 3 also means reimplementing compilation logic in scalafix using the new Scala 3 Dotty compiler

Work Done

A list of Pull requests, or commits, of the work done presented in chronological order:

Useful Resources

A list of web resources used while working on the project:

Remaining Work - Next Steps

The Project is unfortunately not finished, even given a project extension from the regular 12 weeks length. These are the task still to be done:

  • Finish the cross compilation of Scalafix to Scala 3
    • In particular fixing unit tests ScalafixArgumentsSuite and ScalafixImplSuite
  • Publishing a new Scalafix version for Scala 3, without ExplicitResultTypes
  • Implement ExplicitResultTypes using the dotty compiler

Next Steps:

Acknowledgements

I really want to express my gratitude and thank my mentors Meriam Lachkar and Brice Jaglin for their consistent help during the project, without their support and advice this wouldn't have been possible. I also want to say thank you to Google and everyone involved in the GSoC programme, which is an awesome initiative to promote Open Source.

This project is dear to me personally, for many reasons. First of all, this is a small dream come true, to contribute to such an important open source organization like Scala Center. Only some years ago I was learning Scala from the official EPFL Coursera course, and now I'm helping with the Scala 3 migration via Scalafix. This proves again that with perseverance, consistency and will power we can realize our dreams. Moreover with this project I'm completing my first decade of career, and I think of it as a nice cherry on the cake.

Scalafix Community

From time to time I have asked for help or advice to the community:

(Thanks to everyone in the above chatrooms who helped and replied to my questions)

About

Final Submission for GSoC'22

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published