Reformat with scalafmt 3.9.7

Executed command: scalafmt --non-interactive
This commit is contained in:
Scala Steward
2025-05-30 14:45:26 +00:00
parent 93de53d717
commit a54fb4960f
12 changed files with 14 additions and 14 deletions

View File

@@ -628,7 +628,7 @@ trait RepositorySettingsControllerBase extends ControllerBase {
new Constraint() {
override def validate(name: String, value: String, messages: Messages): Option[String] =
getAccountByUserName(value) match {
case None => Some("User does not exist.")
case None => Some("User does not exist.")
case Some(x) =>
if (x.userName == params("owner")) {
Some("This is current repository owner.")

View File

@@ -138,7 +138,7 @@ trait ApiGitReferenceControllerBase extends ControllerBase {
val name = RepositoryName(repository)
val result = JsonFormat(revstr match {
case "tags" => repository.tags.map(ApiRef.fromTag(name, _))
case "tags" => repository.tags.map(ApiRef.fromTag(name, _))
case x if x.startsWith("tags/") =>
val tagName = x.substring("tags/".length)
repository.tags.find(_.name == tagName) match {

View File

@@ -29,7 +29,7 @@ trait ApiIssueMilestoneControllerBase extends ControllerBase {
)
}).reverse
state match {
case "all" => JsonFormat(apiMilestones)
case "all" => JsonFormat(apiMilestones)
case "open" | "closed" =>
JsonFormat(
apiMilestones.filter(p => p.state == state)

View File

@@ -59,7 +59,7 @@ trait AccountFederationService {
.orElse(extractSafeStringForUserName(mailAddress)) match {
case Some(safeUserName) =>
getAccountByUserName(safeUserName, includeRemoved = true) match {
case None => Some(safeUserName)
case None => Some(safeUserName)
case Some(_) =>
logger.info(
s"User ($safeUserName) already exists. preferredUserName=$preferredUserName, mailAddress=$mailAddress"

View File

@@ -46,7 +46,7 @@ trait AccountService {
case account if !account.isGroupAccount =>
account.password match {
case pbkdf2re(iter, salt, hash) if (pbkdf2_sha256(iter.toInt, salt, password) == hash) => Some(account)
case p if p == sha1(password) =>
case p if p == sha1(password) =>
updateAccount(account.copy(password = pbkdf2_sha256(password)))
Some(account)
case _ => None

View File

@@ -62,7 +62,7 @@ trait HandleCommentService {
.getOrElse(None -> None)
val commentId = (content, action) match {
case (None, None) => None
case (None, None) => None
case (None, Some(action)) =>
Some(createComment(owner, name, userName, issue.issueId, action.capitalize, action))
case (Some(content), _) =>

View File

@@ -427,7 +427,7 @@ trait PullRequestService {
case Some(patch) =>
file -> comments.foreach { case (commentId, lineNumber) =>
lineNumber match {
case Left(oldLine) => updateCommitCommentPosition(commentId, newCommitId, Some(oldLine), None)
case Left(oldLine) => updateCommitCommentPosition(commentId, newCommitId, Some(oldLine), None)
case Right(newLine) =>
var counter = newLine
patch.getDeltas.asScala.filter(_.getSource.getPosition < newLine).foreach { delta =>

View File

@@ -42,7 +42,7 @@ class ApiAuthenticationFilter extends Filter with AccessTokenService with Accoun
updateLastLoginDate(account.userName)
}
chain.doFilter(req, res)
case None => chain.doFilter(req, res)
case None => chain.doFilter(req, res)
case Some(Left(_)) => {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED)
response.setContentType("application/json; charset=utf-8")

View File

@@ -543,7 +543,7 @@ class WikiCommitHook(owner: String, repository: String, pusher: String, baseUrl:
case ChangeType.ADD | ChangeType.RENAME => "created"
case ChangeType.MODIFY => "edited"
case ChangeType.DELETE => "deleted"
case other =>
case other =>
logger.error(s"Unsupported Wiki action: $other")
"unsupported action"
}
@@ -560,7 +560,7 @@ class WikiCommitHook(owner: String, repository: String, pusher: String, baseUrl:
case "created" => Some(CreateWikiPageInfo(owner, repo, commit.committerName, pageName))
case "edited" => Some(EditWikiPageInfo(owner, repo, commit.committerName, pageName, commit.id))
case "deleted" => Some(DeleteWikiInfo(owner, repo, commit.committerName, pageName))
case other =>
case other =>
logger.info(s"Attempted to build wiki record for unsupported action: $other")
None
}

View File

@@ -10,7 +10,7 @@ object Directory {
val GitBucketHome = (System.getProperty("gitbucket.home") match {
// -Dgitbucket.home=<path>
case path if (path != null) => new File(path)
case _ =>
case _ =>
scala.util.Properties.envOrNone("GITBUCKET_HOME") match {
// environment variable GITBUCKET_HOME
case Some(env) => new File(env)

View File

@@ -669,7 +669,7 @@ object JGitUtil {
val objectId = git.getRepository.resolve(name)
git.getRepository.open(objectId).getType match {
case Constants.OBJ_COMMIT => objectId
case Constants.OBJ_TAG =>
case Constants.OBJ_TAG =>
val ref = git.getRepository.getRefDatabase.findRef(name)
git.getRepository.getRefDatabase.peel(ref).getPeeledObjectId
case _ => ObjectId.zeroId()

View File

@@ -53,8 +53,8 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
def datetimeAgoRecentOnly(date: Date): String = {
val duration = new Date().getTime - date.getTime
timeUnits.find(tuple => duration / tuple._1 > 0) match {
case Some((_, "month")) => s"on ${new SimpleDateFormat("d MMM", Locale.ENGLISH).format(date)}"
case Some((_, "year")) => s"on ${new SimpleDateFormat("d MMM yyyy", Locale.ENGLISH).format(date)}"
case Some((_, "month")) => s"on ${new SimpleDateFormat("d MMM", Locale.ENGLISH).format(date)}"
case Some((_, "year")) => s"on ${new SimpleDateFormat("d MMM yyyy", Locale.ENGLISH).format(date)}"
case Some((unitValue, unitString)) =>
val value = duration / unitValue
s"${value} ${unitString}${if (value > 1) "s" else ""} ago"