Skip to main content
This project enforces strict code quality standards to maintain a clean, maintainable codebase.

Strict linting policy

Erst uses a zero-tolerance approach to code quality:
  • No unused variables, imports, or functions
  • No dead code (unless explicitly justified)
  • All warnings treated as errors in CI
  • Fail-fast enforcement across all environments
The CI pipeline will fail immediately on any linting warnings. Always run strict linting locally before pushing.

Go code standards

Formatting

All Go code must be formatted with gofmt before committing:

Linting

Must pass golangci-lint without errors. The project uses a minimal but strict configuration:
See .golangci.yml for the complete configuration. Enabled linters include: ineffassign, govet, and typecheck.

Naming conventions

  • Exported identifiers: Use PascalCase for types, functions, and constants
  • Unexported identifiers: Use camelCase
  • Constants: Use UPPER_SNAKE_CASE
  • Interfaces: Should end with -er suffix (e.g., Reader, Writer, Logger)

Error handling

Follow Go’s explicit error handling patterns:

Documentation

All exported functions and types must have documentation comments:
Comments should be complete sentences starting with the name of the item being documented.

Rust code standards

Formatting

All Rust code must be formatted with cargo fmt before committing:

Linting

Must pass cargo clippy with strict settings:
The project enforces strict lint levels in simulator/Cargo.toml:

Naming conventions

  • Functions and variables: Use snake_case
  • Types and traits: Use PascalCase
  • Constants: Use UPPER_SNAKE_CASE

Error handling

Prefer Result<T, E> over panics:
Avoid using .unwrap() in production code except for obvious invariants. Prefer ? operator or explicit error handling.

Documentation

Document all public functions with doc comments:

Running strict linting

Go linting only

This runs:
  • golangci-lint with strict settings
  • go vet static analysis
  • Maximum issues per linter: 0
  • Maximum same issues: 0

Rust linting only

This runs:
  • cargo clippy with all warnings as errors
  • Pedantic and nursery lints enabled
  • Dead code detection
  • Unused variable detection

All strict linting

Runs both Go and Rust strict linting in sequence.

Suppressing false positives

Lints should only be suppressed when they are objectively false positives.

When to suppress

  • Generated code that cannot be modified
  • External dependencies with unavoidable warnings
  • Legitimate cases where the lint rule doesn’t apply

Go suppression

Use //nolint comments sparingly and always with justification:

Rust suppression

Use #[allow] attributes with clear justification:
Never suppress lints without a clear, documented reason. If you can’t explain why it’s necessary, fix the code instead.

Important guidelines

  • No emojis: Commit messages and PR titles should not contain emojis
  • No vague language: Avoid messages like “fixes stuff” or “updates things”
  • Clear messages: Every commit should have a clear, descriptive message
  • Defensive programming: Write code defensively, validate inputs, handle edge cases
  • Lint-free code: Only suppress linting errors if they are objectively false positives

Pre-commit hooks

Install pre-commit hooks to catch issues before committing:
The pre-commit configuration runs:
  • golangci-lint with strict settings
  • go vet
  • cargo clippy with strict settings
  • cargo fmt check
  • go fmt check