Rules
Assura provides a comprehensive set of validation rules that can be configured to enforce project standards.
Severity Levels
Section titled “Severity Levels”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.
Built-in Rules
Section titled “Built-in Rules”file-naming
Section titled “file-naming”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"dependency-check
Section titled “dependency-check”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"file-size
Section titled “file-size”Enforces file size limits.
rules: - name: file-size severity: medium max_size: "500KB" include: - "src/**/*.rs"line-length
Section titled “line-length”Validates maximum line length.
rules: - name: line-length severity: low max_length: 100 ignore_urls: true ignore_comments: falsedocumentation
Section titled “documentation”Checks for required documentation.
rules: - name: documentation severity: medium require_public: true # Public items must be documented require_module: true # Modules must have documentationimport-order
Section titled “import-order”Validates import statement organization.
rules: - name: import-order severity: low groups: - "std" - "external" - "crate" - "super" - "self" alphabetical: trueCustom Rules
Section titled “Custom Rules”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.
Rule Configuration Examples
Section titled “Rule Configuration Examples”Web Development Project
Section titled “Web Development Project”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: 15Rust Library Project
Section titled “Rust Library Project”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