Skip to content

Rules

Assura provides a comprehensive set of validation rules that can be configured to enforce project standards.

Each rule has a severity level that determines how violations are treated:

  • Critical: Validation fails, must be fixed
  • High: Validation fails, serious issue
  • Medium: Validation fails, default blocking issue
  • Low: Advisory finding, reported without failing the check

All report formats use the same structure severity contract. Violations include severity, severity_label, blocking, rule, message, and corrective_context fields. low sets blocking: false; medium, high, and critical set blocking: true.

Validates that file names follow a specified pattern.

rules:
- name: file-naming
severity: high
pattern: "^[a-z][a-z0-9_]*\\.rs$" # Only lowercase with underscores
message: "File names must be lowercase with underscores"

Analyzes and validates project dependencies.

rules:
- name: dependency-check
severity: critical
check_circular: true # Detect circular dependencies
max_depth: 10 # Maximum dependency depth
forbidden:
- "deprecated_crate"

Enforces file size limits.

rules:
- name: file-size
severity: medium
max_size: "500KB"
include:
- "src/**/*.rs"

Validates maximum line length.

rules:
- name: line-length
severity: low
max_length: 100
ignore_urls: true
ignore_comments: false

Checks for required documentation.

rules:
- name: documentation
severity: medium
require_public: true # Public items must be documented
require_module: true # Modules must have documentation

Validates import statement organization.

rules:
- name: import-order
severity: low
groups:
- "std"
- "external"
- "crate"
- "super"
- "self"
alphabetical: true

Extending Assura

Custom rule APIs are not part of the supported v0.1 public surface. They will be documented when the plugin/runtime extension work is implemented and tested.

rules:
- name: file-naming
severity: medium
pattern: "^[a-z0-9-]+\\.(js|ts|tsx|css|scss)$"
- name: file-size
severity: high
max_size: "1MB"
exclude:
- "**/assets/**/*"
- name: dependency-check
severity: critical
check_circular: true
max_depth: 15
rules:
- name: file-naming
severity: high
pattern: "^[a-z][a-z0-9_]*\\.rs$"
- name: documentation
severity: medium
require_public: true
require_module: true
- name: dependency-check
severity: high
check_circular: true