diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0ad7be5..dc29345 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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: diff --git a/detekt/toolchains.bzl b/detekt/toolchains.bzl index 86748d8..2984cb3 100644 --- a/detekt/toolchains.bzl +++ b/detekt/toolchains.bzl @@ -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. """ diff --git a/detekt/wrapper/src/main/kotlin/io/buildfoundation/bazel/detekt/execute/Detekt.kt b/detekt/wrapper/src/main/kotlin/io/buildfoundation/bazel/detekt/execute/Detekt.kt index d12c4ff..9a83cf4 100644 --- a/detekt/wrapper/src/main/kotlin/io/buildfoundation/bazel/detekt/execute/Detekt.kt +++ b/detekt/wrapper/src/main/kotlin/io/buildfoundation/bazel/detekt/execute/Detekt.kt @@ -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 { @@ -10,7 +10,7 @@ interface Detekt { class Impl : Detekt { override fun execute(args: Array, outputPrinter: PrintStream, errorPrinter: PrintStream) { - DetektCli.load().run(args = args, outputChannel = outputPrinter, errorChannel = errorPrinter) + buildRunner(args, outputPrinter, errorPrinter).execute() } } } diff --git a/detekt/wrapper/src/main/kotlin/io/buildfoundation/bazel/detekt/execute/Executable.kt b/detekt/wrapper/src/main/kotlin/io/buildfoundation/bazel/detekt/execute/Executable.kt index f2fc539..9089d22 100644 --- a/detekt/wrapper/src/main/kotlin/io/buildfoundation/bazel/detekt/execute/Executable.kt +++ b/detekt/wrapper/src/main/kotlin/io/buildfoundation/bazel/detekt/execute/Executable.kt @@ -28,7 +28,7 @@ interface Executable { errorPrinter.flush() Result.Failure(arrayOf(outputBuffer, errorBuffer).joinToString(separator = "") { - String(it.toByteArray(), Charset.defaultCharset()) + it.toString(Charset.defaultCharset()) }) } finally { outputPrinter.close() @@ -36,4 +36,4 @@ interface Executable { } } } -} \ No newline at end of file +} diff --git a/tests/integration/suite.sh b/tests/integration/suite.sh index c9f7a79..3809adb 100644 --- a/tests/integration/suite.sh +++ b/tests/integration/suite.sh @@ -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}" diff --git a/tests/integration/test_baseline_plugin.sh b/tests/integration/test_baseline_plugin.sh index 2e4e8b9..63a0326 100644 --- a/tests/integration/test_baseline_plugin.sh +++ b/tests/integration/test_baseline_plugin.sh @@ -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" diff --git a/tests/integration/test_report_html.sh b/tests/integration/test_report_html.sh index 18de016..534cfb5 100644 --- a/tests/integration/test_report_html.sh +++ b/tests/integration/test_report_html.sh @@ -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" diff --git a/tests/integration/test_report_text.sh b/tests/integration/test_report_text.sh index bc44cb6..502276e 100644 --- a/tests/integration/test_report_text.sh +++ b/tests/integration/test_report_text.sh @@ -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" diff --git a/tests/integration/test_report_xml.sh b/tests/integration/test_report_xml.sh index 7e63bc7..25b698d 100644 --- a/tests/integration/test_report_xml.sh +++ b/tests/integration/test_report_xml.sh @@ -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"