diff --git a/README.md b/README.md index d2cbd13..96982f3 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ which are pointed to the corresponding vulnerabilities in target files. * A `fix object` represents a proposed fix for the problem, indicated by tool.\ It specifies a set of artifacts to modify. For each artifact, it specifies regions to remove, and provides new content to insert. -* `Fix-Patches`, in its turn will parse such sections, create copy of target files, which are presented in `SARIF`, +* `Fix-Patches`, in its turn, will parse such sections, create copy of target files, which are presented in `SARIF`, and automatically apply fixes to these copies. The result output will contain the list of paths to the copies of provided target files with applied fixes. @@ -32,7 +32,8 @@ The result output will contain the list of paths to the copies of provided targe #### How to use: Library provides easy-to-use API for fix patches applying, it's just need to provide -the path to `SARIF` file with expected fixes and the list of paths to target files which are presented in `SARIF`. +the path to `SARIF` file, which contain the list of fixes (`fix objects`) for target files and the list of paths to these files, +in the manner, in which they are presented in `SARIF` (via absolute/relative paths). ```kotlin val processedFiles: List<Path> = SarifFixAdapter( diff --git a/fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/cli/adapter/SarifFixAdapter.kt b/fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/adapter/SarifFixAdapter.kt similarity index 96% rename from fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/cli/adapter/SarifFixAdapter.kt rename to fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/adapter/SarifFixAdapter.kt index c58b58b..0785d14 100644 --- a/fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/cli/adapter/SarifFixAdapter.kt +++ b/fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/adapter/SarifFixAdapter.kt @@ -1,15 +1,15 @@ -package com.saveourtool.sarifutils.cli.adapter +package com.saveourtool.sarifutils.adapter -import com.saveourtool.sarifutils.cli.config.FileReplacements -import com.saveourtool.sarifutils.cli.config.RuleReplacements -import com.saveourtool.sarifutils.cli.files.createTempDir -import com.saveourtool.sarifutils.cli.files.fs -import com.saveourtool.sarifutils.cli.files.readFile -import com.saveourtool.sarifutils.cli.files.readLines -import com.saveourtool.sarifutils.cli.files.writeContentWithNewLinesToFile -import com.saveourtool.sarifutils.cli.utils.adaptedIsAbsolute -import com.saveourtool.sarifutils.cli.utils.getUriBaseIdForArtifactLocation -import com.saveourtool.sarifutils.cli.utils.resolveUriBaseId +import com.saveourtool.sarifutils.config.FileReplacements +import com.saveourtool.sarifutils.config.RuleReplacements +import com.saveourtool.sarifutils.files.createTempDir +import com.saveourtool.sarifutils.files.fs +import com.saveourtool.sarifutils.files.readFile +import com.saveourtool.sarifutils.files.readLines +import com.saveourtool.sarifutils.files.writeContentWithNewLinesToFile +import com.saveourtool.sarifutils.utils.adaptedIsAbsolute +import com.saveourtool.sarifutils.utils.getUriBaseIdForArtifactLocation +import com.saveourtool.sarifutils.utils.resolveUriBaseId import io.github.detekt.sarif4k.Replacement import io.github.detekt.sarif4k.Run diff --git a/fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/cli/config/FileReplacements.kt b/fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/config/FileReplacements.kt similarity index 89% rename from fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/cli/config/FileReplacements.kt rename to fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/config/FileReplacements.kt index 7092c31..a87d835 100644 --- a/fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/cli/config/FileReplacements.kt +++ b/fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/config/FileReplacements.kt @@ -1,4 +1,4 @@ -package com.saveourtool.sarifutils.cli.config +package com.saveourtool.sarifutils.config import io.github.detekt.sarif4k.Replacement import okio.Path diff --git a/fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/cli/files/FileUtils.kt b/fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/files/FileUtils.kt similarity index 97% rename from fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/cli/files/FileUtils.kt rename to fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/files/FileUtils.kt index 54c6f2a..8386590 100644 --- a/fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/cli/files/FileUtils.kt +++ b/fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/files/FileUtils.kt @@ -2,7 +2,7 @@ * Utility methods to work with file system */ -package com.saveourtool.sarifutils.cli.files +package com.saveourtool.sarifutils.files import okio.FileSystem import okio.Path diff --git a/fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/cli/utils/SarifUtils.kt b/fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/utils/SarifUtils.kt similarity index 98% rename from fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/cli/utils/SarifUtils.kt rename to fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/utils/SarifUtils.kt index 6bc30b8..bb4c499 100644 --- a/fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/cli/utils/SarifUtils.kt +++ b/fixpatches/src/commonMain/kotlin/com/saveourtool/sarifutils/utils/SarifUtils.kt @@ -2,7 +2,7 @@ * Utility methods to work with SARIF files. */ -package com.saveourtool.sarifutils.cli.utils +package com.saveourtool.sarifutils.utils import io.github.detekt.sarif4k.ArtifactLocation import io.github.detekt.sarif4k.Result diff --git a/fixpatches/src/commonTest/kotlin/com/saveourtool/sarifutils/adapter/SarifFixAdapterTest.kt b/fixpatches/src/commonTest/kotlin/com/saveourtool/sarifutils/adapter/SarifFixAdapterTest.kt index da6876d..9bcf30a 100644 --- a/fixpatches/src/commonTest/kotlin/com/saveourtool/sarifutils/adapter/SarifFixAdapterTest.kt +++ b/fixpatches/src/commonTest/kotlin/com/saveourtool/sarifutils/adapter/SarifFixAdapterTest.kt @@ -2,9 +2,8 @@ package com.saveourtool.sarifutils.adapter -import com.saveourtool.sarifutils.cli.adapter.SarifFixAdapter -import com.saveourtool.sarifutils.cli.files.readFile -import com.saveourtool.sarifutils.cli.files.readLines +import com.saveourtool.sarifutils.files.readFile +import com.saveourtool.sarifutils.files.readLines import io.github.detekt.sarif4k.Replacement import io.github.detekt.sarif4k.SarifSchema210 diff --git a/fixpatches/src/commonTest/kotlin/com/saveourtool/sarifutils/utils/SarifUtilsTest.kt b/fixpatches/src/commonTest/kotlin/com/saveourtool/sarifutils/utils/SarifUtilsTest.kt index 623afa0..2493eb4 100644 --- a/fixpatches/src/commonTest/kotlin/com/saveourtool/sarifutils/utils/SarifUtilsTest.kt +++ b/fixpatches/src/commonTest/kotlin/com/saveourtool/sarifutils/utils/SarifUtilsTest.kt @@ -1,8 +1,5 @@ package com.saveourtool.sarifutils.utils -import com.saveourtool.sarifutils.cli.utils.getUriBaseIdForArtifactLocation -import com.saveourtool.sarifutils.cli.utils.resolveUriBaseId - import io.github.detekt.sarif4k.SarifSchema210 import okio.Path import okio.Path.Companion.toPath diff --git a/fixpatches/src/jvmMain/kotlin/com/saveourtool/sarifutils/cli/files/FileUtils.kt b/fixpatches/src/jvmMain/kotlin/com/saveourtool/sarifutils/files/FileUtils.kt similarity index 77% rename from fixpatches/src/jvmMain/kotlin/com/saveourtool/sarifutils/cli/files/FileUtils.kt rename to fixpatches/src/jvmMain/kotlin/com/saveourtool/sarifutils/files/FileUtils.kt index 2db9910..65af0f1 100644 --- a/fixpatches/src/jvmMain/kotlin/com/saveourtool/sarifutils/cli/files/FileUtils.kt +++ b/fixpatches/src/jvmMain/kotlin/com/saveourtool/sarifutils/files/FileUtils.kt @@ -4,7 +4,7 @@ @file:JvmName("FileUtilsJvm") -package com.saveourtool.sarifutils.cli.files +package com.saveourtool.sarifutils.files import okio.FileSystem diff --git a/fixpatches/src/nativeMain/kotlin/com/saveourtool/sarifutils/cli/files/FileUtils.kt b/fixpatches/src/nativeMain/kotlin/com/saveourtool/sarifutils/files/FileUtils.kt similarity index 73% rename from fixpatches/src/nativeMain/kotlin/com/saveourtool/sarifutils/cli/files/FileUtils.kt rename to fixpatches/src/nativeMain/kotlin/com/saveourtool/sarifutils/files/FileUtils.kt index 1058cb9..1eb3127 100644 --- a/fixpatches/src/nativeMain/kotlin/com/saveourtool/sarifutils/cli/files/FileUtils.kt +++ b/fixpatches/src/nativeMain/kotlin/com/saveourtool/sarifutils/files/FileUtils.kt @@ -2,7 +2,7 @@ * Utility methods to work with file system */ -package com.saveourtool.sarifutils.cli.files +package com.saveourtool.sarifutils.files import okio.FileSystem