Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add reserved keywords linter #215

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, docs, without-django]
toxenv: [django22, django30, django31, django32, quality, docs, without-django, 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,6 +1,6 @@
.DEFAULT_GOAL := test

.PHONY: clean html_coverage quality requirements test upgrade
.PHONY: clean html_coverage quality requirements test upgrade check_keywords

clean: ## remove generated byte code, coverage reports, and build artifacts
find . -name '*.pyc' -exec rm -f {} +
Expand Down Expand Up @@ -37,3 +37,6 @@ upgrade: ## update the requirements/*.txt files with the latest packages satisfy
# Let tox control the Django version for tests
sed '/^[dD]jango==/d' requirements/django-test.txt > requirements/django-test.tmp
mv requirements/django-test.tmp requirements/django-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:
8 changes: 8 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ commands =
# -C changes the directory to `docs` before running the command.
make -e -C docs clean
make -e -C docs html

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