Skip to content

Commit

Permalink
chore: add reserved keywords linter
Browse files Browse the repository at this point in the history
  • Loading branch information
arbabkhalil committed Jan 24, 2022
1 parent 619437b commit 4183031
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
matrix:
os: [ubuntu-20.04]
python-version: ['3.8']
toxenv: [django22-drf312, django30-drf312, django31-drf312, django32-drf312, django32-drflatest, quality, docs]
toxenv: [django22-drf312, django30-drf312, django31-drf312, django32-drf312, django32-drflatest, quality, docs, check_keywords]

steps:
- uses: actions/checkout@v2
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ endef
export BROWSER_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"

.PHONY: clean, coverage, diff_cover, docs, help, dev_requirements, test, test_quality, test_requirements, upgrade
.PHONY: clean, coverage, diff_cover, docs, help, dev_requirements, test, test_quality, test_requirements, upgrade,\
check_keywords

help: ## Display this help message
@echo "Please use \`make <target>' where <target> is one of"
Expand Down Expand Up @@ -69,6 +70,9 @@ test_quality: ## Run Quality checks
isort --check-only submissions manage.py setup.py settings.py
pycodestyle . --config=pycodestyle

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

##################
#Devstack commands
##################
Expand Down
10 changes: 10 additions & 0 deletions db_keyword_overrides.yml
Original file line number Diff line number Diff line change
@@ -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:
7 changes: 7 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@ deps =
commands =
python setup.py build_sphinx

[testenv:check_keywords]
whitelist_externals =
make
deps =
-r{toxinidir}/requirements/dev.txt
commands =
make check_keywords

0 comments on commit 4183031

Please sign in to comment.