Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

chore: add reserved keywords linter #456

Closed
wants to merge 4 commits into from
Closed
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
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ jobs:
with:
flags: unittests
fail_ci_if_error: true
- name: Make Check Reserved Keywords
env:
TOXENV: ${{ matrix.toxenv }}
DJANGO_SETTINGS_MODULE: registrar.settings.test
run: |
make check_keywords
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ TOX=''
createsuperuser html_coverage extract_translations dummy_translations \
fake_translations pull_translations push_translations \
detect_changed_source_translations validate_translations api_generated \
validate_api_committed
validate_api_committed check_keywords

define BROWSER_PYSCRIPT
import os, webbrowser, sys
Expand Down Expand Up @@ -170,6 +170,9 @@ detect_changed_source_translations: ## check if translation files are up-to-date

validate_translations: fake_translations detect_changed_source_translations ## install fake translations and check if translation files are up-to-date

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

# Docker commands

docker_build:
Expand Down
12 changes: 12 additions & 0 deletions db_keyword_overrides.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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:
- Program.key
- Organization.key
SNOWFLAKE:
STITCH: