Gadget

Brujo Benavides

Inaka / Erlang Solutions

The Ultimate Code-Checking Machine

About Me

  • argentino: 36 years
  • programmer: 27 years
  • in the industry: 17 years
  • erlanger: 10 years
  • open-source contributor: 8 years
  • Erlang Trainer: 5 years
  • CTO @ Inaka: 4 years
  • Tech Lead @ Erlang Solutions: 3 years

About Inaka

  • We're based in Argentina
  • We do Erlang consulting
  • We started in 2010, acquired by
    Erlang Solutions in 2014.
  • We build end-to-end applications with
    Erlang, Web, iOS and Android components.
  • We develop highly concurrent application
    servers like Whisper and TigerText.
  • We're active contributors to the
    open-source community

How good is your code?

Does it Compile?

Without warnings?

Which Warnings?

+warn_unused_vars +warn_export_all
+warn_shadow_vars +warn_unused_import
+warn_unused_function +warn_exported_vars
+warn_bif_clash +warn_unused_record
+warn_deprecated_function +warn_export_vars
+strict_validation +warn_obsolete_guard
+warn_missing_spec +warn_untyped_record

Does it have loose ends?

Have you checked with xref?

Running Xref Manually

{ok, Xref} = xref:start(),
ok =
    xref:set_library_path(
        Xref, code:get_path()),
{ok, _Modules} =
    xref:add_directory(Xref, "ebin"),
{ok, Results} =
    xref:analyze(
        Xref, undefined_function_calls),
stopped = xref:stop(Xref),
Results.

With Rebar

$ rebar3 xref

With erlang.mk

$ make xref

With Xref Runner

$ ./xrefr

How do your functions behave?

Do you dialyze your code?

Dialyzer is...

  • SLOW

  • incomprehensible

  • extremely useful!

How does your code look?

Have you ever used...

  • erl_tidy?

  • TidiEr?

  • Elvis?

Keeping your code in shape

Source Control

Code Reviews

But you can't
dialyze
compile
xref

a pull request!!

Gadget!!

Thank You!

elbrujohalcon@inaka.net

elbrujohalcon

@elbrujohalcon

Gadget

By Brujo Benavides

Gadget

The Ultimate Code-Checking Machine

  • 884