diff --git a/src/main/kotlin/com/github/gantsign/maven/plugin/ktlint/internal/AbstractCheckSupport.kt b/src/main/kotlin/com/github/gantsign/maven/plugin/ktlint/internal/AbstractCheckSupport.kt index 9393bd63..d8e3615f 100644 --- a/src/main/kotlin/com/github/gantsign/maven/plugin/ktlint/internal/AbstractCheckSupport.kt +++ b/src/main/kotlin/com/github/gantsign/maven/plugin/ktlint/internal/AbstractCheckSupport.kt @@ -181,14 +181,12 @@ internal abstract class AbstractCheckSupport( val sourceFiles = ds.includedFiles.map { File(sourceRoot, it) } - val workingDir = File(".").absoluteFile - sourceFiles.forEach { file -> if (!checkedFiles.add(file.canonicalFile)) { return@forEach } - val workingRelativePath = file.toRelativeString(workingDir) + val absolutePath = file.absolutePath val baseRelativePath = file.toRelativeString(basedir) reporter.before(baseRelativePath) @@ -202,7 +200,7 @@ internal abstract class AbstractCheckSupport( val sourceText = file.readText(charset) lintFile( - workingRelativePath, + absolutePath, sourceText, ruleProviders, { error -> diff --git a/src/main/kotlin/com/github/gantsign/maven/plugin/ktlint/internal/Format.kt b/src/main/kotlin/com/github/gantsign/maven/plugin/ktlint/internal/Format.kt index 3b10991e..97c87093 100644 --- a/src/main/kotlin/com/github/gantsign/maven/plugin/ktlint/internal/Format.kt +++ b/src/main/kotlin/com/github/gantsign/maven/plugin/ktlint/internal/Format.kt @@ -87,14 +87,12 @@ internal class Format( val sourceFiles = ds.includedFiles.map { File(sourceRoot, it) } - val workingDir = File(".").absoluteFile - sourceFiles.forEach { file -> if (!checkedFiles.add(file.canonicalFile)) { return@forEach } - val workingRelativePath = file.toRelativeString(workingDir) + val absolutePath = file.absolutePath val baseRelativePath = file.toRelativeString(basedir) log.debug("checking format: $baseRelativePath") @@ -107,7 +105,7 @@ internal class Format( val sourceText = file.readText(charset) val formattedText = formatFile( - workingRelativePath, + absolutePath, sourceText, ruleProviders, { (line, col, _, detail), corrected ->