diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3109e175..2b2ad423 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: matrix: os: [ubuntu-20.04] python-version: ['3.8'] - toxenv: [django22, django30, django31, django32, quality, pii-annotations] + toxenv: [django22, django30, django31, django32, quality, pii-annotations, check_keywords] steps: - uses: actions/checkout@v2 diff --git a/Makefile b/Makefile index 4f593c21..9c99dc10 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: clean compile_translations coverage diff_cover docs dummy_translations \ extract_translations fake_translations help pii_check pull_translations push_translations \ - quality requirements selfcheck test test-all upgrade validate + quality requirements selfcheck test test-all upgrade validate check_keywords .DEFAULT_GOAL := help @@ -88,3 +88,6 @@ dummy_translations: ## generate dummy translation (.po) files build_dummy_translations: extract_translations dummy_translations compile_translations ## generate and compile dummy translation files validate_translations: build_dummy_translations detect_changed_source_translations ## validate translations + +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 00000000..dcc39cde --- /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 1a7194b1..adccc50d 100644 --- a/tox.ini +++ b/tox.ini @@ -78,3 +78,10 @@ deps = commands = code_annotations django_find_annotations --config_file .pii_annotations.yml --lint --report --coverage +[testenv:check_keywords] +whitelist_externals = + make +deps = + -r{toxinidir}/requirements/test.txt +commands = + make check_keywords