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 96a3677 commit 60c9c2c
Show file tree
Hide file tree
Showing 4 changed files with 22 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, django30, django31, django32, quality]
toxenv: [django22, django30, django31, django32, quality, check_keywords]

steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: clean quality requirements test upgrade
.PHONY: clean quality requirements test upgrade check_keywords

clean:
coverage erase
Expand Down Expand Up @@ -43,3 +43,6 @@ upgrade: $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with
# Let tox control the Django version for tests
sed '/^[dD]jango==/d' requirements/test.txt > requirements/test.tmp
mv requirements/test.tmp requirements/test.txt

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
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 @@ -19,3 +19,10 @@ commands =
pycodestyle --config=.pep8 auth_backends
pylint --rcfile=pylintrc auth_backends

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

0 comments on commit 60c9c2c

Please sign in to comment.