Code Monkey home page Code Monkey logo

gsoc-2022-scalafix's Introduction

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)

gsoc-2022-scalafix's People

Contributors

rvacaru avatar

Watchers

 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.