Skip to content

feat(rules): Elixir (Mix) _build and deps - #12

Merged
Finjineersdev merged 1 commit into
mainfrom
feat-rules-elixir-mix
Nov 27, 2026
Merged

Finjineersdev merged 1 commit into
mainfrom
feat-rules-elixir-mix

Conversation

@Finjineersdev

Copy link
Copy Markdown
Owner

What

Adds a rule for Elixir projects built with Mix (mix.exs in the folder):

Path Class Restore
_build Safe mix compile
deps Caution mix deps.get

Both are Mix's own default folders. From https://hexdocs.pm/mix/Mix.Project.html: :deps_path "Defaults to "deps"", and the build path "is built based on the :build_path configuration (which defaults to "_build")".

Why it is safe

  • _build is compiled output; the next mix compile recreates it with no user action.
  • deps needs a download (mix deps.get), so it is Caution: never ticked for the user, and clean needs --include-caution.
  • The guard checks both like every other folder; a deps folder with files git tracks (vendored dependencies) is refused.
  • In an umbrella project the apps share the umbrella's _build and deps (../../_build), so only the top project offers them. The walk does not enter deps, so each dependency's own mix.exs is not reported as a project. Checked by hand on a throwaway umbrella layout: scan found the umbrella (_build Safe, deps Caution) and apps/web with nothing to clean, and no projects inside deps.

Changes

  • engine/rules/elixir.toml (new) and its entry in BUNDLED in opensweep-core/src/rules.rs.
  • Fixtures elixir/match/app and elixir/nomatch/no-mix-file.
  • README "What it cleans" table: an Elixir (Mix) row.
  • docs/RULE-SCHEMA.md, "Contributing a rule": a new rule file must also go in BUNDLED. I missed that at first and only bundled_rules_match_the_rules_folder caught it.
  • tests/snapshots/rules-check.json: 12 rule files, 33 artifacts.

How tested

  • rule_fixtures_produce_the_expected_candidates fails without elixir.toml (fixture folder with no rule) and passes with it.
  • opensweep plan with the built-in catalogue (no --rules) on a throwaway Mix project: allow _build [elixir] Safe.
  • cargo fmt --all --check: ok
  • cargo clippy --all-targets --locked -- -D warnings: ok
  • cargo test --locked: 145 passed, 0 failed
  • cargo run -q -p opensweep-cli -- rules-check rules: 12 rule files, 33 artifacts: ok
  • cd CleanCore && swift test: 21 tests, 0 failures; scripts/check-swift-never-deletes.sh: ok

RULE-SCHEMA asks for two reviewers on rule changes.

🤖 Generated with Claude Code

A Mix project (mix.exs) builds into _build and fetches dependencies into
deps; those are Mix's defaults ("defaults to _build", "Defaults to deps",
https://hexdocs.pm/mix/Mix.Project.html). _build is Safe: the next
compile recreates it. deps is Caution: it needs `mix deps.get` (a
download) first, so it is never ticked for the user. An umbrella's apps
share the umbrella's folders, so only the top project offers them, and
the walk never enters deps, so the dependencies' own mix.exs files are
not reported as projects.

Adds elixir.toml to BUNDLED, match and nomatch fixtures, the README
table row, and a line in RULE-SCHEMA.md that new files go in BUNDLED
(bundled_rules_match_the_rules_folder fails otherwise).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Finjineersdev
Finjineersdev merged commit 2100185 into main Nov 27, 2026
6 checks passed
@Finjineersdev
Finjineersdev deleted the feat-rules-elixir-mix branch November 27, 2026 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant