Rubocop::Crystal

The beginnings of a RuboCop extension for converting Ruby to Crystal.

TODO

Many things. In particular, how are types going to work?

Getting static type information about Ruby files isn't the difficult part, the problem is conveying this information to the Crystal compiler while still maintaining valid syntax.

Inserting Crystal types into Ruby code is a no-go, because that causes Lint/Syntax errors in RuboCop.

Possible paths foward:

  • Modify the parser to accept Crystal type declarations, or at least not break on them.
  • Modify Crystal to accept type declarations from .rbs and/or .rbi files.
  • Modify Crystal to accept type declarations from sorbet/rbs-inline/other annotations.
    • Write Ameba extension to convert the type annotations, as it works with Crystal syntax.
  • Find a way to convey type information to Crystal using valid Ruby syntax.

Interesting repos:

Installation

gem install rubocop-crystal

Usage

rubocop --require rubocop-crystal