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

ci: Added pre-commit-hook #1320

Merged
merged 11 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from 9 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
4 changes: 4 additions & 0 deletions .githooks/linkHooks.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
echo Changing git config for hooks to .githooks
call git config --local core.hooksPath .githooks/
echo Complete!
5 changes: 5 additions & 0 deletions .githooks/linkHooks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
set echo of
piotradamczyk5 marked this conversation as resolved.
Show resolved Hide resolved
echo Changing git config for hooks to .githooks
git config --local core.hooksPath .githooks/
echo Complete!
17 changes: 17 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

echo "Running detekt check"
OUTPUT="/tmp/detekt-$(date +%s)"
./gradlew detekt > $OUTPUT
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
cat $OUTPUT
rm $OUTPUT
echo
echo "***********************************************"
echo " Detekt failed "
echo " Please fix the above issues before committing "
echo "***********************************************"
exit $EXIT_CODE
fi
rm $OUTPUT
9 changes: 0 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ repositories {
mavenCentral()
}

subprojects {
afterEvaluate {
if (tasks.findByName("detekt") != null) {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
dependsOn(tasks["detekt"])
}
}
}
}

tasks.named("dependencyUpdates", DependencyUpdatesTask::class.java).configure {

Expand Down
2 changes: 1 addition & 1 deletion config/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ formatting:
autoCorrect: true
ParameterListWrapping:
excludes: ['**/test/**', '**/*.Test.kt', '**/*.Spec.kt']
active: false
active: true
autoCorrect: true
indentSize: 4
SpacingAroundColon:
Expand Down
4 changes: 2 additions & 2 deletions test_runner/src/main/kotlin/ftl/ios/Xctestrun.kt
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ object Xctestrun {
}

private fun findTestNamesForTarget(
testTarget: String,
xctestrun: File
testTarget: String,
xctestrun: File
): List<String> =
testsForTarget(
testDictionary = parse(xctestrun)[testTarget]
Expand Down