Just saw #7655 and its comment mentioning a linting tool. I remembered that we had this conversation at least once somewhere, but didn’t find the corresponding issue.
Let’s discuss the possibility, pros and cons of built-in linting tool for Crystal.
Thesis: I’d stand for unified code-style in all Crystal programs.
What’s the result? Instead of starting working on some project code immediately, we have to firstly learn its style conventions. We have to follow these “foreign” conventions even if we’ve got used to our own.
Projects exist which purpose is to solely enforce certain code style, effectively saying “despite of the fact that you’ve already have spent your time on some code, we won’t accept it unless you change its style to what we want”.
Different code styles sometimes involve things more complex than semicolons. I’m speaking about functions definition, maximum arguments length, maximum function size etc; it could require massive changes in otherwise good code just to conform with someone else’s point of view on “perfect code style”.
I don’t say code style rules are bad. I’m saying that too much freedom in defining what’s a good style on per-project basis is bad. I’d love to see a first-class linting tool integrated into the language itself.
We already have
crystal format which enforces code “visuals” and raises on obvious syntax errors, and that’s awesome. I’d love to see it’s being smarter and incorporate some features from Ameba.