Contributing

August 5, 2026 ยท View on GitHub

Crates Overview

Our project is organized into several crates:

CrateBadgeDescription
๐Ÿ” emmylua_parseremmylua_parserThe foundational Rust-based Lua parser engineered for maximum efficiency and accuracy. Powers all downstream analysis tools.
๐Ÿ“‘ emmylua_parser_descemmylua_parser_descExtension for EmmyLua-Parser that handles Markdown/RST highlighting in comments.
๐Ÿง  emmylua_code_analysisemmylua_code_analysisAdvanced semantic analysis engine providing deep code understanding, type inference, and cross-reference resolution.
๐Ÿ–ฅ๏ธ emmylua_lsemmylua_lsThe complete Language Server Protocol implementation offering rich IDE features across all major editors.
๐Ÿ“š emmylua_doc_cliemmylua_doc_cliProfessional documentation generator creating beautiful, searchable API docs from your Lua code and annotations.
โœ… emmylua_checkemmylua_checkComprehensive static analysis tool for code quality assurance, catching bugs before they reach production.
๐Ÿงน emmylua_formatteremmylua_formatterThe Lua formatter used by the EmmyLua Analyzer Rust workspace.

Testing

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_parser

If 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)) to assert_eq because 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 a googletest::Result.

  • OrFail::or_fail converts any Optional and Result to a googletest::Result. It also adds current location to an error message. We have a wrapper around it called check!.

Code style and formatting

We use rustfmt and pre-commit to manage project's code style.

  • rustfmt formats Rust code. Simply run cargo fmt --all to reformat all files.

  • pre-commit fixes common issues like trailing whitespaces or broken symlinks in all text files.

    To run it,

    1. install pre-commit,
    2. 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.