Skip to content

Commit

Permalink
Merge pull request #22 from jpwhite4/travis_style
Browse files Browse the repository at this point in the history
Synchronise the CI setup with the XDMoD core.
  • Loading branch information
jpwhite4 authored Jan 27, 2017
2 parents 6f81197 + e6285bd commit 35a6254
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
25 changes: 24 additions & 1 deletion .travis.build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if [ "$TEST_SUITE" = "syntax" ] || [ "$TEST_SUITE" = "style" ]; then
files_changed=()
while IFS= read -r -d $'\0' file; do
files_changed+=("$file")
done < <(git diff --name-only --diff-filter=d -z "$TRAVIS_COMMIT_RANGE")
done < <(git diff --name-only --diff-filter=da -z "$TRAVIS_COMMIT_RANGE")

# Separate the changed files by language.
php_files_changed=()
Expand All @@ -47,6 +47,17 @@ if [ "$TEST_SUITE" = "syntax" ] || [ "$TEST_SUITE" = "style" ]; then
js_files_changed+=("$file")
fi
done

# Get any added files by language
php_files_added=()
js_files_added=()
while IFS= read -r -d $'\0' file; do
if [[ "$file" == *.php ]]; then
php_files_added+=("$file")
elif [[ "$file" == *.js ]]; then
js_files_added+=("$file")
fi
done < <(git diff --name-only --diff-filter=A -z "$TRAVIS_COMMIT_RANGE")
fi

# Build tests require the corresponding version of Open XDMoD.
Expand Down Expand Up @@ -121,6 +132,12 @@ elif [ "$TEST_SUITE" = "style" ]; then
fi
rm "$file.lint.new.json"
done
for file in "${php_files_added[@]}"; do
phpcs "$file"
if [ $? != 0 ]; then
build_exit_value=2
fi
done
for file in "${js_files_changed[@]}"; do
eslint "$file" -f json > "$file.lint.new.json"
if [ $? != 0 ]; then
Expand All @@ -133,6 +150,12 @@ elif [ "$TEST_SUITE" = "style" ]; then
fi
rm "$file.lint.new.json"
done
for file in "${js_files_added[@]}"; do
eslint "$file"
if [ $? != 0 ]; then
build_exit_value=2
fi
done
elif [ "$TEST_SUITE" = "build" ]; then
# If PHP 5.3.3 is installed, SSL/TLS isn't available to PHP.
# Use a newer version of PHP for installing Composer dependencies.
Expand Down
27 changes: 25 additions & 2 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
<?xml version="1.0"?>
<ruleset name="XDMoD Standard">
<description>XDMoD PHP coding standard</description>
<rule ref="PSR1"/>
<rule ref="PSR2"/>
<rule ref="PSR1">
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
</rule>
<rule ref="PSR2">
<exclude name="PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket" />
<exclude name="PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose" />
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpaceBeforeCloseBrace" />
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace" />
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" />
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis" />
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword" />
<exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />
<exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose" />
<exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
<exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen" />
<exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace" />
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
</rule>
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="512"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
</rule>
</ruleset>

0 comments on commit 35a6254

Please sign in to comment.