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

Igniter expects the definition body of Mix.Project#project to be exactly a keywordlist. #235

Open
franc opened this issue Feb 21, 2025 · 3 comments · May be fixed by #236
Open

Igniter expects the definition body of Mix.Project#project to be exactly a keywordlist. #235

franc opened this issue Feb 21, 2025 · 3 comments · May be fixed by #236
Labels
bug Something isn't working

Comments

@franc
Copy link

franc commented Feb 21, 2025

Describe the bug
In a mix project. If the content of the project function is not a single list, then Igniter can't find the project app and returns an error suggesting that it isn't set.

compiling beacon, beacon_live_admin ✔
** (RuntimeError) Failed to parse the application name from mix.exs.

Please ensure that the `project` function in your mix.exs
file returns a keyword list with an `app` key.

    (igniter 0.5.27) lib/igniter/project/application.ex:36: anonymous fn/1 in Igniter.Project.Application.app_name/1
    (beacon 0.4.1) lib/mix/tasks/beacon.install.ex:93: 

To Reproduce
In a mix project:

def project do
  version = "0.0.0"
  [
      app: :my_app,
      version: version,
      aliases: aliases(),
      deps: deps()
  ]
end

Expected behavior
I didn't expect that anything would care about anything other than the return value of a function.
Either Igniter should look for the last list in the project function definition,
or - ideally - the return value of the function,
or at least have an error message that states that it expects the body of the project function definition to only be a keyword list.

** Runtime

  • Elixir version 1.17.3
  • Erlang version OTP 27
  • Igniter version 0.5.27

Additional context
Encountered trying to install BeaconCMS

@franc franc added the bug Something isn't working label Feb 21, 2025
@zachdaniel
Copy link
Contributor

Yeah, we can solve this particular issue by using Zipper.rightmost to handle this case.

@leandrocp
Copy link
Contributor

@zachdaniel does "Igniter should look for the last list in the project function definition" sound good? I can send a PR.

@zachdaniel
Copy link
Contributor

Yeah, the last list could also do it.

leandrocp added a commit to leandrocp/igniter that referenced this issue Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants