Suppose you have strict Credo rules in your app. After running Phoenix generators like mix phx.gen.live, you probably have to fix many code style issues before moving on. That’s because the default Phoenix generator templates didn’t consider Credo.
We see value in Credo checks, but they slow us down when creating new resources. We noticed we were wasting a lot of time fixing the same issues over and over. That’s why we’ve decided to fix these issues once in templates, and then use them every time we generate new resources.
# Include the templates in the appgit submodule add \https://github.com/optimumBA/optimum_templates \priv/templates# Run some Phoenix generatormix phx.gen.context \Accounts User users name:string age:integerNow, we don’t see any Credo issues.
Source code: https://github.com/optimumBA/optimum_templates
continue reading on elixirdrops.net
⚠️ This post links to an external website. ⚠️
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.