Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewparmet committed Nov 15, 2024
1 parent 4dd4efd commit 716b95f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/kotlin/build/buf/gradle/LintTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ abstract class LintTask : AbstractBufExecTask() {
fun bufLint() {
execBufInSpecificDirectory(
"lint",
if (v1SyntaxOnly.get() && !hasWorkspace.get()) {
if (noWorkspaceAndV1Syntax() || noWorkspaceAndNoProtobufGradlePlugin()) {
bufConfigFile.orNull?.let { listOf("--config", it.readAndStripComments()) }
} else {
null
Expand All @@ -55,6 +55,12 @@ abstract class LintTask : AbstractBufExecTask() {
}
}

private fun noWorkspaceAndV1Syntax() =
!hasWorkspace.get() && v1SyntaxOnly.get()

private fun noWorkspaceAndNoProtobufGradlePlugin() =
!hasWorkspace.get() && !hasProtobufGradlePlugin.get()

private fun File.readAndStripComments() =
lines(toPath()).use { lines ->
lines.asSequence()
Expand Down

0 comments on commit 716b95f

Please sign in to comment.