Contributing to erldns
View SourceGetting Started
Prerequisites
- Erlang/OTP 27 or 28
- Rebar3
- Git
Setup
Clone the repository:
git clone git@github.com:dnsimple/erldns.git cd erldnsInstall dependencies:
makeTo update dependencies:
rebar3 upgrade --all
Development Workflow
Formatting
Format code before committing:
make format
Linting
Check code style:
make lint
Testing
Run the full test suite:
make test
This runs formatting checks, linting, static analysis (xref, dialyzer), documentation generation, tests (Common Test), and coverage.
Interactive Development
Start an Erlang shell with the application loaded:
rebar3 shell
Release Process
Ensure all tests pass:
make testUpdate
CHANGELOG.md- finalize the## mainsection with the version numberUse semantic versioning: vMAJOR.MINOR.PATCH:
# Example export VERSION=v1.2.3Commit and push:
git commit -a -m "Release $VERSION" git push origin mainWait for CI to complete successfully
Create and push a signed tag:
git tag -a v$VERSION -s -m "Release $VERSION" git push origin --tagsGitHub Actions will automatically publish to Hex.pm
Code Standards
Follow the Inaka Erlang Guidelines as the primary coding convention. The guidelines below supplement and emphasize project-specific patterns.
Erlang Style
- Pattern matching: Prefer pattern matching and function-head dispatch over nested conditionals
- Use
case ... ofor pattern-matching function heads instead ofifexpressions - Use
case {Cond1, Cond2, ...} offor multiple conditionals where it helps instead ofifexpressions
- Use
- Functions: Keep functions short with single responsibilities; break complex logic into helpers
- Traceability: Favour named functions over anonymous ones, as naming enhances debugging
Types & Specs
- Always provide
-specdefinitions for exported functions - Always provide types in record definitions
- Dialyzer is required (runs in CI)
Testing
- Common Test (ct): For unit and integration tests (strictly preferred over
eunit), use parallel test cases when possible.
Observability
- Prefer emitting
telemetryevents under theerldnslist head when needed - Emit logs with
loggersporadically,- Use structured logging with contextual keys:
what: mandatory, should point to an atom with a short explanation of the issuemessage: optional, if present should contain a utf8 binary with a human-friendly explanation
- Provide the log domain in the metadata scoped to this repository (
#{domain => [erldns, ...]})
- Use structured logging with contextual keys:
Commit Messages
Use conventional, descriptive commit messages:
Short summary (<= 72 chars)
Detailed description explaining:
- The reason for the change
- Any side effects
- How it was testedSubmitting Changes
- Format code with
make format - Write tests for your changes, every change should be automatically tested comprehensively
- Ensure
make testpasses locally - Submit a PR targeting
main, CI will run the full test suite automatically