ash-project / ash-project/igniter

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

Open
#235 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Elixir
Stars
404
Forks
75
Avg merge
9h 58m
Merged PRs (30d)
3

Description

**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

Contributor guide

Open the contributing guide

Research direction

Start at lib/igniter/project/application.ex:36, where app_name/1 fails while parsing mix.exs, and reproduce the issue with the shown project function containing a version variable. Compare the parser's behavior with the expected function return value; done means valid project functions no longer fail to identify the app, or the error clearly documents the supported form.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.