This directory contains development tools for the Zane project.
Automatically validates C++ code against Zane coding standards.
Usage:
# Check all files in src/
python tools/check_style.py
# Check specific file
python tools/check_style.py src/module/console.cpp
# Check specific directory
python tools/check_style.py src/moduleWhat it checks:
- ✅ Methods use camelCase (not PascalCase)
- ✅ Member variables use
m_prefix - ✅ Pointer parameters use
p_prefix - ✅ Use
int32_tinstead ofint - ✅ Static variables use
s_prefix
Exit codes:
0- All checks passed1- Style violations found
Automatically checks coding style before allowing commits.
Installation:
python tools/install_hooks.pyFeatures:
- 🔍 Automatically runs on
git commit - 📝 Only checks staged C++ files
- ⚡ Fast - only validates changed files
- 🚫 Blocks commits with style violations
Skip the check (when needed):
git commit --no-verifyInstalls Git hooks for the project.
Usage:
python tools/install_hooks.pyExtracts Temporal API shims from V8 library.
-
Install Git hooks:
python tools/install_hooks.py
-
Check your code:
python tools/check_style.py
-
Fix any violations reported by the checker
-
Commit your changes:
git add . git commit -m "Your message"
The pre-commit hook will automatically validate your code!
For detailed coding standards, see:
- CODING_STYLE_en.md - English
- CODING_STYLE_vi.md - Tiếng Việt
Naming Conventions:
- Methods:
camelCase(e.g.,readFile,setTimeout) - Member variables:
m_prefix (e.g.,m_count,m_data) - Pointer parameters:
p_prefix (e.g.,p_isolate,p_context) - Static variables:
s_prefix (e.g.,s_instance) - Shared pointers:
sp_prefix (e.g.,sp_task) - Unique pointers:
up_prefix (e.g.,up_timer)
Type System:
- Use
int32_tinstead ofint - Use
uint32_tinstead ofunsigned int - Be explicit with integer sizes
The style checker can be integrated into CI/CD pipelines:
# Example GitHub Actions workflow
- name: Check Coding Style
run: python tools/check_style.py- Run the checker frequently during development
- Install the pre-commit hook to catch issues early
- Use
--no-verifysparingly - only when you have a good reason - Keep the coding standards document open while coding
Hook not running?
- Make sure you installed it:
python tools/install_hooks.py - Check
.git/hooks/pre-commitexists
Too many warnings?
- Focus on errors first (marked with ❌)
- Warnings (
⚠️ ) are suggestions, not requirements
False positives?
- The checker uses heuristics and may have false positives
- Report issues or improve the checker script
To improve these tools:
- Edit the tool script
- Test thoroughly
- Update this README if needed
- Submit a pull request
Last Updated: 2026-01-29
Maintainer: Zane Team