exercism / elixir-analyzer

GNU Affero General Public License v3.0
30 stars 32 forks source link

Rewrite file-sniffer analysis #412

Closed angelikatyborska closed 8 months ago

angelikatyborska commented 10 months ago

Resolves https://github.com/exercism/elixir-analyzer/issues/407

Originally this PR was called:

Rewrite file-sniffer analysis (assert_call should also find calls in function heads)

After a deep dive, I realized that assert_call is already capable of finding calls in function heads.

I have initially made a wrong assumption. I thought that the Kernel module alone is implicitly imported into each new module. That is only partially correct. The Kernel.SpecialForms module is also implicitly imported, with some important differences:

I was also confused which module provides which macro, I thought <<>> and :: comes from Kernel, but it coems from Kernel.SpecialForms

TL;DR: we can use assert_call called_fn name: :<<>> to check for calls of special forms with no problems and no modifications necessary. It is not allowed to overwrite those special forms anyway, so you won't have a conflicting local function.

Related PR: https://github.com/exercism/website-copy/pull/2306

angelikatyborska commented 8 months ago

@jiegillet could you review this one?

jiegillet commented 8 months ago

GitHub doesn't seem to let me re-run the external tests, I can't find the button, I don't know why.

angelikatyborska commented 8 months ago

I can't find the button, I don't know why.

You can only rerun the tests if the latest test run isn't too old... I think maybe 2 or 4 weeks.

jiegillet commented 8 months ago

Ah that makes sense :)