Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronise the CI setup with the XDMoD core. #22

Merged
merged 1 commit into from
Jan 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>