vane 0.9.0

A flow-based reverse proxy with multi-layer routing and programmable pipelines.
---
title: Coding Format
description: Coding rules, format and best practices
icon: CodeXml
---

import { Callout } from 'fumadocs-ui/components/callout';

To maintain code quality and long-term readability, all contributions must adhere to the project's coding standards. This guide distills the essential requirements for developing Vane.

<Callout title="Source of Truth">
	For the complete, authoritative list of contribution rules, always refer to
	**[CONTRIBUTING.md](https://github.com/canmi21/vane/blob/latest/CONTRIBUTING.md)** in the project
	root.
</Callout>

## Quality Requirements

- **Lint & Check**: All code must pass the language's default lint or check tools (e.g., `cargo clippy`, `cargo check`) with zero errors.
- **Formatting**: All code must be formatted using the language's default formatter (`cargo fmt`).
- **Language**: All code, comments, and documentation must be written in **English**.

## Structure & Style

### 1. File Headers

Every source file MUST begin with a comment containing the relative path from the project root, followed by a blank line:

```rust
/* src/module/example.rs */

pub fn my_function() { ... }
```

### 2. Contribution Size

- **Focused PRs**: Split large contributions into small, atomic Pull Requests.
- **File Limits**: Single source files should generally stay under **~1000 lines**. Monolithic files should be broken into submodules.

### 3. Commenting Philosophy

- Focus on **Why**, not **What**. Avoid redundant or self-evident comments.
- Only comment where the context is non-obvious or specific technical decisions were made.

## Development Workflow

### AI Agent Usage

LLMs and AI agents may assist in implementation but must remain under your direct control. They cannot be used to unilaterally decide architectural directions. You are responsible for all AI-generated output.

### Tests & Changelog

- **Tests**: New features must include appropriate tests (Integration, Mocks, or Unit tests).
- **Changelog**: Feature PRs must add an entry to `CHANGELOG.md` under the `## [Unreleased]` section.

## Verification Checklist

Before submitting your code for review, ensure you have:

1.  Run `cargo fmt` and `cargo clippy`.
2.  Verified that all existing and new tests pass.
3.  Included the mandatory file path header.
4.  Updated the `CHANGELOG.md` if applicable.
5.  Updated MDXs in `docs/` if applicable, make sure you follow [Markdown Style](./markdown-style).