Skip to content

Warning on Elixir v1.14 #102

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

Open
thbar opened this issue Aug 17, 2022 · 7 comments
Open

Warning on Elixir v1.14 #102

thbar opened this issue Aug 17, 2022 · 7 comments
Assignees
Milestone

Comments

@thbar
Copy link

thbar commented Aug 17, 2022

I'm doing a bit of preliminary testing with https://github.com/elixir-lang/elixir/releases/tag/v1.14.0-rc.1, and noticed the following warning, so I'm opening an issue to report it :

==> crontab
Compiling 7 files (.ex)
warning: Application.get_env/3 is discouraged in the module body, use Application.compile_env/3 instead
  lib/crontab/scheduler.ex:21: Crontab.Scheduler

Generated crontab app

Apparently not fixed on master:

https://github.com/jshmrtn/crontab/blob/c7641a424abc1191c3bf91ace369350097eb4890/lib/crontab/scheduler.ex#L21

@maennchen
Copy link
Owner

Fixed by 81bd15a

@maennchen maennchen self-assigned this Feb 2, 2023
@sergchernata
Copy link

Looks like the warning is still being triggered:

Compiling 7 files (.ex)
    warning: Application.get_env/3 is discouraged in the module body, use Application.compile_env/3 instead
    │
 21 │     @max_runs Application.get_env(:crontab, :max_runs, 10_000)
    │                           ~
    │
    └─ lib/crontab/scheduler.ex:21:27: Crontab.Scheduler (module)

@thbar
Copy link
Author

thbar commented Mar 28, 2024

Same here! Maybe we can reopen a new issue @sergchernata?

@Hermanverschooten
Copy link

It seems this has been resolved in #116, but there has not been a new release?

@a-maze-d
Copy link

I was looking into this issue, because I got the warning too. It looks like the 1.1.14 release should have fixed the issue (mainline has the new code), and was committed in 2023:

  @max_runs Application.compile_env(:crontab, :max_runs, 10_000)

But the latest release (23rd Oct 2024) does contain the old code:

 # TODO: Remove if when requiring Elixir 1.10 + only
  if function_exported?(Application, :compile_env, 3) do
    @max_runs Application.compile_env(:crontab, :max_runs, 10_000)
  else
    # credo:disable-for-next-line Credo.Check.Warning.ApplicationConfigInModuleAttribute
    @max_runs Application.get_env(:crontab, :max_runs, 10_000)
  end

It's a bit unclear to me why the latest release did not pick up the changes on main. It looks like the release was not made from main :-(

Thus, only a new release should be required to fix the warning (as long as it's made from main :-)

@maennchen
Copy link
Owner

@a-maze-d v1.1.14 was a bug release that only contained #132 backported since the current main is not in shape to be released.

Once #133 is done, I'll do a new release including everything.

@a-maze-d
Copy link

Cool. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants