Skip to content

Commit 1914839

Browse files
author
Jan Tychtl
committed
fix: (MCP ruler) fix lint and lint-fix for python validation
JIRA: GDAI-996 risk: low
1 parent d303243 commit 1914839

File tree

2 files changed

+33
-21
lines changed

2 files changed

+33
-21
lines changed

Makefile

Lines changed: 12 additions & 12 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

32-
.PHONY: format
33-
format:
34-
.venv/bin/ruff format --check .
35+
.PHONY: format format-fix
36+
format format-fix:
37+
$(RUFF) format .
3538

3639
.PHONY: format-diff
3740
format-diff:
38-
.venv/bin/ruff format --diff .
41+
$(RUFF) format --diff .
3942

40-
.PHONY: format-fix
41-
format-fix:
42-
.venv/bin/ruff format .
43-
.venv/bin/ruff check . --fix --fixable I
43+
.PHONY: format-check
44+
format-check:
45+
$(RUFF) format --check .
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: 21 additions & 9 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

26-
.PHONY: format
27-
format:
28-
(cd ../..; .venv/bin/ruff format --check packages/$(CURR_DIR_BASE_NAME))
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+
39+
.PHONY: format format-fix
40+
format format-fix:
41+
(cd $(ROOT_DIR); $(RUFF) format $(PKG_PATH))
2942

3043
.PHONY: format-diff
3144
format-diff:
32-
(cd ../..; .venv/bin/ruff format --diff packages/$(CURR_DIR_BASE_NAME))
45+
(cd $(ROOT_DIR); $(RUFF) format --diff $(PKG_PATH))
3346

34-
.PHONY: format-fix
35-
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))
47+
.PHONY: format-check
48+
format-check:
49+
(cd $(ROOT_DIR); $(RUFF) format --check $(PKG_PATH))
3850

3951
.PHONY: mypy
4052
mypy:

0 commit comments

Comments
 (0)