Skip to content

Commit 0909fd7

Browse files
authored
Merge pull request #1252 from tychtjan/JTYC-GDAI-996-fix-lint
fix: (MCP ruler) unifying lint, format, check for python validation
2 parents d303243 + ed96a84 commit 0909fd7

File tree

2 files changed

+31
-19
lines changed

2 files changed

+31
-19
lines changed

Makefile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ URL="${BASE_URL}/api/${API_VERSION}/schemas"
1313

1414
include ci_tests.mk
1515

16+
# Common command components
17+
RUFF = .venv/bin/ruff
18+
1619
all:
1720
echo "Nothing here yet."
1821

@@ -23,24 +26,23 @@ dev:
2326

2427
.PHONY: lint
2528
lint:
26-
.venv/bin/ruff check .
29+
$(RUFF) check .
2730

2831
.PHONY: lint-fix
2932
lint-fix:
30-
.venv/bin/ruff check . --fix
33+
$(RUFF) check . --fix
3134

3235
.PHONY: format
3336
format:
34-
.venv/bin/ruff format --check .
35-
36-
.PHONY: format-diff
37-
format-diff:
38-
.venv/bin/ruff format --diff .
37+
$(RUFF) format --check .
3938

4039
.PHONY: format-fix
4140
format-fix:
42-
.venv/bin/ruff format .
43-
.venv/bin/ruff check . --fix --fixable I
41+
$(RUFF) format .
42+
43+
.PHONY: format-diff
44+
format-diff:
45+
$(RUFF) format --diff .
4446

4547

4648
define download_client
@@ -51,8 +53,6 @@ define generate_client
5153
./scripts/generate_client.sh gooddata-$(1)-client -f "/local/schemas/gooddata-$(1)-client.json"
5254
endef
5355

54-
55-
5656
.PHONY: api-client
5757
api-client: download
5858
rm -f schemas/gooddata-api-client.json

project_common.mk

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
# (C) 2021 GoodData Corporation
2+
3+
# Common command components (run from workspace root, scoped to this package)
4+
ROOT_DIR = ../..
5+
RUFF = $(ROOT_DIR)/.venv/bin/ruff
6+
PKG_PATH = packages/$(CURR_DIR_BASE_NAME)
7+
28
TOX_FLAGS =
39
ifeq (1,$(RECREATE_ENVS))
410
TOX_FLAGS += -r
@@ -14,7 +20,6 @@ ifdef ADD_ARGS
1420
LOCAL_ADD_ARGS := -- $(ADD_ARGS)
1521
endif
1622

17-
1823
# linting and formatting tools have configuration in root dir to support pre-commit - use it
1924
# ruff uses root directory to have the same per-file-ignores config parameter for all packages
2025
CURR_DIR_BASE_NAME = $(notdir $(CURDIR))
@@ -23,18 +28,25 @@ CURR_DIR_BASE_NAME = $(notdir $(CURDIR))
2328
all:
2429
echo "Nothing here yet."
2530

31+
.PHONY: lint
32+
lint:
33+
(cd $(ROOT_DIR); $(RUFF) check $(PKG_PATH))
34+
35+
.PHONY: lint-fix
36+
lint-fix:
37+
(cd $(ROOT_DIR); $(RUFF) check $(PKG_PATH) --fix)
38+
2639
.PHONY: format
2740
format:
28-
(cd ../..; .venv/bin/ruff format --check packages/$(CURR_DIR_BASE_NAME))
29-
30-
.PHONY: format-diff
31-
format-diff:
32-
(cd ../..; .venv/bin/ruff format --diff packages/$(CURR_DIR_BASE_NAME))
41+
(cd $(ROOT_DIR); $(RUFF) format --check $(PKG_PATH))
3342

3443
.PHONY: format-fix
3544
format-fix:
36-
(cd ../..; .venv/bin/ruff format packages/$(CURR_DIR_BASE_NAME))
37-
(cd ../..; .venv/bin/ruff check --fix packages/$(CURR_DIR_BASE_NAME))
45+
(cd $(ROOT_DIR); $(RUFF) format $(PKG_PATH))
46+
47+
.PHONY: format-diff
48+
format-diff:
49+
(cd $(ROOT_DIR); $(RUFF) format --diff $(PKG_PATH))
3850

3951
.PHONY: mypy
4052
mypy:

0 commit comments

Comments
 (0)