<commit_before>.PHONY: develop test lint clean doc

# The source directory
SRC=abilian
# The package name
PKG=abilian

# FIXME: We have a parallelism issue with soffice conversion
# NCPU ?= $(shell sysctl -n hw.ncpu || echo 1)
NCPU=1

# pytest-sugar seems to be incompatible with pytest-xdist
# -s: no terminal capture.
# PYTEST_MULTI=-n $(NCPU) -p no:sugar -s
PYTEST_MULTI=-n $(NCPU)


all: test lint


#
# Setup
#
develop:
	@echo "--> Installing dependencies"
	pip install -U pip-tools setuptools
	pip install -U -e '.[dev]'
	pip install -r etc/dev-requirements.txt
	yarn
	@echo "--> Activating pre-commit hook"
	pre-commit install
	@echo "--> Configuring git"
	git config branch.autosetuprebase always
	@echo ""


#
# testing & checking
#
test-all: test test-readme

test:
	@echo "--> Running Python tests"
	pytest --ff -x -p no:randomly $(PYTEST_MULTI)
	@echo ""

test-randomly:
	@echo "--> Running Python tests in random order"
	pytest $(PYTEST_MULTI)
	@echo ""

test-with-coverage:
	@echo "--> Running Python tests"
	py.test $(PYTEST_MULTI) --cov $(PKG)
	@echo ""

vagrant-tests:
	vagrant up
	vagrant ssh -c /vagrant/deploy/vagrant_test.sh


#
# Various Checkers
#
lint-ci: lint-py lint-py3k lint-less lint-rst lint-doc lint-travis

lint: lint-py lint-js lint-less lint-rst lint-doc lint-travis

lint-all: lint lint-mypy lint-bandit

lint-py:
	@echo "--> Linting Python files /w flake8"
	flake8 $(SRC)
	@echo ""

flake8:
	flake8 $(SRC)

lint-mypy:
	@echo "--> Typechecking Python files w/ mypy"
	mypy $(SRC)
	@echo ""

lint-py3k:
	@echo "--> Checking Python 3 compatibility"
	pylint --py3k -j3 abilian
	@echo ""

lint-travis:
	@echo "--> Linting .travis.yml files"
	travis lint
	@echo ""

lint-js:
	@echo "--> Linting JS files"
	node_modules/.bin/eslint abilian/web/resources/js/
	@echo ""

lint-less:
	@echo "--> Linting LESS files"
	node_modules/.bin/stylelint ./abilian/web/resources/less/*.less
	@echo ""
<commit_msg>ci: fix travis lint issue<commit_after>.PHONY: develop test lint clean doc

# The source directory
SRC=abilian
# The package name
PKG=abilian

# FIXME: We have a parallelism issue with soffice conversion
# NCPU ?= $(shell sysctl -n hw.ncpu || echo 1)
NCPU=1

# pytest-sugar seems to be incompatible with pytest-xdist
# -s: no terminal capture.
# PYTEST_MULTI=-n $(NCPU) -p no:sugar -s
PYTEST_MULTI=-n $(NCPU)


all: test lint


#
# Setup
#
develop:
	@echo "--> Installing dependencies"
	pip install -U pip-tools setuptools
	pip install -U -e '.[dev]'
	pip install -r etc/dev-requirements.txt
	yarn
	@echo "--> Activating pre-commit hook"
	pre-commit install
	@echo "--> Configuring git"
	git config branch.autosetuprebase always
	@echo ""


#
# testing & checking
#
test-all: test test-readme

test:
	@echo "--> Running Python tests"
	pytest --ff -x -p no:randomly $(PYTEST_MULTI)
	@echo ""

test-randomly:
	@echo "--> Running Python tests in random order"
	pytest $(PYTEST_MULTI)
	@echo ""

test-with-coverage:
	@echo "--> Running Python tests"
	py.test $(PYTEST_MULTI) --cov $(PKG)
	@echo ""

vagrant-tests:
	vagrant up
	vagrant ssh -c /vagrant/deploy/vagrant_test.sh


#
# Various Checkers
#
lint-ci: lint-py lint-py3k lint-less lint-rst lint-doc lint-travis

lint: lint-py lint-js lint-less lint-rst lint-doc lint-travis

lint-all: lint lint-mypy lint-bandit

lint-py:
	@echo "--> Linting Python files /w flake8"
	flake8 $(SRC)
	@echo ""

flake8:
	flake8 $(SRC)

lint-mypy:
	@echo "--> Typechecking Python files w/ mypy"
	mypy $(SRC)
	@echo ""

lint-py3k:
	@echo "--> Checking Python 3 compatibility"
	pylint --py3k -j3 abilian
	@echo ""

lint-travis:
	@echo "--> Linting .travis.yml files"
	travis lint --no-interactive
	@echo ""

lint-js:
	@echo "--> Linting JS files"
	node_modules/.bin/eslint abilian/web/resources/js/
	@echo ""

lint-less:
	@echo "--> Linting LESS files"
	node_modules/.bin/stylelint ./abilian/web/resources/less/*.less
	@echo ""

{'fraction_non_alphanumeric': 0.14267319083183105, 'fraction_numerical': 0.0056657223796034, 'mean_word_length': 3.521536670547148, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1280169', 'n_tokens_mistral': 1593, 'n_tokens_neox': 1574, 'n_words': 423}