Skip to content

Commit

Permalink
Apply suggested fix by the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
hybloid authored and tiulpin committed Apr 18, 2024
1 parent 3a2c1cf commit 502f58f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
20 changes: 8 additions & 12 deletions baseline-cli/src/main/kotlin/CommandLineTable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@ class CommandLineTable(private val header: List<String>, private val rows: List<
const val DEFAULT_COLUMN_SIZE = 50
}

private val columnSize: List<Int>

init {
this.columnSize = columnSize.mapIndexed { ind, size ->
if (size != 0 || rows.isEmpty()) {
return@mapIndexed size
}

max(
rows.maxOfOrNull { if (ind < it.size) it[ind].length else 0 } ?: DEFAULT_COLUMN_SIZE,
if (ind < header.size) header[ind].length else DEFAULT_COLUMN_SIZE
)
private val columnSize: List<Int> = columnSize.mapIndexed { ind, size ->
if (size != 0 || rows.isEmpty()) {
return@mapIndexed size
}

max(
rows.maxOfOrNull { if (ind < it.size) it[ind].length else 0 } ?: DEFAULT_COLUMN_SIZE,
if (ind < header.size) header[ind].length else DEFAULT_COLUMN_SIZE
)
}

fun buildTable(): String {
Expand Down
4 changes: 3 additions & 1 deletion qodana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ profile:
name: qodana.recommended
include:
- name: CheckDependencyLicenses
raiseLicenseProblems: true
enablePackageSearch: true
exclude:
- name: All
paths:
- sarif/src/test/resources/
- sarif/src/test/resources/

0 comments on commit 502f58f

Please sign in to comment.