This document covers advanced configuration options for goLLM, including custom rules, plugins, and integration settings.
rules
directory in your project rootBaseRule
Example custom rule (rules/custom_rules.py
):
from gollm.rules.base import BaseRule
class NoPrintStatementsRule(BaseRule):
"""Custom rule to forbid print statements."""
id = "no-print"
description = "Forbid print statements"
def check_node(self, node, filename):
if isinstance(node, ast.Print):
self.report_error(
node.lineno,
"Print statements are not allowed. Use logging instead."
)
Add your custom rules to gollm.json
:
{
"custom_rules": [
"rules.custom_rules.NoPrintStatementsRule"
]
}
goLLM supports plugins to extend functionality. Plugins can add new commands, rules, and integrations.
my_plugin/
├── __init__.py
├── commands.py
└── rules.py
{
"plugins": [
"my_plugin"
]
}
You can have different configurations for different environments:
# gollm.dev.json
gollm --config gollm.dev.json
# gollm.prod.json
gollm --config gollm.prod.json
{
"cache": {
"enabled": true,
"directory": ".gollm/cache",
"ttl": 3600
}
}
{
"performance": {
"max_workers": 4,
"chunk_size": 100
}
}
{
"secrets": {
"backend": "env",
"env_prefix": "GOLLM_"
}
}
{
"ssl": {
"enabled": true,
"cert_file": "/path/to/cert.pem",
"key_file": "/path/to/key.pem",
"verify": true
}
}
{
"logging": {
"level": "INFO",
"file": "gollm.log",
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
}
}
Create a new command:
from gollm.cli import command
@command("my-command")
def my_command(args):
"""My custom command."""
print("Running my custom command!")
Create a custom output formatter:
from gollm.formatters import BaseFormatter
class MyFormatter(BaseFormatter):
def format(self, results):
return "\n".join(f"{r.filename}:{r.line} - {r.message}" for r in results)
Check version compatibility:
gollm check-version
Migrate configuration between versions:
gollm migrate-config