diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbc6948..22e5fa4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,8 +14,7 @@ jobs: matrix: os: [ubuntu-20.04] python-version: ['3.8'] - toxenv: [django32, django42, docs, quality] - + toxenv: [django32, django42, docs, quality, check_keywords] steps: - uses: actions/checkout@v4 - name: setup python diff --git a/Makefile b/Makefile index 053dab9..c731d56 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: clean coverage docs help quality requirements test test-all upgrade +.PHONY: clean coverage docs help quality requirements test test-all upgrade check_keywords .DEFAULT_GOAL := help @@ -75,3 +75,6 @@ diff_cover: test test-all: ## run tests on every supported Python/Django combination tox -e quality tox + +check_keywords: ## Scan the Django models in all installed apps in this project for restricted field names + python manage.py check_reserved_keywords --override_file db_keyword_overrides.yml diff --git a/db_keyword_overrides.yml b/db_keyword_overrides.yml new file mode 100644 index 0000000..dcc39cd --- /dev/null +++ b/db_keyword_overrides.yml @@ -0,0 +1,10 @@ +# This file is used by the 'check_reserved_keywords' management command to allow specific field names to be overridden +# when checking for conflicts with lists of restricted keywords used in various database/data warehouse tools. +# For more information, see: https://github.com/edx/edx-django-release-util/release_util/management/commands/check_reserved_keywords.py +# +# overrides should be added in the following format: +# - ModelName.field_name +--- +MYSQL: +SNOWFLAKE: +STITCH: diff --git a/tox.ini b/tox.ini index ae42f34..47c34d9 100644 --- a/tox.ini +++ b/tox.ini @@ -51,3 +51,13 @@ commands = isort --check-only web_fragments manage.py setup.py test_settings.py make help +[testenv:check_keywords] +setenv = + DJANGO_SETTINGS_MODULE = test_settings + PYTHONPATH = {toxinidir} +allowlist_externals = + make +deps = + -r{toxinidir}/requirements/test.txt +commands = + make check_keywords