🤝 Contributing
Local Development
To set up a development environment, clone the repository and install the dependencies:
pip install dev-requirements.txt
bot_formatter your_file.py
Test Pre-Commit Hook
To test the pre-commit hook locally, first get your last commit hash:
git rev-parse HEAD
.pre-commit-config.yaml of your project:
- repo: ../bot-formatter # path to your local bot-formatter
rev: 19295427421e82c67a6423c9e13dd254a2b7bb53 # replace with your last commit hash
hooks:
- id: bot-formatter
Documentation
To build the documentation locally, run:
mkdocs serve --livereload
Add New Formatters
To add a new formatter, follow these steps:
- Go to
bot_formatter/formatters/and locate the appropriate file for your formatter type. - Depending on the type, create a new class or function for your formatter.
- Import and register your formatter in
bot_formatter/formatters/__init__.py. - Update the documentation in
docs/formatters.mdto include your new formatter.
Parameters
Language file formatters receive the following parameters:
lang_keys- Dictionary with a mapping of file names to their keys.lang_content- Dictionary with a mapping of file names to their string content.report-Outputclass used to report issues.
YAML formatters receive the following parameters:
content- String content of the YAML file.