From b62a4d60f89d9f2e89e72fdaee085409b6d6e90f Mon Sep 17 00:00:00 2001 From: Leandro Marques Date: Wed, 19 Jul 2023 17:59:38 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20l=C3=AA=20arquivos=20de=20report=20e=20?= =?UTF-8?q?concatena?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/index.js/index.js | 14 +++++++++----- index.js | 4 ---- src/controller/detektManager.js | 9 ++++++++- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/dist/index.js/index.js b/dist/index.js/index.js index 244b46f..bd4c110 100644 --- a/dist/index.js/index.js +++ b/dist/index.js/index.js @@ -9582,7 +9582,14 @@ function getDetektReport() { const KTLINT_REPORT_PATH = 'app/build/reports/ktlint' function getKtlintReport() { - return searchJSONfiles(KTLINT_REPORT_PATH) + const files = searchJSONfiles(KTLINT_REPORT_PATH) + + const ktlintReport = files + .map(file => loadFile(file)) + .map(file => JSON.parse(file)) + .flat() + + return JSON.stringify(ktlintReport) } /** @@ -17663,10 +17670,6 @@ function runKtlint() { const childProcess = spawn(command, { shell: true }) try { - childProcess.stdout.on('data', (data) => { - core.info(`\u001b[38;5;6m[info] Saída do comando: ${data}`) - }) - childProcess.stderr.on('data', (data) => { core.setFailed(`\u001b[38;5;6m[erro] EXEC -> Erro no comando bash: ${data}`) }) @@ -17675,6 +17678,7 @@ function runKtlint() { core.info('\u001b[38;5;6m[info] Iniciando análise do ktlint') report = getKtlintReport() + console.log('report', report) core.setOutput('result > ktlint', report) core.notice(`\u001b[32;5;6m 🚀 Processo concluído -> ${report}`) return report diff --git a/index.js b/index.js index 54bcb13..55fe7b6 100644 --- a/index.js +++ b/index.js @@ -36,10 +36,6 @@ function runKtlint() { const childProcess = spawn(command, { shell: true }) try { - childProcess.stdout.on('data', (data) => { - core.info(`\u001b[38;5;6m[info] Saída do comando: ${data}`) - }) - childProcess.stderr.on('data', (data) => { core.setFailed(`\u001b[38;5;6m[erro] EXEC -> Erro no comando bash: ${data}`) }) diff --git a/src/controller/detektManager.js b/src/controller/detektManager.js index 3b16272..aca00fa 100644 --- a/src/controller/detektManager.js +++ b/src/controller/detektManager.js @@ -19,7 +19,14 @@ function getDetektReport() { const KTLINT_REPORT_PATH = 'app/build/reports/ktlint' function getKtlintReport() { - return searchJSONfiles(KTLINT_REPORT_PATH) + const files = searchJSONfiles(KTLINT_REPORT_PATH) + + const ktlintReport = files + .map(file => loadFile(file)) + .map(file => JSON.parse(file)) + .flat() + + return JSON.stringify(ktlintReport) } /**