Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable eqwalizer #70

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Enable eqwalizer #70

wants to merge 8 commits into from

Conversation

erszcz
Copy link
Member

@erszcz erszcz commented Mar 20, 2024

This PR enables WhatsApp's eqWAlizer and fixes all errors it reports in exml. It's also intended as a tech spike to familiarise with eqwalizer and its capabilities.

All in all, the impression is very good - the typechecker is fast, reliable, easy to integrate with editor/IDE. Definitely recommended 馃憤

One shortcoming I found is that eqwalizer doesn't report redundant spec clauses. Dialyzer, however, seems to catch such cases if they're left after making a project eqwalizer clean, so the combo of both tools offers a comprehensive safety harness.

I'm creating this PR as a preview, not to force inclusion of eqwalizer in all our projects.

This is tricky, but the result might actually be a cdata in the unlikely case
the cdata content matches some element name, like this:

  <elem>elem</elem>

Check it like this:

  > {ok, Elem} = exml:parse(<<"<elem>elem</elem>">>).
  ...
  > exml_query:subelement(Elem, <<"elem">>, default).
  #xmlcdata{content = <<"elem">>}

This is because #xmlel.name is just an index and both #xmlel{} and #xmlcdata{} records
do have a field with this index - it's just different fields.

So the spec should properly specify this function can technically return a cdata...
Or we can make sure it's a #xmlel{} by matching on Result.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant