Nebo15 / confex

Useful helper to read and use application configuration from environment variables.
Other
304 stars 33 forks source link

fix build warning when compiling the app #30

Closed Adzz closed 5 years ago

Adzz commented 6 years ago

should fix this:

screen shot 2018-06-07 at 13 58 01

AndrewDryga commented 6 years ago

Hello, @Adzz! This is your first Pull Request that will be reviewed by Ebert, an automatic Code Review service. It will leave comments on this diff with potential issues and style violations found in the code as you push new commits. You can also see all the issues found on this Pull Request on its review page. Please check our documentation for more information.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling faded34d81054d5d7cf682ab0cd2faf2f2f2c4df on nested-tech:fix-compilation-warnings into c92fd2eb440bc53a29f2a0097a3be687dc85ad6e on Nebo15:master.

AndrewDryga commented 6 years ago

Hey @Adzz. The test won't work after your fix because we are using doctests and they are sensitive for additional spaces. I'm pretty sure there is magical fix for this (like using some sigil for doc comment), but not sure which one to use. If you can find a way to fix this - it would be awesome :).

Adzz commented 6 years ago

Ah good point!

@AndrewDryga I can see two simple solutions, which do you prefer?

  1. Don't split the output over two lines
  2. something like this:
    @error_message """
    can not resolve key MY_TEST_ENV value via adapter Elixir.Confex.Adapters.SystemEnvironment
    """
    # ... more code
    """
      iex> :ok = System.delete_env("MY_TEST_ENV")
      ...> Application.put_env(:myapp, :test_var, {:system, :integer, "MY_TEST_ENV"})
      ...> #{__MODULE__}.fetch_env!(:myapp, :test_var)
      ** (ArgumentError) can't fetch value for key `:test_var` of application `:myapp`, #{@error_message}
    """

The other option is to sack of doctests, and use normal tests, but I imagine that's a no!

Sigils wont work. ~S""" means the string wont let you use escape codes, which means we can't escape a new line, which means we have to have one long line anyway.

AndrewDryga commented 6 years ago

Let's leave it in on long line then