Skip to content

Commit

Permalink
refactor: renaming for fix testS
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 26, 2023
1 parent 301af44 commit f22c2f6
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class RelatedCodeStrategyBuilder(private val context: JobContext) : CodeStrategy
.filter {
it.afterCursor.isNotBlank() && it.beforeCursor.isNotBlank()
}
.take(context.maxCompletionInOneFile)
.take(context.maxTypedCompletionSize)
.map {
RelatedCodeIns(
language = language,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class InstructionFileJob(
companion object {
fun from(fileJob: FileJob): InstructionFileJob {
val content = removeMultipleComments(fileJob.language, fileJob.content.decodeToString())
// todo : remove comments
return InstructionFileJob(
code = content,
fileSummary = fileJob
Expand All @@ -38,8 +37,6 @@ fun removeMultipleComments(language: String, code: String): String {
return when (language.lowercase()) {
"java" -> {
val matcher = pattern.matcher(code)

// 用空字符串替换注释
return matcher.replaceAll("")
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
package cc.unitmesh.pick.worker.job

import cc.unitmesh.pick.option.InsOutputConfig
import cc.unitmesh.core.completion.CompletionBuilderType
import cc.unitmesh.pick.threshold.InsQualityThreshold
import cc.unitmesh.pick.option.InsOutputConfig
import cc.unitmesh.pick.project.ProjectContext
import cc.unitmesh.pick.threshold.InsQualityThreshold
import cc.unitmesh.quality.CodeQualityType
import kotlinx.serialization.Serializable
import org.archguard.scanner.analyser.count.FileJob


@Serializable
data class JobContext(
val job: InstructionFileJob,
val qualityTypes: List<CodeQualityType>,
val fileTree: HashMap<String, InstructionFileJob>,
val insOutputConfig: InsOutputConfig = InsOutputConfig(),
val completionBuilderTypes: List<CompletionBuilderType>,
val maxCompletionInOneFile: Int,
val maxTypedCompletionSize: Int,
val project: ProjectContext = ProjectContext(),
val insQualityThreshold: InsQualityThreshold,
) {
Expand All @@ -29,7 +28,7 @@ data class JobContext(
qualityTypes = listOf(),
fileTree = fileTree,
completionBuilderTypes = listOf(),
maxCompletionInOneFile = 3,
maxTypedCompletionSize = InsQualityThreshold.MAX_PROJECT_TYPED_COMPLETION_SIZE,
insQualityThreshold = InsQualityThreshold()
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class HelloController {
fileTree = hashMapOf("" to job),
insOutputConfig = InsOutputConfig(),
completionBuilderTypes = listOf(CompletionBuilderType.IN_BLOCK_COMPLETION),
maxCompletionInOneFile = 3,
maxTypedCompletionSize = 3,
insQualityThreshold = InsQualityThreshold()
)
val builder = RelatedCodeStrategyBuilder(context)
Expand Down Expand Up @@ -87,7 +87,7 @@ public class HelloController {
fileTree = hashMapOf("" to job),
insOutputConfig = InsOutputConfig(),
completionBuilderTypes = listOf(CompletionBuilderType.IN_BLOCK_COMPLETION),
maxCompletionInOneFile = 3,
maxTypedCompletionSize = 3,
insQualityThreshold = InsQualityThreshold()
)
val builder = RelatedCodeStrategyBuilder(context)
Expand Down Expand Up @@ -135,7 +135,7 @@ public class HelloController {
),
insOutputConfig = InsOutputConfig(),
completionBuilderTypes = listOf(CompletionBuilderType.IN_BLOCK_COMPLETION),
maxCompletionInOneFile = 3,
maxTypedCompletionSize = 3,
insQualityThreshold = InsQualityThreshold()
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class HelloController {
fileTree = hashMapOf("" to job),
insOutputConfig = InsOutputConfig(),
completionBuilderTypes = listOf(CompletionBuilderType.IN_BLOCK_COMPLETION),
maxCompletionInOneFile = 3,
maxTypedCompletionSize = 3,
insQualityThreshold = InsQualityThreshold()
)
val builder = SimilarChunksStrategyBuilder(context)
Expand Down Expand Up @@ -93,7 +93,7 @@ public class HelloController {
),
insOutputConfig = InsOutputConfig(),
completionBuilderTypes = listOf(CompletionBuilderType.IN_BLOCK_COMPLETION),
maxCompletionInOneFile = 3,
maxTypedCompletionSize = 3,
insQualityThreshold = InsQualityThreshold()
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public class CompanyService {
),
insOutputConfig = InsOutputConfig(),
completionBuilderTypes = listOf(CompletionBuilderType.TEST_CODE_GEN),
maxCompletionInOneFile = 3,
maxTypedCompletionSize = 3,
insQualityThreshold = InsQualityThreshold()
)

Expand Down

0 comments on commit f22c2f6

Please sign in to comment.