ex_check v0.14: new automations & curated tools to supercharge your Elixir workflow
Just released v0.14 of ex_check - a single task that runs all analysis & testing tools in Elixir projects. It comes with a load of new features that build upon ex_check’s “drop in solution” design to bring in even more time-saving automation so you can spend more time coding & less time waiting for CI to spit out issues.
-
Fix mode resolves issues automatically for tools that provide the fix command - useful on local machines for checking & fixing in one-shot and on CI for committing automatic fixes
-
Automatic toggling of retry mode when previous run resulted in failures allows to simply call task again after failures to do a faster check focused only on tools with issues
-
Capability to run only failed tests for tools themselves complements the retry mode and further optimizes the issue fixing workflow by re-checking only what has failed
-
Doctor tool ensures that the project documentation is healthy by validating the presence of module docs, functions docs, typespecs and struct typespecs
…and a few smaller improvements. Enjoy!
IntelliJ Elixir v11.9.2
Changelog
Bug Fixes
-
Protect from nested heredocs in documentation from stopping documentation’s heredoc as happens in
ModuleandEcto.Query.-
Use
~Sfor@moduledoctoo, in addition to@doc. -
Check if the documentation contains
“””or‘’’and use the opposite one as the promoter/terminator.-
If neither is used, use
“””. -
If both are used, use
“””, but then escape“””as\”\”\”.
-
If neither is used, use
- Trim trailing whitespace from documentation lines to match formatter output.
-
Use
-
Set
runIdemaxHeapSizeto7g- Set to the same I run my own IDE at, so the debugged instance isn’t any slower than the normal IDE when I need to do extended all day testing to trigger bugs.
-
Test that all
FormattingTestfiles can be parsed. -
YYINITIALis special - wrappers of the lexer assume that if inYYINITIAL, it is safe to shift the lexer over when there is an error, having{OPENING_CURLY}pushAndBegin(YYINITIAL)when it was either inYYINITIALorINTERPOLATIONmeans that the lexer looked like it was restartable when it really wasn’t. This code has been in the lexer for 6 years.-
When in
YYINITIAL,{no longer recurses intoYYINITIALas}does not need to be counted to determine if it is closing an interpolation. -
When in
INTERPOLATION,{entersINTERPOLATION_CURLYto allow counting and matching of}until it can exit and go back toINTERPOLATION, where}will exit the interpolation. -
When in
INTERPOLATION_CURLY,{enters another level ofINTERPOLATION_CURLYto allow counting and matching of}until it can exit and go up a level.
-
When in
-
The
}inYYINITIALdidyybegin(ADDITION_OR_SUBTRACTION_MAYBE), but it should have beenpushAndBegin(ADDITION_OR_SUBTRACTION)asADDITION_OR_SUBTRACTION_MAYBEor its following states all exit withhandleInLastState()orpopAndBegin(). This was not caught in #1859 because the extraYYINITIALfrompushAndBegin(YYINTIAL)hid the bug. -
Prevent nested
YYINITIALbugs in the future by erroring-
If trying to
pushAndBegin(YYINITIAL). -
If trying to
push(YYINITIAL)and the state stack is not empty
-
If trying to
-
Clear the state Stack when
ElixirFlexLexer#resetis called, as at the level of typing and pasting, theElixirFlexLexeris wrapped in many layers of lexers includingLexerEditorHighlighterwhere theElixirFlexLexeris no longer re-instantiated when there is no text, but instead,ElixirFlexLexer#resetis only called. This has always been an invariant violation since the stack state was added 7 years ago. It likely only became more apparent with the changes to +/- parsing in #1859 that made return-to-YYINITIALless likely.-
Since this
stack.clear()has to be manually added toElixirFlexLexer.java, which is generated fromElixir.flex,ResetTestis added to check that the code is still there.
-
Since this
-
For a reason I haven’t been able to explain, the
LexerEditorHighlighterstops working after:is typed at the start of an atom in certain situations, such as before)inside a function call, like when adding an argument. In this case, the old version of the lexer would mark)as aBAD_CHARACTERand continue to do so until an expected atom start of [a-zA-Z_],‘,“, or an operator occurred. Now, if an invalid atom start is matched, theATOM_STARTstate ends and the previous state handles the text, which in the function case mean)is parsed asCLOSING_PARENTHESIS. This change allows the highlighting to continue. I do not know if returningBAD_CHARACTERwill always break theLexerEditorHighlighter, but I don’t think, so since theGroovyLexerinintellij-communityreturns it, but it may be the case that it isn’t actually returned ever when users are typing and only handled by the lexer for completeness. Installation Instructions
Understanding the Tradeoffs with Elixir Typespecs and Dialyzer
In today’s post I want to start a conversation around the tradeoffs of using Typespecs and Dialyzer use in your Elixir code.
Early access for Testing LiveView is open! 🥳
The course focuses on mastering LiveView’s new testing tools as well as learning the thought process behind writing effective LiveView tests so they’re fast, robust, and easy to maintain.
Elixir Wizards S5E8 Matt Nowack and Jake Heinz on Elixir and Discord; Bonus: Arthi Radhakrishnan, Community.com
Latest episode of Elixir Wizards is out today! Check it out here: https://smartlogic.io/podcast/elixir-wizards/s5e8-nowack-heinz/
The best books to start, or improve your Elixir career
When you start your adventure with Elixir, you may wonder where to get the knowledge. In this article, I have prepared a list of books that may help you to become an Elixir programmer, or improve your career.
https://bartoszgorka.com/the-best-books-to-start-or-improve-your-Elixir-career
ElixirCasts 129: Phoenix LiveView LiveComponents
Get an introduction to LiveView LiveComponents and how you can use them in your Phoenix apps.
Crafting Beautiful Emails in Elixir Using MJML
Learn how to compile your MJML email templates into EEx templates at build time and send them out using Swoosh. Also learn how to edit the Phx.Gen.Auth scaffolding in order to send out these MJML emails when users register.
https://akoutmos.com/post/mjml-template-compliation/
phx_gen_auth and OAuth
Integrating phx_gen_auth and OAuth for a Phoenix LiveView app https://iacobson.medium.com/phx-gen-auth-and-oauth-for-a-phoenix-liveview-app-a19a27e6befa
Have you heard the good news about Elixir? (Why we chose Elixir for our MMO game server)
A look at the requirements and goals that pushed us to choose Elixir for our massive multiplayer game server, plus a post-mortem of the pros & cons of Elixir that we ran into during the implementation.
https://developer.x-plane.com/2021/01/have-you-heard-the-good-news-about-elixir/
elixir/nerves based LoRaWAN gateway server and client
finally my employer http://pmr-rnd.de published the web pages on our elixir/nerves programmable LoRaWAN gateway server http://pmr-rnd.de/lora-gateway/ and the wip page for our LoRa client http://pmr-rnd.de/lora-client/
ThinkingElixir 031: Crawling the Web using Elixir with Oleg Tarasenko and Tze Yiing
In episode 31 of Thinking Elixir, we talk with Oleg Tarasenko and Tze Yiing about crawling the web using Elixir. Oleg created the crawly project to help solve this problem and Tze Yiing joined him as a contributor and maintainer. We cover how Elixir is well suited to orchestrate crawling projects, how to deal with login pages, understanding the legal concerns, building a codeless scraper and much more!
How Absinthe Uses Compilation Callbacks for Schema Validation in Elixir
Let’s look closely at how Absinthe uses some metaprograming tricks and module attributes to provide compile-time schema validation for us.
Create a crypto bot in Elixir ebook updated (early alpha 2)
https://leanpub.com/create-a-cryptocurrency-trading-bot-in-elixir/
4 new chapters, All code starting from chapter 2 got refreshed, logs improved and many descriptions rephrased.
Surpassed 100 pages 🍾 Enjoy ❤️
Getting started with PETAL
As a follow-up to my post about the PETAL stack on the Changelog.com blog I put together this getting-started-guide for anyone wanting to try it out. Hope it helps: https://underjord.io/getting-started-with-petal.html
Open-source Deep Dive: Hound
Started a new blog series - Open-source Deep Dive - where I dissect an open-source project and try to understand the project and the underlying technologies that power it!
The project to kick start this series is Hound - an Elixir library for browser automation and integration testing!
For this project, I explored how browser automation works and looked at how Hound takes fundamental principles of Elixir to build a robust library for writing integration tests with browser automation. I tried to focus on keeping the explanations clear and simple for even beginners to understand!
The post can be found here: https://woojiahao.github.io/blog/posts/2021-01-10-Open-source Deep Dive: Hound
IntelliJ Elixir v11.9.1
Changelog
v11.9.1
Bug Fixes
-
Fix syntax highlighting stopping due to decompiling of
Kernelfailing caused by bugs introduced in #1834. Syntax highlighting could fail part way through a file whenKernelneeded to be decompiled to resolve parts of the syntax. This would lead to the file to be colored above a certain point, but then the default gray after that point.-
Connect compiled stubs to decompiled source by name/arity.
Previously, when the decompiler didn’t use the
Docs, it was guaranteed that thePsiCompiledstubs would correlate, in-order, with the decompiled source call definitions, and so mirrors could be set by matching up the list of them in order. Since theDocsdoesn’t have to correspond to and doesn’t correspond to the binary precisely for some BEAMs, most importantly,Elixir.Kernel.beam, the PsiCompiled stub and decompiled source is now matched by name and arity. This means some mirrors are missed, but no errors are produced. -
Allow decompile source to map to entire arity range
Since the decompile source from
Docscan have default arguments the call definition clauses can have an arity range and not just a fixed arity, so all arities in the range need to be mappable toPsiCompiledfunctions. -
Use correct macro for signature from
Docs. Ensures that defmacro is used for macros instead of hard-codingdefas in #1834. -
Use
~S”””for docs fromDocschunk. The docs from theDocschunk may contain interpolation in the code samples or#{in regex examples, but these should not be treated as an interpolation start as theDocsformat does not support interpolation. Anything that looks like interpolation in the docs text was actually escaped in the original docs, so also escape it here by usingS”””, which turns off interpolation. -
Log an error if
Codefunction can’t be matched to decompiled source. Unlike the oldInvalidMirrorException, this won’t be an exception and the binary <-> decompile will still work for the other functions/macros in the file, so it will be a more graceful degradation.
-
Connect compiled stubs to decompiled source by name/arity.
Previously, when the decompiler didn’t use the
-
Fix missed references to
DepsWatcheras project componentDepsWatcherwas converted to a Project Listener in #1844 to support installing the plugin from the Marketplace without reloading, but some references toDepsWatcherwere still trying to get its instance for project usingproject.getComponent(), which would now returnnull. -
Target Java 1.8 for JPS compatibility. JPS (JetBrains Project System) is the API used to allow External Builders, like
mixto build projects. -
Fix matching
unquote(ATOM)call definitions to compiled function by using the argument tounquotewhen calculating the name of the call definition clause if possible. Needed to match anonymous function names that areunquoted because they contain/to separate the outer function name from the anonymous function naming convention. -
Don’t use
Docssignature forMacroNameAritythat is an operator orunquoted The signatures for operators andunquoted don’t produce valid code that can be parsed. -
Don’t use signatures for
__struct__functions. The signatures for the__struct__functions are like%Module{}, but that’s not parseable, so bypass the signatures with a specializedSignatureOverridedecompiler that matches the actual code indefstruct. -
Don’t indent empty lines from
Docsfor@moduledocand@docto match the formatter output. -
Fix capitalization of
Docs@moduledoc@moduleDoc->@moduledoc
A hook for handling very large lists with Phoenix Live View
How to stream very large lists to improve page load & rendering time.
Elixir Wizards S5E7 Jason Axelson on the Elixir Language Server
Latest episode of Elixir Wizards is out today! Check it out here: https://smartlogic.io/podcast/elixir-wizards/s5e7-axelson/
