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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable eqwalizer #70

Closed
wants to merge 8 commits into from
Closed

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.

erszcz added 7 commits March 20, 2024 10:53
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.
@erszcz erszcz force-pushed the enable-eqwalizer branch from f1147e8 to 52dc71b Compare March 20, 2024 11:04
@NelsonVides
Copy link

Closing as parts of this PR were merged in #72 (commits were cherry-picked together with other ones).

@NelsonVides NelsonVides deleted the enable-eqwalizer branch December 20, 2024 12:11
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.

2 participants