Skip to content

Latest commit

 

History

History
77 lines (50 loc) · 4.52 KB

File metadata and controls

77 lines (50 loc) · 4.52 KB

Contributing

Crates Overview

Our project is organized into several crates:

Crate Badge Description
🔍 emmylua_parser emmylua_parser The foundational Rust-based Lua parser engineered for maximum efficiency and accuracy. Powers all downstream analysis tools.
📑 emmylua_parser_desc emmylua_parser_desc Extension for EmmyLua-Parser that handles Markdown/RST highlighting in comments.
🧠 emmylua_code_analysis emmylua_code_analysis Advanced semantic analysis engine providing deep code understanding, type inference, and cross-reference resolution.
🖥️ emmylua_ls emmylua_ls The complete Language Server Protocol implementation offering rich IDE features across all major editors.
📚 emmylua_doc_cli emmylua_doc_cli Professional documentation generator creating beautiful, searchable API docs from your Lua code and annotations.
emmylua_check emmylua_check Comprehensive static analysis tool for code quality assurance, catching bugs before they reach production.

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.