My solutions to Advent of Code challenges, implemented in Elixir.
lib/
├── year_YYYY/
│ └── day_N.ex # Solutions for each day
├── infrastructure/ # Shared utilities
│ ├── common_helpers.ex
│ └── input_file_loader.ex
└── mix/tasks/ # Custom mix tasks
├── setup_day_challenge.ex
└── run_day_challenge.ex
This project includes a set of tools to ensure code quality and consistency. These tools are configured to run automatically on save, giving you immediate feedback as you work.
- Code formatting with Elixir Formatter
It ensures any code follows a consistent style. The Elixir Formatter is set to run automatically on save, formatting your code to follow standard Elixir conventions.
The .formatter.exs file controls settings, and auto-formatting is enabled in .vscode/settings.json.
- Linting with Credo
It enforces best practices and code consistency by highlighting potential readability and maintainability issues. Credo runs automatically on save through ElixirLS, displaying warnings and suggestions directly in the editor. You can also run mix credo in the terminal for a complete linting check.
- Type Checking and Error Reporting with Dialyzer
It analyzes code for type errors and potential bugs, offering an additional layer of safety. Dialyzer is integrated with ElixirLS, running in the background and reporting issues as you work. The initial setup may take a few minutes, as it builds a PLT (Persistent Lookup Table) with necessary type information.
Requirements:
- Open the project in VS Code
- Select "Reopen in Container" when prompted (or use Command Palette:
Dev Containers: Reopen in Container) - Dependencies install automatically via
postCreateCommand
Requires Elixir 1.19+ with OTP 28.
mix deps.getmix setup_day_challenge 2025 1Creates lib/year_2025/day_1.ex, test/year_2025/day_1_test.exs and lib/year_2025/inputs/day_1/input.txt.
mix run_day_challenge 2025 1Running the mix task will run each part of the day (if available) otherwise, we can pass a part. The output will generate something like
Part 1: 1011
Time: 2.52 ms
Part 2: 5937
Time: 610.0 µsSee LICENSE for details.