No dependency is fetched from git
elixir/no-git-dependencies@v1
No dependency the project declares is fetched from a git repository.
| Id | elixir/no-git-dependencies |
| Version | v1 |
| Category | elixir |
| Default severity | warning |
| Interpreter | python3 |
| Timeout | 30 seconds |
| Violations tolerated | 0 |
| Collects | elixir |
Collectors
This guardrail gathers nothing itself. It depends on the collectors below, which the CLI runs once per build before any check, and reads what they found out of GUARDRAIL_FACTS. A collector that collects nothing skips this guardrail rather than failing it.
| Collector | Gathers | Inputs it is given |
|---|---|---|
elixir | The Mix build in the project directory: the application it declares, the Elixir version it asks for, every application of an umbrella, the dependencies each manifest names with their environments and origins, and the lock file beside them. mix.exs is Elixir rather than a declaration, so what it declares conditionally is not seen and scanned says so. | projectDir |
The inputs above are this guardrail's own, passed straight through. Configuring one in buildnote.json changes what is collected, and two guardrails configured the same way share the one collection.
Configuration
{
"guardrails": {
"failOn": "error",
"comment": true,
"checks": [
{
"use": "elixir/no-git-dependencies@v1",
"severity": "warning",
"with": {
"projectDir": "."
},
"exemptions": []
}
]
}
}Inputs
| Input | Description | Default | Environment variable |
|---|---|---|---|
projectDir | Directory holding the project, relative to the directory the CLI runs in. | . | GUARDRAIL_INPUT_PROJECTDIR |
How to fix
Take the dependency from Hex rather than from a repository:
{:widget_ui, "~> 1.4"}Where the package is yours and unpublished, publish it to a private Hex organisation. A git: or github: tuple tracks a branch whoever owns it can move or force push, and it is compiled from source at fetch time rather than taken from a release Hex has published and checksummed, so two builds of the same commit can compile different code.
More in elixir
elixir/lockfile-committed. The project commitsmix.lock, so a fetch of the same commit resolves the same packages and verifies them.elixir/version-declared. The project declares the Elixir version it is compiled against, and that version is no older than the configured floor.