Skip to content

Commit

Permalink
Fix Detekt execution result resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
arturdryomov authored Jan 31, 2021
1 parent 13971b5 commit a9777a8
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
- name: "Lint Starlark files"
run: buildifier -mode check -lint warn -r .

- name: "Lint Shell files"
run: for file in $(find . -type f -name "*.sh"); do shellcheck $file; done;

build:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion detekt/toolchains.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def rules_detekt_toolchains(detekt_version = "1.15.0", toolchain = "@rules_detek
Users should call this macro in their `WORKSPACE` file.
Args:
detekt_version: "io.gitlab.arturbosch.detekt:detekt-tools" version used by rules.
detekt_version: "io.gitlab.arturbosch.detekt:detekt-cli" version used by rules.
toolchain: `detekt_toolchain` used by rules.
"""

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.buildfoundation.bazel.detekt.execute

import io.github.detekt.tooling.api.DetektCli
import io.gitlab.arturbosch.detekt.cli.buildRunner
import java.io.PrintStream

interface Detekt {
Expand All @@ -10,7 +10,7 @@ interface Detekt {
class Impl : Detekt {

override fun execute(args: Array<String>, outputPrinter: PrintStream, errorPrinter: PrintStream) {
DetektCli.load().run(args = args, outputChannel = outputPrinter, errorChannel = errorPrinter)
buildRunner(args, outputPrinter, errorPrinter).execute()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ interface Executable {
errorPrinter.flush()

Result.Failure(arrayOf(outputBuffer, errorBuffer).joinToString(separator = "") {
String(it.toByteArray(), Charset.defaultCharset())
it.toString(Charset.defaultCharset())
})
} finally {
outputPrinter.close()
errorPrinter.close()
}
}
}
}
}
2 changes: 1 addition & 1 deletion tests/integration/suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ for STRATEGY in "local" "worker"; do
echo '@file:Suppress("EmptyKtFile")' > "${GENERATED_CODE_DIR}/${STRATEGY}.kt"

for TEST in tests/integration/test_*.sh; do
bash $TEST
bash "${TEST}"
done

rm -rf "${GENERATED_CODE_DIR}"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_baseline_plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set -e

set -x

test BAZEL_EXIT_CODE != 0
test $BAZEL_EXIT_CODE != 0

test ! -f "${OUTPUT_DIR}/${TARGET}_detekt_report.html"
test -f "${OUTPUT_DIR}/${TARGET}_detekt_report.txt"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_report_html.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set -e

set -x

test BAZEL_EXIT_CODE != 0
test $BAZEL_EXIT_CODE != 0

test -f "${OUTPUT_DIR}/${TARGET}_detekt_report.html"
test -f "${OUTPUT_DIR}/${TARGET}_detekt_report.txt"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_report_text.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set -e

set -x

test BAZEL_EXIT_CODE != 0
test $BAZEL_EXIT_CODE != 0

test ! -f "${OUTPUT_DIR}/${TARGET}_detekt_report.html"
test -f "${OUTPUT_DIR}/${TARGET}_detekt_report.txt"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_report_xml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set -e

set -x

test BAZEL_EXIT_CODE != 0
test $BAZEL_EXIT_CODE != 0

test ! -f "${OUTPUT_DIR}/${TARGET}_detekt_report.html"
test -f "${OUTPUT_DIR}/${TARGET}_detekt_report.txt"
Expand Down

0 comments on commit a9777a8

Please sign in to comment.