<commit_before>.PHONY: help install-python install-js install-test install \
		update-npm-requirements static \
		extract_translations compile_translations generate_dummy_translations validate_translations \
		detect_changed_source_translations pull_translations push_translations check_translations_up_to_date \
		quality test-python render-templates test-js test-js-debug test test-acceptance test-a11y test-sandbox \
		install-osx-requirements

.DEFAULT_GOAL := help

help: ## display this help message
	@echo "Please use \`make <target>' where <target> is one of"
	@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m  %-25s\033[0m %s\n", $$1, $$2}'

clean: ## remove generated byte code, coverage reports, and build artifacts
	find openassessment/ -name '__pycache__' -exec rm -rf {} +
	find openassessment/ -name '*.pyc' -exec rm -f {} +
	find openassessment/ -name '*.pyo' -exec rm -f {} +
	find openassessment/ -name '*~' -exec rm -f {} +
	coverage erase
	rm -fr build/
	rm -fr dist/
	rm -fr *.egg-info

##################
# Install commands
##################

install-python: ## Install python dependencies
	pip install -r requirements/base.txt --only-binary=lxml,libsass

install-js: ## install JavaScript dependencies
	npm install

install-test: ## install requirements for tests
	pip install -r requirements/test.txt
	python setup.py develop --quiet  # XBlock plugin (openassessment) has to be installed via entry_points.

install: install-python install-js install-test static ## install all dependencies

upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
	pip install -qr requirements/pip-tools.txt
	pip-compile --upgrade --allow-unsafe -o requirements/pip.txt requirements/pip.in
	pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in
	pip install -qr requirements/pip.txt
	pip install -qr requirements/pip-tools.txt
	pip-compile --upgrade -o requirements/base.txt requirements/base.in
	pip-compile --upgrade -o requirements/test.txt requirements/test.in
	pip-compile --upgrade -o requirements/quality.txt requirements/quality.in
	pip-compile --upgrade -o requirements/test-acceptance.txt requirements/test-acceptance.in
	pip-compile --upgrade -o requirements/tox.txt requirements/tox.in
	pip-compile --upgrade -o requirements/ci.txt requirements/ci.in
	# Delete django pin from test requirements to avoid tox version collision
	sed -i.tmp '/^[d|D]jango==/d' requirements/test.txt
	sed -i.tmp '/^djangorestframework==/d' requirements/test.txt
	# Delete extra metadata that causes build to fail
	sed -i.tmp '/^--index-url/d' requirements/*.txt
	sed -i.tmp '/^--extra-index-url/d' requirements/*.txt
	sed -i.tmp '/^--trusted-host/d' requirements/*.txt
	# Delete temporary files
	rm requirements/*.txt.tmp

##############################
# Generate js/css output files
##############################

STATIC_JS = openassessment/xblock/static/js
STATIC_CSS = openassessment/xblock/static/css

update-npm-requirements: ## update NPM requrements
	npm update --silent
	cp ./node_modules/backgrid/lib/backgrid*.js $(STATIC_JS)/lib/backgrid/
	cp ./node_modules/backgrid/lib/backgrid*.css $(STATIC_CSS)/lib/backgrid/

static: ## Webpack JavaScript and SASS source files
	npm run dev && npm run build

################
#Translations Handling
################

extract_translations: ## creates the django-partial.po & django-partial.mo files
	python manage.py makemessages -l en -v1 --ignore=".tox/*" --ignore="build/*" --ignore="docs/*" --ignore="edx-ora2/*" --ignore="logs/*" --ignore="node_modules/*" --ignore="performance/*" --ignore="requirements/*" --ignore="scripts/*" --ignore="settings/*" --ignore="storage/*" -d django
	python manage.py makemessages -l en -v1 --ignore=".tox/*" --ignore="build/*" --ignore="docs/*" --ignore="edx-ora2/*" --ignore="logs/*" --ignore="node_modules/*" --ignore="performance/*" --ignore="requirements/*" --ignore="scripts/*" --ignore="settings/*" --ignore="storage/*" -d djangojs

compile_translations: ## compiles the *.po & *.mo files
	cd ./openassessment/ && i18n_tool generate -v && cd ..

generate_dummy_translations: ## generate dummy translations
	i18n_tool dummy

validate_translations: ## Test translation files
	cd ./openassessment/ && i18n_tool validate -v

detect_changed_source_translations: ## check if translation files are up-to-date
	i18n_tool changed

pull_translations: ## pull translations from Transifex
	tx pull -a -f --mode reviewed --minimum-perc=1

push_translations: ## push source translation files (.po) to Transifex
	tx push -s

check_translations_up_to_date: extract_translations compile_translations generate_dummy_translations detect_changed_source_translations ## extract, compile, and check if translation files are up-to-date

################
#Tests and checks
################

quality: ## Run linting and code quality checks
	npm run lint
	./scripts/run-pycodestyle.sh
	./scripts/run-pylint.sh<commit_msg>fix: update transifex flag for tx cli 1.4.0<commit_after>.PHONY: help install-python install-js install-test install \
		update-npm-requirements static \
		extract_translations compile_translations generate_dummy_translations validate_translations \
		detect_changed_source_translations pull_translations push_translations check_translations_up_to_date \
		quality test-python render-templates test-js test-js-debug test test-acceptance test-a11y test-sandbox \
		install-osx-requirements

.DEFAULT_GOAL := help

help: ## display this help message
	@echo "Please use \`make <target>' where <target> is one of"
	@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m  %-25s\033[0m %s\n", $$1, $$2}'

clean: ## remove generated byte code, coverage reports, and build artifacts
	find openassessment/ -name '__pycache__' -exec rm -rf {} +
	find openassessment/ -name '*.pyc' -exec rm -f {} +
	find openassessment/ -name '*.pyo' -exec rm -f {} +
	find openassessment/ -name '*~' -exec rm -f {} +
	coverage erase
	rm -fr build/
	rm -fr dist/
	rm -fr *.egg-info

##################
# Install commands
##################

install-python: ## Install python dependencies
	pip install -r requirements/base.txt --only-binary=lxml,libsass

install-js: ## install JavaScript dependencies
	npm install

install-test: ## install requirements for tests
	pip install -r requirements/test.txt
	python setup.py develop --quiet  # XBlock plugin (openassessment) has to be installed via entry_points.

install: install-python install-js install-test static ## install all dependencies

upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
	pip install -qr requirements/pip-tools.txt
	pip-compile --upgrade --allow-unsafe -o requirements/pip.txt requirements/pip.in
	pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in
	pip install -qr requirements/pip.txt
	pip install -qr requirements/pip-tools.txt
	pip-compile --upgrade -o requirements/base.txt requirements/base.in
	pip-compile --upgrade -o requirements/test.txt requirements/test.in
	pip-compile --upgrade -o requirements/quality.txt requirements/quality.in
	pip-compile --upgrade -o requirements/test-acceptance.txt requirements/test-acceptance.in
	pip-compile --upgrade -o requirements/tox.txt requirements/tox.in
	pip-compile --upgrade -o requirements/ci.txt requirements/ci.in
	# Delete django pin from test requirements to avoid tox version collision
	sed -i.tmp '/^[d|D]jango==/d' requirements/test.txt
	sed -i.tmp '/^djangorestframework==/d' requirements/test.txt
	# Delete extra metadata that causes build to fail
	sed -i.tmp '/^--index-url/d' requirements/*.txt
	sed -i.tmp '/^--extra-index-url/d' requirements/*.txt
	sed -i.tmp '/^--trusted-host/d' requirements/*.txt
	# Delete temporary files
	rm requirements/*.txt.tmp

##############################
# Generate js/css output files
##############################

STATIC_JS = openassessment/xblock/static/js
STATIC_CSS = openassessment/xblock/static/css

update-npm-requirements: ## update NPM requrements
	npm update --silent
	cp ./node_modules/backgrid/lib/backgrid*.js $(STATIC_JS)/lib/backgrid/
	cp ./node_modules/backgrid/lib/backgrid*.css $(STATIC_CSS)/lib/backgrid/

static: ## Webpack JavaScript and SASS source files
	npm run dev && npm run build

################
#Translations Handling
################

extract_translations: ## creates the django-partial.po & django-partial.mo files
	python manage.py makemessages -l en -v1 --ignore=".tox/*" --ignore="build/*" --ignore="docs/*" --ignore="edx-ora2/*" --ignore="logs/*" --ignore="node_modules/*" --ignore="performance/*" --ignore="requirements/*" --ignore="scripts/*" --ignore="settings/*" --ignore="storage/*" -d django
	python manage.py makemessages -l en -v1 --ignore=".tox/*" --ignore="build/*" --ignore="docs/*" --ignore="edx-ora2/*" --ignore="logs/*" --ignore="node_modules/*" --ignore="performance/*" --ignore="requirements/*" --ignore="scripts/*" --ignore="settings/*" --ignore="storage/*" -d djangojs

compile_translations: ## compiles the *.po & *.mo files
	cd ./openassessment/ && i18n_tool generate -v && cd ..

generate_dummy_translations: ## generate dummy translations
	i18n_tool dummy

validate_translations: ## Test translation files
	cd ./openassessment/ && i18n_tool validate -v

detect_changed_source_translations: ## check if translation files are up-to-date
	i18n_tool changed

pull_translations: ## pull translations from Transifex
	tx pull -a -f -t --mode reviewed --minimum-perc=1

push_translations: ## push source translation files (.po) to Transifex
	tx push -s

check_translations_up_to_date: extract_translations compile_translations generate_dummy_translations detect_changed_source_translations ## extract, compile, and check if translation files are up-to-date

################
#Tests and checks
################

quality: ## Run linting and code quality checks
	npm run lint
	./scripts/run-pycodestyle.sh
	./scripts/run-pylint.sh
{'fraction_non_alphanumeric': 0.16057249289285364, 'fraction_numerical': 0.005783746691500833, 'mean_word_length': 4.432374866879659, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '385850', 'n_tokens_mistral': 3251, 'n_tokens_neox': 3061, 'n_words': 873}