Our project is organized into several crates:
| Crate | Badge | Description |
|---|---|---|
| 🔍 emmylua_parser | The foundational Rust-based Lua parser engineered for maximum efficiency and accuracy. Powers all downstream analysis tools. | |
| 📑 emmylua_parser_desc | Extension for EmmyLua-Parser that handles Markdown/RST highlighting in comments. | |
| 🧠 emmylua_code_analysis | Advanced semantic analysis engine providing deep code understanding, type inference, and cross-reference resolution. | |
| 🖥️ emmylua_ls | The complete Language Server Protocol implementation offering rich IDE features across all major editors. | |
| 📚 emmylua_doc_cli | Professional documentation generator creating beautiful, searchable API docs from your Lua code and annotations. | |
| ✅ emmylua_check | Comprehensive static analysis tool for code quality assurance, catching bugs before they reach production. |
We use the standard Rust testing harness, along with assert macros from googletest-rust:
# Run all tests
cargo test
# Run tests for specific crate
cargo test -p emmylua_parserIf you're unfamiliar with googletest-rust, here's a quick overview:
-
Use
googletest::prelude::*in your test modules, and annotate test functions with#[gtest]. -
assert_that!checks a condition and panics on error:assert_that!(2 * 2, eq(4));
Prefer
assert_that!(x, eq(y))toassert_eqbecause the former generates a nice diff for you. -
expect_that!checks a condition, marks test as failed on error, and continues execution.This is useful when adding multiple test cases to a single
#[gtest]function:// Both expectations will be evaluated and reported when test fails: expect_that!(2 * 2, ne(4)); expect_that!(3 * 3, ne(9));
-
verify_that!checks a condition and returns agoogletest::Result. -
OrFail::or_failconverts anyOptionalandResultto agoogletest::Result. It also adds current location to an error message. We have a wrapper around it calledcheck!.
We use rustfmt and pre-commit to manage project's code style.
-
rustfmtformats Rust code. Simply runcargo fmt --allto reformat all files. -
pre-commitfixes common issues like trailing whitespaces or broken symlinks in all text files.To run it,
- install
pre-commit, - invoke
pre-commit run --all.
If it suits your workflow, you can configure PreCommit to run before every commit. To do so, run
pre-commit install. Note that this is not required because our CI will detect any issues. - install