From 16f7b42640a46aa09a1a873d09f39172136dcb4e Mon Sep 17 00:00:00 2001 From: Kelenius Date: Fri, 11 Mar 2016 11:39:05 +0300 Subject: [PATCH] Enables tag matcher and https://github.com/Baystation12/Baystation12/pull/11642 --- .travis.yml | 2 ++ tools/indentation.awk | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 tools/indentation.awk diff --git a/.travis.yml b/.travis.yml index 523b6fdb4b..3654665f1a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,9 @@ script: - (! grep 'step_[xy]' maps/**/*.dmm) - (! find nano/templates/ -type f -exec md5sum {} + | sort | uniq -D -w 32 | grep nano) - (! grep -E "<\s*span\s+class\s*=\s*('[^'>]+|[^'>]+')\s*>" **/*.dm) + - awk -f tools/indentation.awk **/*.dm - md5sum -c - <<< "88490b460c26947f5ec1ab1bb9fa9f17 *html/changelogs/example.yml" - (num=`grep -E '\\\\(red|blue|green|black|b|i[^mc])' **/*.dm | wc -l`; echo "$num escapes (expecting ${MACRO_COUNT} or less)"; [ $num -le ${MACRO_COUNT} ]) - source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup + - python tools/TagMatcher/tag-matcher.py ../.. - DreamMaker polaris.dme diff --git a/tools/indentation.awk b/tools/indentation.awk new file mode 100644 index 0000000000..e4742bf2f9 --- /dev/null +++ b/tools/indentation.awk @@ -0,0 +1,32 @@ +#! /usr/bin/awk -f + +# Finds incorrect indentation of absolute path definitions in DM code +# For example, the following fails on the indicated line: + +#/datum/path/foo +# x = "foo" +# /datum/path/bar // FAIL +# x = "bar" + +{ + if ( comma != 1 ) { # No comma/'list('/etc at the end of the previous line + if ( $0 ~ /^[\t ]+\/[^/*]/ ) { # Current line's first non-whitespace character is a slash, followed by something that is not another slash or an asterisk + print FILENAME, ":", $0 + fail = 1 + } + } + + if ($0 ~ /,[\t ]*\\?\r?$/ || # comma at EOL + $0 ~ /list[\t ]*\([\t ]*\\?\r?$/ || # start of a list() + $0 ~ /pick[\t ]*\([\t ]*\\?\r?$/ ) { # start of a pick() + comma = 1 + } else { + comma = 0 + } +} + +END { + if ( fail ) { + exit 1 + } +}