Skip to content

Commit b77f3f9

Browse files
authored
Add mbake to lint stage (#765)
1 parent 76c3f4b commit b77f3f9

7 files changed

Lines changed: 72 additions & 231 deletions

File tree

‎.bake.toml‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# mbake configuration file
2+
# Generated with: mbake init
3+
4+
# Global settings
5+
debug = false
6+
verbose = false
7+
8+
# Error message formatting
9+
gnu_error_format = true
10+
wrap_error_messages = false
11+
12+
[formatter]
13+
# Spacing settings - enable proper spacing
14+
space_around_assignment = true
15+
space_before_colon = false
16+
space_after_colon = true
17+
18+
# Line continuation settings
19+
normalize_line_continuations = true
20+
max_line_length = 100
21+
22+
# PHONY settings
23+
auto_insert_phony_declarations = true
24+
group_phony_declarations = false
25+
phony_at_top = false
26+
27+
# General settings - enable proper formatting
28+
remove_trailing_whitespace = true
29+
ensure_final_newline = true
30+
normalize_empty_lines = true
31+
max_consecutive_empty_lines = 2
32+
fix_missing_recipe_tabs = true
33+
34+
# Conditional formatting settings (Default disabled)
35+
indent_nested_conditionals = false
36+
# Indentation settings
37+
tab_width = 2
38+
39+
# Variable alignment settings
40+
align_variable_assignments = false
41+
align_across_comments = false

‎.github/workflows/cd.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
name: splunk-sdk-${{ steps.get-version.outputs.version }}
5959
path: dist/
6060
- name: Generate API reference
61-
run: make -C ./docs zip
61+
run: make docs-zip
6262
- name: Upload docs artifact
6363
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
6464
with:

‎.github/workflows/lint.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
- name: Verify uv.lock is up-to-date
2727
run: uv lock --check
2828
- name: Verify files are linted and formatted
29-
run: make ci-lint
29+
run: make lint

‎.github/workflows/test.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
python-version: ${{ matrix.python-version }}
2929
deps-group: test
3030
- name: Download Splunk MCP Server App
31+
continue-on-error: true
3132
env:
3233
SPLUNKBASE_USERNAME: ${{ secrets.SPLUNKBASE_USERNAME }}
3334
SPLUNKBASE_PASSWORD: ${{ secrets.SPLUNKBASE_PASSWORD }}

‎Makefile‎

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,43 +20,51 @@ upgrade:
2020

2121
# Workaround for make being unable to pass arguments to underlying cmd
2222
# $ SDK_DEPS_GROUP="build" make ci-install
23+
SDK_DEPS_GROUP ?= dev
24+
2325
.PHONY: ci-install
2426
ci-install:
2527
$(UV_SYNC_CMD) --frozen --group $(SDK_DEPS_GROUP)
2628

2729
.PHONY: lint
28-
lint: lint-python lint-gh-actions # TODO: Add mbake
30+
lint: lint-python lint-gh-actions lint-makefile
2931

3032
.PHONY: lint-gh-actions
3133
lint-gh-actions:
3234
$(ZIZMOR_CMD) ./.github
3335

3436
.PHONY: lint-python
3537
lint-python:
36-
$(UV_RUN_CMD) ruff check --fix-only
37-
$(UV_RUN_CMD) ruff format
38+
$(UV_RUN_CMD) ruff check --fix-only $(if $(CI),--exit-non-zero-on-fix)
39+
$(UV_RUN_CMD) ruff format $(if $(CI),--check)
3840
$(UV_RUN_CMD) basedpyright
3941

40-
.PHONY: ci-lint
41-
ci-lint: ci-lint-python ci-lint-gh-actions # TODO: Add mbake
42-
43-
.PHONY: ci-lint-gh-actions
44-
ci-lint-gh-actions:
45-
$(ZIZMOR_CMD) ./.github
46-
47-
.PHONY: ci-lint-python
48-
ci-lint-python:
49-
$(UV_RUN_CMD) ruff check --fix-only --exit-non-zero-on-fix
50-
$(UV_RUN_CMD) ruff format --check
51-
$(UV_RUN_CMD) basedpyright
42+
.PHONY: lint-makefile
43+
lint-makefile:
44+
$(UV_RUN_CMD) mbake format --config ./.bake.toml $(if $(CI),--check) Makefile
45+
$(if $(CI),$(UV_RUN_CMD) mbake validate --config ./.bake.toml Makefile)
5246

5347
.PHONY: clean
5448
clean:
55-
rm -rf ./build ./dist ./.venv ./.ruff_cache ./.pytest_cache ./splunk_sdk.egg-info ./__pycache__ ./**/__pycache__
49+
rm -rf ./build ./dist ./.venv ./.ruff_cache ./.pytest_cache ./splunk_sdk.egg-info ./__pycache__
50+
find . -name __pycache__ -type d -exec rm -rf {} +
51+
52+
DOCS_BUILDDIR := docs/_build
53+
DOCS_HTMLDIR := $(DOCS_BUILDDIR)/html
54+
DOCS_ZIPFILE := $(DOCS_BUILDDIR)/splunk-sdk-python-docs.zip
5655

5756
.PHONY: docs
5857
docs:
59-
make -C ./docs html
58+
rm -rf $(DOCS_BUILDDIR)
59+
sphinx-build -b html -d $(DOCS_BUILDDIR)/doctrees ./docs $(DOCS_HTMLDIR)
60+
sh docs/munge_links.sh $(DOCS_HTMLDIR)
61+
@echo "[splunk-sdk] ---"
62+
@echo "[splunk-sdk] Build finished. HTML pages available at $(DOCS_HTMLDIR)."
63+
64+
.PHONY: docs-zip
65+
docs-zip: docs
66+
cd $(DOCS_HTMLDIR) && zip -r $(abspath $(DOCS_ZIPFILE)) .
67+
@echo "[splunk-sdk] Zip available at $(DOCS_ZIPFILE)."
6068

6169
## TESTING
6270

@@ -76,7 +84,7 @@ test-unit:
7684

7785
.PHONY: test-integration
7886
test-integration:
79-
$(PYTEST_CMD) --ff ./tests/integration ./tests/system
87+
$(PYTEST_CMD) ./tests/integration ./tests/system
8088

8189
.PHONY: test-ai
8290
test-ai:
@@ -122,8 +130,8 @@ docker-refresh: docker-remove docker-start
122130

123131
.PHONY: docker-splunk-restart
124132
docker-splunk-restart:
125-
docker exec -it $(CONTAINER_NAME) sudo sh -c '$(SPLUNK_HOME)/bin/splunk restart --run-as-root'
133+
docker exec -u splunk $(CONTAINER_NAME) $(SPLUNK_HOME)/bin/splunk restart
126134

127135
.PHONY: docker-tail-python-log
128136
docker-tail-python-log:
129-
docker exec -it $(CONTAINER_NAME) sudo tail $(SPLUNK_HOME)/var/log/splunk/python.log
137+
docker exec -u root $(CONTAINER_NAME) sudo tail -n 20 $(SPLUNK_HOME)/var/log/splunk/python.log

‎docs/Makefile‎

Lines changed: 0 additions & 19 deletions
This file was deleted.

‎docs/make.bat‎

Lines changed: 0 additions & 190 deletions
This file was deleted.

0 commit comments

Comments
 (0)