Skip to content

Conversation

@tompave
Copy link

@tompave tompave commented Nov 1, 2016

At the moment using this library in a phoenix project will raise this warning on (re)compilation:

warning: the variable "children" is unsafe as it has been set inside a case/cond/receive/if/&&/||. Please explicitly return the variable value instead. For example:

    case int do
      1 -> atom = :one
      2 -> atom = :two
    end

should be written as

    atom =
      case int do
        1 -> :one
        2 -> :two
      end

Unsafe variable found at:
  lib/my_app_name/react_io.ex:2

where lib/my_app_name/react_io.ex has these contents:

defmodule MyAppName.ReactIo do  
  use StdJsonIo, otp_app: :my_app_name, script: "node_modules/react-stdio/bin/react-stdio"
end 

This is because of Elixir's new stricter checks on variable re-binding inside conditionals.

This PR extracts the logic to add the reloader spec in a separate function, to improve the organization of the init/1 function and to silence the "unsafe variable assignment" warnings.

…o improve the organization of the init/1 function and to silence the "unsafe variable assignment" warnings.
@gogocurtis
Copy link

+1

@tompave
Copy link
Author

tompave commented Jan 19, 2017

bump

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