-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
32 lines (32 loc) · 973 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
PATH := $(PATH)
SHELL := /bin/bash
LINE_LENGTH := 120
MULTI_LINE := 3
MERGE_BASE := $(shell git merge-base origin/main HEAD)
DIFF := $(shell git diff --name-only --diff-filter=db $(MERGE_BASE) | grep -E '\.py$$')
flake:
flake8 -v --max-line-length $(LINE_LENGTH) --per-file-ignores="tests/*:E402,E501" --exclude "eureka_ml_insights/configs" $(DIFF)
isort:
isort --check-only --multi-line $(MULTI_LINE) --trailing-comma --diff $(DIFF)
black:
black --check --line-length $(LINE_LENGTH) $(DIFF)
linters:
@if [ -z "$(DIFF)" ]; then \
echo "No files to format."; \
else \
make isort; \
make black; \
make flake; \
fi
isort-inplace:
isort --multi-line $(MULTI_LINE) --trailing-comma $(DIFF)
black-inplace:
black --line-length $(LINE_LENGTH) $(DIFF)
autoflake-inplace:
autoflake --remove-all-unused-imports --in-place --remove-unused-variables -r $(DIFF)
format-inplace:
make autoflake-inplace
make isort-inplace
make black-inplace
test:
python run_tests.py