mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-01 11:06:06 +01:00
Update scalafmt setting
use new syntax. prepare Scala 3.4
This commit is contained in:
@@ -12,3 +12,13 @@ continuationIndent.defnSite = 2
|
||||
danglingParentheses.preset = true
|
||||
runner.dialect = scala213source3
|
||||
rewrite.trailingCommas.style = keep
|
||||
fileOverride {
|
||||
"glob:**/*.sbt" {
|
||||
runner.dialect = scala212
|
||||
rewrite.scala3.convertToNewSyntax = false
|
||||
}
|
||||
}
|
||||
rewrite.scala3.convertToNewSyntax = true
|
||||
runner.dialectOverride.allowSignificantIndentation = false
|
||||
runner.dialectOverride.allowAsForImportRename = false
|
||||
runner.dialectOverride.allowStarWildcardImport = false
|
||||
|
||||
@@ -112,13 +112,13 @@ trait DashboardControllerBase extends ControllerBase {
|
||||
val condition = getOrCreateCondition(Keys.Session.DashboardIssues, filter, userName)
|
||||
val userRepos = getUserRepositories(userName, true).map(repo => repo.owner -> repo.name)
|
||||
val page = IssueSearchCondition.page(request)
|
||||
val issues = searchIssue(condition, IssueSearchOption.Issues, (page - 1) * IssueLimit, IssueLimit, userRepos: _*)
|
||||
val issues = searchIssue(condition, IssueSearchOption.Issues, (page - 1) * IssueLimit, IssueLimit, userRepos*)
|
||||
|
||||
html.issues(
|
||||
issues.map(issue => (issue, None)),
|
||||
page,
|
||||
countIssue(condition.copy(state = "open"), IssueSearchOption.Issues, userRepos: _*),
|
||||
countIssue(condition.copy(state = "closed"), IssueSearchOption.Issues, userRepos: _*),
|
||||
countIssue(condition.copy(state = "open"), IssueSearchOption.Issues, userRepos*),
|
||||
countIssue(condition.copy(state = "closed"), IssueSearchOption.Issues, userRepos*),
|
||||
filter match {
|
||||
case "assigned" => condition.copy(assigned = Some(Some(userName)))
|
||||
case "mentioned" => condition.copy(mentioned = Some(userName))
|
||||
@@ -149,7 +149,7 @@ trait DashboardControllerBase extends ControllerBase {
|
||||
IssueSearchOption.PullRequests,
|
||||
(page - 1) * PullRequestLimit,
|
||||
PullRequestLimit,
|
||||
allRepos: _*
|
||||
allRepos*
|
||||
)
|
||||
val status = issues.map { issue =>
|
||||
issue.commitId.flatMap { commitId =>
|
||||
@@ -160,8 +160,8 @@ trait DashboardControllerBase extends ControllerBase {
|
||||
html.pulls(
|
||||
issues.zip(status),
|
||||
page,
|
||||
countIssue(condition.copy(state = "open"), IssueSearchOption.PullRequests, allRepos: _*),
|
||||
countIssue(condition.copy(state = "closed"), IssueSearchOption.PullRequests, allRepos: _*),
|
||||
countIssue(condition.copy(state = "open"), IssueSearchOption.PullRequests, allRepos*),
|
||||
countIssue(condition.copy(state = "closed"), IssueSearchOption.PullRequests, allRepos*),
|
||||
filter match {
|
||||
case "assigned" => condition.copy(assigned = Some(Some(userName)))
|
||||
case "mentioned" => condition.copy(mentioned = Some(userName))
|
||||
|
||||
@@ -549,7 +549,7 @@ trait SystemSettingsControllerBase extends AccountManagementControllerBase {
|
||||
})
|
||||
|
||||
private def multiLineText(constraints: Constraint*): SingleValueType[Seq[String]] =
|
||||
new SingleValueType[Seq[String]](constraints: _*) {
|
||||
new SingleValueType[Seq[String]](constraints*) {
|
||||
def convert(value: String, messages: Messages): Seq[String] = {
|
||||
if (value == null) {
|
||||
Nil
|
||||
|
||||
@@ -3,7 +3,7 @@ package gitbucket.core.model
|
||||
protected[model] trait TemplateComponent { self: Profile =>
|
||||
import profile.api._
|
||||
|
||||
trait BasicTemplate { self: Table[_] =>
|
||||
trait BasicTemplate { self: Table[?] =>
|
||||
val userName = column[String]("USER_NAME")
|
||||
val repositoryName = column[String]("REPOSITORY_NAME")
|
||||
|
||||
@@ -18,7 +18,7 @@ protected[model] trait TemplateComponent { self: Profile =>
|
||||
(this.userName === userName) && (this.repositoryName === repositoryName)
|
||||
}
|
||||
|
||||
trait IssueTemplate extends BasicTemplate { self: Table[_] =>
|
||||
trait IssueTemplate extends BasicTemplate { self: Table[?] =>
|
||||
val issueId = column[Int]("ISSUE_ID")
|
||||
|
||||
def byIssue(owner: String, repository: String, issueId: Int) =
|
||||
@@ -28,7 +28,7 @@ protected[model] trait TemplateComponent { self: Profile =>
|
||||
byRepository(userName, repositoryName) && (this.issueId === issueId)
|
||||
}
|
||||
|
||||
trait LabelTemplate extends BasicTemplate { self: Table[_] =>
|
||||
trait LabelTemplate extends BasicTemplate { self: Table[?] =>
|
||||
val labelId = column[Int]("LABEL_ID")
|
||||
val labelName = column[String]("LABEL_NAME")
|
||||
|
||||
@@ -42,7 +42,7 @@ protected[model] trait TemplateComponent { self: Profile =>
|
||||
byRepository(owner, repository) && (this.labelName === labelName.bind)
|
||||
}
|
||||
|
||||
trait PriorityTemplate extends BasicTemplate { self: Table[_] =>
|
||||
trait PriorityTemplate extends BasicTemplate { self: Table[?] =>
|
||||
val priorityId = column[Int]("PRIORITY_ID")
|
||||
val priorityName = column[String]("PRIORITY_NAME")
|
||||
|
||||
@@ -56,7 +56,7 @@ protected[model] trait TemplateComponent { self: Profile =>
|
||||
byRepository(owner, repository) && (this.priorityName === priorityName.bind)
|
||||
}
|
||||
|
||||
trait MilestoneTemplate extends BasicTemplate { self: Table[_] =>
|
||||
trait MilestoneTemplate extends BasicTemplate { self: Table[?] =>
|
||||
val milestoneId = column[Int]("MILESTONE_ID")
|
||||
|
||||
def byMilestone(owner: String, repository: String, milestoneId: Int) =
|
||||
@@ -66,7 +66,7 @@ protected[model] trait TemplateComponent { self: Profile =>
|
||||
byRepository(userName, repositoryName) && (this.milestoneId === milestoneId)
|
||||
}
|
||||
|
||||
trait CommitTemplate extends BasicTemplate { self: Table[_] =>
|
||||
trait CommitTemplate extends BasicTemplate { self: Table[?] =>
|
||||
val commitId = column[String]("COMMIT_ID")
|
||||
|
||||
def byCommit(owner: String, repository: String, commitId: String) =
|
||||
@@ -76,7 +76,7 @@ protected[model] trait TemplateComponent { self: Profile =>
|
||||
byRepository(userName, repositoryName) && (this.commitId === commitId)
|
||||
}
|
||||
|
||||
trait BranchTemplate extends BasicTemplate { self: Table[_] =>
|
||||
trait BranchTemplate extends BasicTemplate { self: Table[?] =>
|
||||
val branch = column[String]("BRANCH")
|
||||
def byBranch(owner: String, repository: String, branchName: String) =
|
||||
byRepository(owner, repository) && (branch === branchName.bind)
|
||||
|
||||
@@ -307,7 +307,7 @@ object PluginRegistry {
|
||||
conn,
|
||||
classLoader,
|
||||
DatabaseConfig.liquiDriver,
|
||||
new Module(plugin.pluginId, plugin.versions: _*)
|
||||
new Module(plugin.pluginId, plugin.versions*)
|
||||
)
|
||||
conn.commit()
|
||||
|
||||
|
||||
@@ -563,7 +563,7 @@ object MergeService {
|
||||
): ObjectId = {
|
||||
val mergeCommit = new CommitBuilder()
|
||||
mergeCommit.setTreeId(treeId)
|
||||
mergeCommit.setParentIds(parents: _*)
|
||||
mergeCommit.setParentIds(parents*)
|
||||
mergeCommit.setAuthor(committer)
|
||||
mergeCommit.setCommitter(committer)
|
||||
mergeCommit.setMessage(message)
|
||||
|
||||
@@ -7,7 +7,7 @@ import gitbucket.core.controller.Context
|
||||
import gitbucket.core.model.Profile.*
|
||||
import gitbucket.core.model.Profile.profile.blockingApi.*
|
||||
import gitbucket.core.model.activity.OpenPullRequestInfo
|
||||
import gitbucket.core.model.{CommitComments as _, Session as _, *}
|
||||
import gitbucket.core.model.{CommitComments => _, Session => _, *}
|
||||
import gitbucket.core.plugin.PluginRegistry
|
||||
import gitbucket.core.service.RepositoryService.RepositoryInfo
|
||||
import gitbucket.core.service.SystemSettingsService.SystemSettings
|
||||
|
||||
@@ -120,14 +120,14 @@ trait RepositoryService {
|
||||
deleteRepositoryOnModel(oldUserName, oldRepositoryName)
|
||||
|
||||
RepositoryWebHooks.insertAll(
|
||||
webHooks.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)): _*
|
||||
webHooks.map(_.copy(userName = newUserName, repositoryName = newRepositoryName))*
|
||||
)
|
||||
RepositoryWebHookEvents.insertAll(
|
||||
webHookEvents.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)): _*
|
||||
webHookEvents.map(_.copy(userName = newUserName, repositoryName = newRepositoryName))*
|
||||
)
|
||||
Milestones.insertAll(milestones.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)): _*)
|
||||
Priorities.insertAll(priorities.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)): _*)
|
||||
IssueId.insertAll(issueId.map(_.copy(_1 = newUserName, _2 = newRepositoryName)): _*)
|
||||
Milestones.insertAll(milestones.map(_.copy(userName = newUserName, repositoryName = newRepositoryName))*)
|
||||
Priorities.insertAll(priorities.map(_.copy(userName = newUserName, repositoryName = newRepositoryName))*)
|
||||
IssueId.insertAll(issueId.map(_.copy(_1 = newUserName, _2 = newRepositoryName))*)
|
||||
|
||||
val newMilestones = Milestones.filter(_.byRepository(newUserName, newRepositoryName)).list
|
||||
val newPriorities = Priorities.filter(_.byRepository(newUserName, newRepositoryName)).list
|
||||
@@ -145,31 +145,31 @@ trait RepositoryService {
|
||||
.priorityId
|
||||
}
|
||||
)
|
||||
}: _*)
|
||||
}*)
|
||||
|
||||
PullRequests.insertAll(
|
||||
pullRequests.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)): _*
|
||||
pullRequests.map(_.copy(userName = newUserName, repositoryName = newRepositoryName))*
|
||||
)
|
||||
IssueComments.insertAll(
|
||||
issueComments.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)): _*
|
||||
issueComments.map(_.copy(userName = newUserName, repositoryName = newRepositoryName))*
|
||||
)
|
||||
Labels.insertAll(labels.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)): _*)
|
||||
Labels.insertAll(labels.map(_.copy(userName = newUserName, repositoryName = newRepositoryName))*)
|
||||
CommitComments.insertAll(
|
||||
commitComments.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)): _*
|
||||
commitComments.map(_.copy(userName = newUserName, repositoryName = newRepositoryName))*
|
||||
)
|
||||
CommitStatuses.insertAll(
|
||||
commitStatuses.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)): _*
|
||||
commitStatuses.map(_.copy(userName = newUserName, repositoryName = newRepositoryName))*
|
||||
)
|
||||
ProtectedBranches.insertAll(
|
||||
protectedBranches.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)): _*
|
||||
protectedBranches.map(_.copy(userName = newUserName, repositoryName = newRepositoryName))*
|
||||
)
|
||||
ProtectedBranchContexts.insertAll(
|
||||
protectedBranchContexts.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)): _*
|
||||
protectedBranchContexts.map(_.copy(userName = newUserName, repositoryName = newRepositoryName))*
|
||||
)
|
||||
DeployKeys.insertAll(deployKeys.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)): _*)
|
||||
ReleaseTags.insertAll(releases.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)): _*)
|
||||
DeployKeys.insertAll(deployKeys.map(_.copy(userName = newUserName, repositoryName = newRepositoryName))*)
|
||||
ReleaseTags.insertAll(releases.map(_.copy(userName = newUserName, repositoryName = newRepositoryName))*)
|
||||
ReleaseAssets.insertAll(
|
||||
releaseAssets.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)): _*
|
||||
releaseAssets.map(_.copy(userName = newUserName, repositoryName = newRepositoryName))*
|
||||
)
|
||||
|
||||
// Update source repository of pull requests
|
||||
@@ -193,12 +193,12 @@ trait RepositoryService {
|
||||
userName = newUserName,
|
||||
repositoryName = newRepositoryName
|
||||
)
|
||||
): _*
|
||||
)*
|
||||
)
|
||||
|
||||
// TODO Drop transferred owner from collaborators?
|
||||
Collaborators.insertAll(
|
||||
collaborators.map(_.copy(userName = newUserName, repositoryName = newRepositoryName)): _*
|
||||
collaborators.map(_.copy(userName = newUserName, repositoryName = newRepositoryName))*
|
||||
)
|
||||
|
||||
// Move git repository
|
||||
|
||||
@@ -19,13 +19,13 @@ object JDBCUtil {
|
||||
implicit class RichConnection(private val conn: Connection) extends AnyVal {
|
||||
|
||||
def update(sql: String, params: Any*): Int = {
|
||||
execute(sql, params: _*) { stmt =>
|
||||
execute(sql, params*) { stmt =>
|
||||
stmt.executeUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
def find[T](sql: String, params: Any*)(f: ResultSet => T): Option[T] = {
|
||||
execute(sql, params: _*) { stmt =>
|
||||
execute(sql, params*) { stmt =>
|
||||
Using.resource(stmt.executeQuery()) { rs =>
|
||||
if (rs.next) Some(f(rs)) else None
|
||||
}
|
||||
@@ -33,7 +33,7 @@ object JDBCUtil {
|
||||
}
|
||||
|
||||
def select[T](sql: String, params: Any*)(f: ResultSet => T): Seq[T] = {
|
||||
execute(sql, params: _*) { stmt =>
|
||||
execute(sql, params*) { stmt =>
|
||||
Using.resource(stmt.executeQuery()) { rs =>
|
||||
val list = new ListBuffer[T]
|
||||
while (rs.next) {
|
||||
@@ -45,7 +45,7 @@ object JDBCUtil {
|
||||
}
|
||||
|
||||
def selectInt(sql: String, params: Any*): Int = {
|
||||
execute(sql, params: _*) { stmt =>
|
||||
execute(sql, params*) { stmt =>
|
||||
Using.resource(stmt.executeQuery()) { rs =>
|
||||
if (rs.next) rs.getInt(1) else 0
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ trait Validations {
|
||||
* ValueType for the java.util.Date property.
|
||||
*/
|
||||
def date(constraints: Constraint*): SingleValueType[java.util.Date] =
|
||||
new SingleValueType[java.util.Date]((pattern("\\d{4}-\\d{2}-\\d{2}") +: constraints): _*) {
|
||||
new SingleValueType[java.util.Date]((pattern("\\d{4}-\\d{2}-\\d{2}") +: constraints)*) {
|
||||
def convert(value: String, messages: Messages): java.util.Date =
|
||||
new java.text.SimpleDateFormat("yyyy-MM-dd").parse(value)
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class GitBucketCoreModuleSpec extends AnyFunSuite {
|
||||
Seq("8.0", "5.7").foreach { tag =>
|
||||
test(s"Migration MySQL $tag", ExternalDBTest) {
|
||||
val container = new MySQLContainer() {
|
||||
override val container: org.testcontainers.containers.MySQLContainer[_] =
|
||||
override val container: org.testcontainers.containers.MySQLContainer[?] =
|
||||
new org.testcontainers.containers.MySQLContainer(s"mysql:$tag") {
|
||||
override def getDriverClassName = "org.mariadb.jdbc.Driver"
|
||||
override def getJdbcUrl: String = super.getJdbcUrl + "?permitMysqlScheme"
|
||||
|
||||
@@ -115,7 +115,7 @@ object GitSpecUtil {
|
||||
// creates merge commit
|
||||
val mergeCommit = new CommitBuilder()
|
||||
mergeCommit.setTreeId(merger.getResultTreeId)
|
||||
mergeCommit.setParentIds(Array[ObjectId](mergeBaseTip, mergeTip): _*)
|
||||
mergeCommit.setParentIds(Array[ObjectId](mergeBaseTip, mergeTip)*)
|
||||
mergeCommit.setAuthor(committer)
|
||||
mergeCommit.setCommitter(committer)
|
||||
mergeCommit.setMessage(message)
|
||||
|
||||
Reference in New Issue
Block a user