| Crates.io | blazelint |
| lib.rs | blazelint |
| version | 0.3.0 |
| created_at | 2025-10-12 19:50:15.033908+00 |
| updated_at | 2025-11-22 07:36:27.365118+00 |
| description | A code linter for Ballerina programming language |
| homepage | https://github.com/RuztyCrabs/Blazelint |
| repository | https://github.com/RuztyCrabs/Blazelint |
| max_upload_size | |
| id | 1879630 |
| size | 1,392,831 |
[!WARNING] This is a University Research Project and SHOULD NOT BE USED ON PRODUCTION ENVIRONMENTS. The goal is to determine the feasibility, performance and developer experience of Rust Programming Language for implementing static code analyzers for Ballerina Language.
Install the latest published version from crates.io:
cargo install blazelint
Pre-build binaries are available for Linux from the latest GitHub release.
Windows and MacOS binaries will be added in a later release.
Analyze a Ballerina source file by passing its path to blazelint:
blazelint path/to/file.bal
[!NOTE] Use the limited subset document in the BNF when defining Ballerina syntax to be linted.
The tool prints the input program, a token stream, the parsed AST, and exits or emits diagnostics if there is any and exits with a non-zero status.
Running from a checked-out repository is also supported:
cargo run -- path/to/file.bal
[!NOTE]
cargo runbuilds and executes an unoptimized build (for debug requirements). Always usecargo build --releasefor any benchmark or observations on performance.
For a quick smoke test, you can reuse the sample program in tests/test-bal-files/:
blazelint tests/test-bal-files/simple_errors.bal
Blazelint looks for a .blazerc configuration file in the current directory or any parent directory. The configuration uses TOML format:
# .blazerc - Blazelint Configuration File
[rules]
# Naming convention rules
camel-case = "error" # Enforces camelCase for variables/functions
constant-case = "warn" # Enforces SCREAMING_SNAKE_CASE for constants
# Code style rules
line-length = "warn" # Limits line length
max-function-length = "error" # Limits function body length
missing-return = "error" # Ensures functions have return statements
unused-variables = "warn" # Detects unused variable declarations
# Disable specific rules
some-rule = "off"
[settings]
max-line-length = 120 # Maximum characters per line
max-function-length = 50 # Maximum lines in function body
Each rule can be configured with one of these severity levels:
"error" - Causes build failure (non-zero exit code)"warn" - Shows warnings but allows build to succeed"info" - Shows informational messages"off" - Disables the rule completely| Rule | Description | Default Severity | Settings |
|---|---|---|---|
camel-case |
Enforces camelCase naming for variables and functions | error |
None |
constant-case |
Enforces SCREAMING_SNAKE_CASE for constants | warn |
None |
line-length |
Limits line length | warn |
max-line-length |
max-function-length |
Limits function body length | warn |
max-function-length |
missing-return |
Ensures functions have return statements | error |
None |
unused-variables |
Detects unused variable declarations | warn |
None |
Blazelint searches for .blazerc files in this order:
./.blazerc.blazercThe rule engine features:
A pre-configured Dev Container is available that can be used to investigate, develop or debug the program without installing anything on the host machine.
It can be launched and used fully remotely inside a browser using GitHub codespaces, or locally using Visual Studio Code.
The container comes with:
The project uses the following key dependencies:
serde, toml for config file parsingonce_cell, thiserror for error handling and cachingassert_cmd, tempfile for integration testsCreate a fork and clone to local:
git clone https://github.com/<your-profile-name>/Blazelint.git
cd into the directory:
cd Blazelint
Build with cargo:
cargo build --release
tests/test-bal-files/ files if you need to debug a specific diagnostic..blazerc config file to test configuration changes.ctrl+shift+D to jump to debug menu.[!NOTE] It is possible to debug with any IDE including Neovim, Emacs and etc but we recommend Visual Studio Code for easier setup.
Changes should be developed and push to following branches based on the area of the feature.
Run all formatter, lint, and test checks locally before opening a pull request:
bash scripts/check.sh
BlazeLint uses a tag-driven release workflow for simplicity. To cut a new release:
1.2.3).Cargo.toml (or use the existing bump workflow via GitHub UI if preferred).bash scripts/check.sh
main.v):
git tag -a v1.2.3 -m "Release v1.2.3"
git push origin v1.2.3
Publish crate (release-crate.yml) will:
Cargo.toml.CRATES_IO_TOKEN secret).You can simulate locally before tagging:
cargo publish --dry-run
v*.*.* (e.g. v0.3.1).Cargo.toml version, the build fails early.bump-version.yml + PR + tag) still work if you prefer that path.For multi-platform binaries, extend simple-release.yml with matrix builds and upload additional artifacts.
When adding a new linter rule:
LintRule trait in src/linter/rules/src/lib.rsConfig::default() in src/config.rsWhen modifying configuration:
src/config.rsConfig::default()validate_config()Roadmap of the project can be viewed from here.
This project is licensed under the MIT License.