Skip to content

Commit

Permalink
refactor: simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 6, 2023
1 parent d4179c3 commit 5519222
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 21 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ configure(allprojects) {
}
}
scm {
connection.set("scm:git:git://github.com/unit-mesh/unit-eval.git")
developerConnection.set("scm:git:ssh://github.com/unit-mesh/unit-eval.git")
connection.set("scm:git:git://github.com/unit-mesh/unit-pick.git")
developerConnection.set("scm:git:ssh://github.com/unit-mesh/unit-pick.git")
url.set("https://github.com/unit-mesh/unit-eval/")
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ set -- \
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# character that might be a shell metacharacter, then use pick to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
include(
"unit-core",
"unit-picker",
"unit-eval",
"unit-pick",

"code-quality"
)
4 changes: 2 additions & 2 deletions unit-eval/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ tasks.test {


application {
mainClass.set("cc.unitmesh.eval.checker.MainKt")
mainClass.set("cc.unitmesh.pick.checker.MainKt")
}

tasks {
shadowJar {
manifest {
attributes(Pair("Main-Class", "cc.unitmesh.eval.checker.MainKt"))
attributes(Pair("Main-Class", "cc.unitmesh.pick.checker.MainKt"))
}
// minimize()
dependencies {
Expand Down
4 changes: 2 additions & 2 deletions unit-picker/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ tasks.test {
}

application {
mainClass.set("cc.unitmesh.eval.picker.MainKt")
mainClass.set("cc.unitmesh.pick.MainKt")
}

tasks {
shadowJar {
manifest {
attributes(Pair("Main-Class", "cc.unitmesh.eval.picker.MainKt"))
attributes(Pair("Main-Class", "cc.unitmesh.pick.MainKt"))
}
// minimize()
dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package cc.unitmesh.eval.picker
package cc.unitmesh.pick

import cc.unitmesh.pick.picker.CodePicker
import cc.unitmesh.pick.picker.PickerConfig
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.default
import com.github.ajalt.clikt.parameters.options.option
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cc.unitmesh.eval.picker
package cc.unitmesh.pick.picker

import org.archguard.action.checkout.GitSourceSettings
import org.archguard.action.checkout.executeGitCheckout
Expand Down Expand Up @@ -68,10 +68,10 @@ class CodePicker(val config: PickerConfig) {
*
* for example:
*
* - `https://github.com/unit-mesh/unit-eval` tobe `github.com/unit-mesh/unit-eval`
* - `git://github.com/unit-mesh/unit-eval` tobe `github.com/unit-mesh/unit-eval`
* - `git://github.com/unit-mesh/unit-eval.git` tobe `github.com/unit-mesh/unit-eval`
* - `http://github.com/unit-mesh/unit-eval` tobe `github.com/unit-mesh/unit-eval`
* - `https://github.com/unit-mesh/unit-pick` tobe `github.com/unit-mesh/unit-pick`
* - `git://github.com/unit-mesh/unit-pick` tobe `github.com/unit-mesh/unit-pick`
* - `git://github.com/unit-mesh/unit-pick.git` tobe `github.com/unit-mesh/unit-pick`
* - `http://github.com/unit-mesh/unit-pick` tobe `github.com/unit-mesh/unit-pick`
*
*/
fun gitUrlToPath(url: String): String {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cc.unitmesh.eval.picker
package cc.unitmesh.pick.picker

data class PickerConfig(
val url: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package cc.unitmesh.pick.picker

enum class ToolingPromptType {
/**
* like GitHub Copilot, use similar chunk of code to complete
*/
INLINE_CODE_COMPLETION,

/**
* like GitHub Copilot, use similar chunk of code to complete
*/
IN_BLOCK_CODE_COMPLETION,

/**
* like GitHub Copilot, use similar chunk of code to complete
*/
AFTER_BLOCK_CODE_COMPLETION,

/**
* like AutoDev, use Static Program Analysis for code based on imports
*/
RELATED_CODE_COMPLETION,
CODE_DIFF,
REFACTOR,
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cc.unitmesh.eval.picker.worker
package cc.unitmesh.pick.worker

abstract class AbstractWorker {
abstract suspend fun start(filePath: String)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cc.unitmesh.eval.picker.worker
package cc.unitmesh.pick.worker

import kotlinx.coroutines.coroutineScope
import org.archguard.scanner.analyser.count.FileJob
Expand All @@ -12,7 +12,7 @@ import org.archguard.scanner.analyser.count.FileJob
* | b05d38f6 | 1 | 1 | 1 | 1 |
* | 99ac469e | 1 | 1 | 1 | 1 |
*
* We have different strategies to build the eval datasets.
* We have different strategies to build the pick datasets.
*
* - by Horizontal (with Import File):
* - by Vertical (with History Change):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cc.unitmesh.eval.picker.worker
package cc.unitmesh.pick.worker

object WorkerDispatch {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cc.unitmesh.eval.picker;
package cc.unitmesh.pick.picker;

import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
Expand All @@ -8,7 +8,7 @@ class CodePickerTest {
fun should_return_unique_path() {
// based on: https://www.debuggex.com/r/fFggA8Uc4YYKjl34
assertEquals(
"github.com/unit-mesh/unit-eval",
"github.com/unit-mesh/unit-pick",
CodePicker.gitUrlToPath("https://github.com/unit-mesh/unit-eval")
)
assertEquals(
Expand Down

0 comments on commit 5519222

Please sign in to comment.