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 26, 2022
1 parent 57a749a commit 205be8f
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: [quality, django32, django40]
toxenv: [quality, django32, django40, check_keywords]
steps:
- uses: actions/checkout@v1
- name: setup python
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -124,3 +124,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
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 @@ -69,3 +69,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

0 comments on commit 205be8f

Please sign in to comment.