build: configurar herramientas de verificación OCA
- Instalar pre-commit con 25 hooks configurados - Configurar black 26.1.0 para formateo de código Python - Configurar isort 7.0.0 para ordenación de imports - Configurar flake8 7.3.0 con flake8-bugbear - Configurar pylint 3.1.1 con pylint-odoo 9.1.2 - Añadir autoflake y pyupgrade para mejoras automáticas - Configurar prettier para formateo de XML/JSON/YAML - Crear .editorconfig para consistencia de editor - Crear Makefile con comandos útiles - Crear check_addon.sh para verificación rápida de addons - Actualizar configuración de VS Code con extensiones recomendadas - Añadir documentación completa de uso - Aplicar formateo automático a archivos existentes - Deshabilitar setuptools-odoo (no soporta Odoo 18.0 aún) - Deshabilitar fix-encoding-pragma (obsoleto, usar pyupgrade)
This commit is contained in:
parent
5b9c6e3211
commit
fe137dc265
224 changed files with 18376 additions and 0 deletions
81
Makefile
Normal file
81
Makefile
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
.PHONY: help
|
||||
help:
|
||||
@echo "Comandos disponibles para verificación de código OCA:"
|
||||
@echo ""
|
||||
@echo " make lint - Ejecutar todas las verificaciones (pre-commit)"
|
||||
@echo " make format - Formatear código (black + isort)"
|
||||
@echo " make check-format - Verificar formateo sin modificar"
|
||||
@echo " make flake8 - Ejecutar flake8"
|
||||
@echo " make pylint - Ejecutar pylint (opcionales y mandatorios)"
|
||||
@echo " make pylint-required - Ejecutar solo verificaciones mandatorias"
|
||||
@echo " make test - Ejecutar tests"
|
||||
@echo " make install-hooks - Instalar pre-commit hooks"
|
||||
@echo " make update-hooks - Actualizar pre-commit hooks"
|
||||
@echo " make clean - Limpiar archivos temporales"
|
||||
@echo ""
|
||||
|
||||
.PHONY: install-hooks
|
||||
install-hooks:
|
||||
pre-commit install
|
||||
|
||||
.PHONY: update-hooks
|
||||
update-hooks:
|
||||
pre-commit autoupdate
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
pre-commit run --all-files
|
||||
|
||||
.PHONY: lint-changed
|
||||
lint-changed:
|
||||
pre-commit run
|
||||
|
||||
.PHONY: format
|
||||
format:
|
||||
black .
|
||||
isort .
|
||||
|
||||
.PHONY: check-format
|
||||
check-format:
|
||||
black --check .
|
||||
isort --check-only .
|
||||
|
||||
.PHONY: flake8
|
||||
flake8:
|
||||
flake8 .
|
||||
|
||||
.PHONY: pylint
|
||||
pylint:
|
||||
@for addon in $$(ls -d */ | grep -v "\."); do \
|
||||
if [ -f "$$addon/__manifest__.py" ] || [ -f "$$addon/__openerp__.py" ]; then \
|
||||
echo "Checking $$addon with pylint..."; \
|
||||
pylint --rcfile=.pylintrc --exit-zero $$addon; \
|
||||
fi \
|
||||
done
|
||||
|
||||
.PHONY: pylint-required
|
||||
pylint-required:
|
||||
@for addon in $$(ls -d */ | grep -v "\."); do \
|
||||
if [ -f "$$addon/__manifest__.py" ] || [ -f "$$addon/__openerp__.py" ]; then \
|
||||
echo "Checking $$addon with pylint (mandatory checks)..."; \
|
||||
pylint --rcfile=.pylintrc-mandatory $$addon; \
|
||||
fi \
|
||||
done
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
@echo "Ejecutar tests de Odoo aquí"
|
||||
@echo "Por ejemplo: pytest o python -m pytest"
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
find . -type f -name '*.pyc' -delete
|
||||
find . -type d -name '__pycache__' -delete
|
||||
find . -type d -name '*.egg-info' -exec rm -rf {} + || true
|
||||
find . -type d -name '.pytest_cache' -exec rm -rf {} + || true
|
||||
find . -type d -name '.tox' -exec rm -rf {} + || true
|
||||
rm -rf build/ dist/
|
||||
|
||||
.PHONY: requirements
|
||||
requirements:
|
||||
pre-commit run setuptools-odoo-get-requirements --all-files
|
||||
Loading…
Add table
Add a link
Reference in a new issue