Overview
emmylua_check is a command-line static analysis tool that performs comprehensive code checking on Lua projects. It reports syntax errors, type mismatches, undefined variables, and other potential issues without requiring an editor.
Installation
Basic Usage
Command-Line Options
Positional Arguments
One or more paths to workspace directories to analyze.
Example Usage
Example Usage
Configuration Options
Comma-separated list of configuration file paths.If not provided, the tool searches for
.emmyrc.json, .emmyrc.lua, or .luarc.json in the workspace directory.Example Usage
Example Usage
Comma-separated list of glob patterns to ignore during analysis.
Example Usage
Example Usage
Output Options
Specify the output format for diagnostics.Available values:
text- Human-readable text format (default)json- Structured JSON outputsarif- SARIF format (Static Analysis Results Interchange Format)
Example Usage
Example Usage
Specify output destination. Use
stdout for standard output or a file path.Only used when --output-format is json or sarif.Example Usage
Example Usage
Behavior Options
Enable verbose output with detailed progress information.
Verbose output includes:
Example Usage
Example Usage
- File-by-file progress
- Configuration detection details
- Workspace loading information
- Detailed timing information
Treat all warnings as errors, causing the check to fail on warnings.
Useful for:
Example Usage
Example Usage
- CI/CD pipelines requiring zero warnings
- Enforcing strict code quality standards
- Pre-commit hooks
Output Formats
Text Format (Default)
Human-readable output optimized for terminal display:JSON Format
Structured JSON output for tooling integration:SARIF Format
SARIF (Static Analysis Results Interchange Format) for integration with GitHub, Azure DevOps, and other platforms:- GitHub Code Scanning
- Azure DevOps
- Visual Studio
- Other SARIF-compatible tools
Exit Codes
The tool uses exit codes to indicate the result of the analysis:0- Success: No errors found (warnings may exist)1- Failure: Errors detected or fatal error occurred
--warnings-as-errors is enabled, warnings also cause exit code 1.
Exit Code Examples
Exit Code Examples
CI/CD Integration
GitHub Actions
GitLab CI
Azure Pipelines
Jenkins
Common Workflows
Pre-commit Hook
Add to.git/hooks/pre-commit:
Make Target
Add to yourMakefile:
npm/package.json Script
Advanced Usage
Large Codebases
For large projects, optimize performance with ignore patterns:Multi-project Monorepos
Analyze multiple independent projects:Custom Configuration
Create.emmyrc.json in your workspace:
Integration with Other Tools
Troubleshooting
No files analyzed
No files analyzed
Check workspace path:Check ignore patterns:
- Ensure ignore patterns aren’t excluding all files
- Review
.emmyrc.jsonconfiguration
Configuration not detected
Configuration not detected
Verify config file location:Validate JSON syntax:
Too many false positives
Too many false positives
Adjust diagnostic severity:Create or modify Add type annotations:
.emmyrc.json:- Use EmmyLua annotations to provide type information
- This reduces false positives significantly
Slow analysis
Slow analysis
Optimize with ignore patterns:Analyze specific directories:Use multiple processes:
See Also
- emmylua_ls - Language server for editor integration
- emmylua_doc - Documentation generator
- Configuration Reference - Workspace configuration options
- Diagnostics Guide - Understanding diagnostic messages
