-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do we use this style guide in an automated way? #143
Comments
Having something like https://atom.io/packages/elm-format would be pretty cool 😆 |
It should be possible to write custom Credo checks for many of the style recommendations in this guide, and package them up for use in any Elixir project. Would this be of interest? Do you think it would make sense to include them here, or to create a separate repo/project for that purpose?
Not quite the same, but have you tried https://github.com/lpil/dogma ? |
I found this repo using the trending feature for Github, so I imagine that a lot of Elixir devs agree this this is a nice way to write Elixir. I would love to be able to install a package in Atom and run all these style checks against my open file. In Javascript I use prettier. |
@sergiotapia You already mentioned atom-credo. That runs It would be a fair amount of work to write credo checks for this style guide, and either upstream them to credo or create a separate package. But it should be doable! |
We have a google summer of code student working on an elixir formatter. It won't follow this style guide, but it will be fairly similar. |
First of all, sorry for posting in this old issue, but since it was open I though that would not be that bad. I've been playing around with Credo and the Formatter to see what things are not automated. Source Code LayoutNeither credo nor formatter caught it
Formatter didn't caught, but Credo did
SyntaxNeither credo nor formatter caught it
Formatter didn't caught, but Credo did
CommentsOnly problems with comment grammar (which is totally understandeable), as seen here ModulesAlmost nothing was caught. I think only space after I think that the order is something really nice to add to Credo. Will think about it TypespecsNeither credo nor formatter caught it
StructsNeither credo nor formatter caught it
ImprovingThere is probably a lot of places we can improve that I haven't tested. I also dind't got into naming because it is a nasty space. One thing we could do to automate it better is: Add Checks to CredoThis is the list of checks I think is not that hard to implement on Credo
Maybe we should create some issues on Credo repo and see if they think these checks are reasonable and then we can try to implement the checks (we could ship the checks in a different repo as well) What do you guys think? |
There is a discussion on rrene/credo#540 about the module ordering |
Looks like there is a PR out for module attribute ordering: rrrene/credo#588 🎉 |
I have a package called credo_contrib which implements a lot of the rules from this style guide (including module attribute ordering). I'll take a look at the list above and see if there are any more I can add. Contributions welcome also! |
I have created rrrene/credo#933 to enforce https://github.com/christopheradams/elixir_style_guide#pipe-operator 🎉 |
I have created rrrene/credo#935 to enforce the https://github.com/christopheradams/elixir_style_guide#true-as-last-condition |
This is great work @Stratus3D, please keep us up to date on your credo PRs. |
Right now I have Atom, Credo, and the atom-credo linter package installed.
Is there a way for us Elixir devs to use this style guide in an automated way?
The text was updated successfully, but these errors were encountered: