Compare commits

..

4 Commits

Author SHA1 Message Date
c88562ae69 add precommit hook
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2026-02-18 10:28:07 +01:00
1d06376826 Merge pull request 'make lint target' (#4) from feature/linter into master
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Reviewed-on: #4
2026-02-18 07:53:24 +00:00
7a57c15eeb header file path fix
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2026-02-18 08:52:56 +01:00
3922f51c8e linter fixes
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline failed
2026-02-18 08:49:54 +01:00
3 changed files with 36 additions and 13 deletions

View File

@@ -82,17 +82,20 @@ endef
lint:
@echo "==> Merging..."
@rm -f $(LINT_TMP_LUA) $(LINT_TMP_MAP)
@touch $(LINT_TMP_LUA)
@line=1; \
while IFS= read -r f || [ -n "$$f" ]; do \
[ -z "$$f" ] && continue; \
linecount=$$(awk 'END{print NR}' "$(SRC_DIR)/$$f"); \
echo "$$line $$linecount $(SRC_DIR)/$$f" >> $(LINT_TMP_MAP); \
before=$$(wc -l < $(LINT_TMP_LUA)); \
cat "$(SRC_DIR)/$$f" >> $(LINT_TMP_LUA); \
echo "" >> $(LINT_TMP_LUA); \
line=$$((line + linecount + 1)); \
printf '\n' >> $(LINT_TMP_LUA); \
after=$$(wc -l < $(LINT_TMP_LUA)); \
linecount=$$((after - before)); \
echo "$$line $$linecount $(SRC_DIR)/$$f" >> $(LINT_TMP_MAP); \
line=$$((line + linecount)); \
done < $(ORDER)
@echo "==> luacheck..."
@luacheck --no-max-line-length $(LINT_TMP_LUA) 2>&1 | awk -v map=$(LINT_TMP_MAP) ' \
@LINT_OUTPUT=$$(luacheck --no-max-line-length $(LINT_TMP_LUA) 2>&1 | awk -v map=$(LINT_TMP_MAP) ' \
BEGIN { \
NR_map = 0; \
while ((getline line < map) > 0) { \
@@ -114,7 +117,7 @@ lint:
rest = substr(rest2, colon3); \
found = 0; \
for (i = 0; i < NR_map; i++) { \
end_line = start[i] + count[i]; \
end_line = start[i] + count[i] -1; \
if (absline >= start[i] && absline <= end_line) { \
relline = absline - start[i] + 1; \
print fname[i] ":" relline ":" col ":" rest; \
@@ -126,7 +129,16 @@ lint:
next; \
} \
{ print } \
'; true
'); \
echo "$$LINT_OUTPUT"; \
NUM_ISSUES=$$(echo "$$LINT_OUTPUT" | grep -cE "^[^:]+:[0-9]+:[0-9]+:"); \
if [ "$$NUM_ISSUES" -gt 0 ]; then \
echo "Total: $$NUM_ISSUES issue(s) found, commit aborted."; \
exit 1; \
else \
echo "Checking /tmp/_lint_combined.lua OK"; \
echo "Total: 0 warnings / 0 errors in 1 file"; \
fi
@rm -f $(LINT_TMP_LUA) $(LINT_TMP_MAP)
export_assets:
@@ -148,7 +160,7 @@ clean:
# CI/CD Targets
ci-version:
@VERSION=$$(sed -n "s/^-- version: //p" inc-meta-meta.header.lua | head -n 1 | tr -d "[:space:]"); \
@VERSION=$$(sed -n "s/^-- version: //p" inc/meta/meta.header.lua | head -n 1 | tr -d "[:space:]"); \
BRANCH=$${CI_COMMIT_BRANCH:-$${WOODPECKER_BRANCH}}; \
BRANCH=$$(echo "$$BRANCH" | tr '/' '-'); \
if [ "$$BRANCH" != "main" ] && [ "$$BRANCH" != "master" ] && [ -n "$$BRANCH" ]; then \
@@ -178,7 +190,20 @@ ci-update:
echo "==> Triggering update for version $$VERSION"; \
curl "$(UPDATE_SERVER)/update?secret=$(UPDATE_SECRET)&name=$(PROJECT)&platform=tic80&version=$$VERSION"
.PHONY: all build export watch import_assets export_assets clean lint ci-version ci-export ci-upload ci-update
install_precommit_hook:
@echo "Installing Git pre-commit hook (lint check)..."
@mkdir -p .git/hooks
@printf '#!/bin/bash\n' > .git/hooks/pre-commit
@printf 'echo "Running lint before commit..."\n' >> .git/hooks/pre-commit
@printf 'make lint\n' >> .git/hooks/pre-commit
@printf 'if [ $$? -ne 0 ]; then\n' >> .git/hooks/pre-commit
@printf ' echo "Lint failed! Commit aborted."\n' >> .git/hooks/pre-commit
@printf ' exit 1\n' >> .git/hooks/pre-commit
@printf 'fi\n' >> .git/hooks/pre-commit
@chmod +x .git/hooks/pre-commit
@echo "Pre-commit hook installed successfully."
.PHONY: all build export watch import_assets export_assets clean lint ci-version ci-export ci-upload ci-update install_precommit_hook
#-- <WAVES>
#-- 000:224578acdeeeeddcba95434567653100

View File

@@ -8,7 +8,6 @@ local AudioTestWindow = {}
local MinigameButtonMashWindow = {}
local MinigameRhythmWindow = {}
local MinigameDDRWindow = {}
Util = {}
DesitionManager = {}
ScreenManager = {} -- New declaration

View File

@@ -1,6 +1,6 @@
function IntroWindow.draw()
local x = (Config.screen.width - 132) / 2 -- Centered text
Print.text(Context.intro.text, x, Context.intro.y, Config.colors.green)
Print.text(Context.intro.text, x, Context.intro.y, Config.colors.green)
end
function IntroWindow.update()
@@ -21,5 +21,4 @@ function IntroWindow.update()
if Input.menu_confirm() then
GameWindow.set_state(WINDOW_MENU)
end
end
end