Thank you for your interest in contributing to PcapFileEx! This document provides guidelines and instructions for contributors.
- Elixir 1.18+ and OTP 27+
- Rust stable toolchain (for native extensions)
- Git for version control
-
Clone the repository:
git clone https://github.com/lucian/pcap_file_ex cd pcap_file_ex -
Install dependencies:
mix deps.get
-
Compile the project (includes Rust NIFs):
mix compile
Note: First compilation may take a while as Rust dependencies are built.
-
Run tests:
mix test
This project uses Tidewave MCP for deep Elixir runtime integration during development.
You have two options:
Option 1: Background server (no IEx shell)
mix tidewaveOption 2: Interactive IEx shell with MCP server
iex -S mix tidewave-iexBoth start a Bandit server on port 4000 with the Tidewave plug. Use Option 2 when you want both MCP access and an interactive Elixir shell for manual testing.
- Evaluate Elixir code in project context without restarting IEx
- Get documentation for modules and functions instantly
- Find source locations quickly
- Search dependency documentation
- Check application logs with grep filtering
The Rust NIFs live in native/pcap_file_ex/.
Format Rust code:
cargo fmt --manifest-path=native/pcap_file_ex/Cargo.tomlLint with Clippy:
cargo clippy --manifest-path=native/pcap_file_ex/Cargo.toml -- -DwarningsRun Rust tests:
cargo test --manifest-path=native/pcap_file_ex/Cargo.tomlThis project uses both example-based and property-based testing:
All tests (303 total):
mix testExample-based tests only (193 tests):
mix test --exclude propertyProperty-based tests only (94 properties):
mix test test/property_test/CI mode (1000 iterations per property instead of 100):
CI=true mix test- Example tests:
test/**/*_test.exs- Specific scenarios with known inputs/outputs - Property tests:
test/property_test/*_property_test.exs- Invariants tested across thousands of random inputs - Generators:
test/support/generators.ex- Reusable data generators for property tests
Format Elixir code:
mix formatVerify formatting (used in CI):
mix format --check-formattedRun with warnings as errors:
mix compile --warnings-as-errorsAlways run mix format and cargo fmt before committing to pass CI checks.
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes with tests:
- Add example tests for specific scenarios
- Consider property tests for invariants
- Update documentation if needed
-
Format your code:
mix format cargo fmt --manifest-path=native/pcap_file_ex/Cargo.toml
-
Ensure tests pass:
mix test cargo clippy --manifest-path=native/pcap_file_ex/Cargo.toml -- -Dwarnings -
Commit your changes:
git add . git commit -m "Brief description of your changes"
-
Push and open PR:
git push origin feature/your-feature-name
Then open a pull request on GitHub with a clear description of your changes.
- Title: Use descriptive titles (e.g., "Add support for PCAPNG comments")
- Description: Explain what changed and why
- Tests: Include tests for new functionality
- Documentation: Update docs if you change public APIs
- Breaking changes: Clearly mark breaking changes in the PR description
- Check existing issues or create one to discuss the feature
- Write tests first (TDD approach recommended)
- Implement the feature
- Update documentation
- Run full test suite
- Open PR
- Write a failing test that reproduces the bug
- Fix the bug
- Verify the test passes
- Check for similar bugs elsewhere
- Open PR with the test and fix
Elixir dependencies:
mix deps.update --all
mix testRust dependencies:
cd native/pcap_file_ex
cargo update
cargo test
cd ../..
mix compile
mix testOur CI runs:
- Elixir tests on multiple Elixir/OTP versions
- Property-based tests with 1000 iterations
- Elixir formatter check
- Rust clippy linting
- Rust formatter check
- Version synchronization check (mix.exs vs Cargo.toml)
Make sure all checks pass before merging.
- Issues: Open an issue on GitHub for bugs or feature requests
- Discussions: Use GitHub Discussions for questions
- Be respectful
- Focus on constructive feedback
- Help others learn and grow
- Report unacceptable behavior to maintainers
Thank you for contributing to PcapFileEx!