Merge pull request #8939 from Mailaender/lint-map-scripts

Added checks for syntax errors in Lua scripts
This commit is contained in:
abcdefg30
2015-08-19 21:36:34 +02:00
3 changed files with 21 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ cache:
addons:
apt:
packages:
- lua5.1
- nsis
- nsis-common
- dpkg
@@ -31,6 +32,7 @@ script:
- travis_retry make all-dependencies
- make all
- make check
- make check-scripts
- make test
# Automatically update the trait documentation and Lua API

View File

@@ -170,6 +170,12 @@ mod_ts_LIBS = $(COMMON_LIBS) $(STD_MOD_LIBS) $(mod_common_TARGET)
PROGRAMS += mod_ts
mod_ts: $(mod_ts_TARGET)
check-scripts:
@echo
@echo "Checking for Lua syntax errors..."
@luac -p $(shell find mods/*/maps/* -iname '*.lua')
@luac -p $(shell find lua/* -iname '*.lua')
check: utility mods
@echo
@echo "Checking for code style violations in OpenRA.Game..."

View File

@@ -35,6 +35,7 @@ if ($args.Length -eq 0)
echo " 'dependencies' commands to restore removed files."
echo " test Tests the default mods for errors."
echo " check Checks .cs files for StyleCop violations."
echo " check-scripts Checks .lua files for syntax errors."
echo " docs Generates the trait and Lua API documentation."
echo ""
$command = (Read-Host "Enter command").Split(' ', 2)
@@ -177,6 +178,18 @@ elseif ($command -eq "check")
UtilityNotFound
}
}
elseif ($command -eq "check-scripts")
{
foreach ($script in ls "mods/*/maps/*/*.lua")
{
luac -p $script
}
foreach ($script in ls "lua/*.lua")
{
luac -p $script
}
echo "Check successfull!"
}
elseif ($command -eq "docs")
{
if (Test-Path OpenRA.Utility.exe)