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

Add support for dialyzer --incremental when available #2736

Merged
merged 1 commit into from
Aug 27, 2022

Conversation

TD5
Copy link
Contributor

@TD5 TD5 commented Aug 9, 2022

When the environment's OTP version supports dialyzer --incremental (see the PR introducing it), enable an --incremental/-i option to rebar3 dialyzer in order to make it accessible.

In erlang/otp#5997, we added an --incremental option to Dialyzer, however, in order to make good use of it from a rebar3 project, you'd probably want to have a corresponding option in rebar3 dialyzer, which is what I've added here.

This PR introduces quite a bare-bones option, since you could do more in terms of reading incrementality-specific metrics from Dialyzer and reporting them, but it at least allows some early experimentation when it detects an appropriate bleeding-edge OTP version with the necessary features. For older OTP versions, users won't see this option, so nothing should change from their perspective.

As a point of comparison, when running on the rebar3 project itself, running Dialyzer the usual way without incrementality, the first run takes 2.25 mins, and a second run takes 25 secs. When using --incremental, it takes 1.5 mins, going down to 6 seconds on a re-run. Of course, your milage will very definitely vary depending on machine's performance/load, the changes you make between Dialyzer analyses, and the structure of the project you run it on.

N.B. I also clarified the Resolving files... log line, since before it sort of implied the same work was being done twice, which isn't a good look for an "incremental" mode 😉

@ferd
Copy link
Collaborator

ferd commented Aug 9, 2022

Looks like a good idea. A test may be tricky to put in place but worth it (maybe behind a version/dynamic switch). It seems like Dialyzer is failing on OTP-25. Not sure why, I'm assuming the typing is blowing up because of unsupported options? may be worth ignoring warnings if that's the actual reason.

@TD5
Copy link
Contributor Author

TD5 commented Aug 9, 2022

I'm assuming the typing is blowing up because of unsupported options

Yes, this is the case. I've got a PR I am about to submit to OTP to resolve that part. (EDIT: see erlang/otp#6207)

A test may be tricky to put in place but worth it

I agree, I'll see what I can do.

@TD5
Copy link
Contributor Author

TD5 commented Aug 10, 2022

Okay, I've suppressed that Dialyzer warning for now, and commented next to it with a link to the PR to fix it. I've also added unit tests around incremental mode which are skipped if the current OTP version does not support incrementality.

When the OTP version supports `dialyzer --incremental`,
enable an `--incremental`/`-i` options to `rebar3 dialyzer`
in order to make it accessible.
@TD5
Copy link
Contributor Author

TD5 commented Aug 26, 2022

@ferd, what are your thoughts on the state of this PR now?

@ferd ferd merged commit b5605ff into erlang:main Aug 27, 2022
@TD5 TD5 deleted the incremental branch August 27, 2022 09:59
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