Skip to content

Commit

Permalink
feat: lê arquivos de report e concatena
Browse files Browse the repository at this point in the history
  • Loading branch information
LeandroLM committed Jul 19, 2023
1 parent 70ebdb7 commit b62a4d6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
14 changes: 9 additions & 5 deletions dist/index.js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

/**
Expand Down Expand Up @@ -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}`)
})
Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
})
Expand Down
9 changes: 8 additions & 1 deletion src/controller/detektManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

/**
Expand Down

0 comments on commit b62a4d6

Please sign in to comment.