Skip to content

Commit

Permalink
Apply scalafmt and require scalafmtCheck during CI build
Browse files Browse the repository at this point in the history
  • Loading branch information
ljdelight authored and jschwarz2030 committed Sep 21, 2022
1 parent 1c2f715 commit adc19cf
Show file tree
Hide file tree
Showing 33 changed files with 18 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
- name: Run sbt compile
env:
CI: true
run: sbt -Dsbt.log.format=false compile
run: sbt -Dsbt.log.format=false scalafmtCheckAll compile
- name: Create the dev.conf
run: |
touch ./conf/dev.conf
Expand Down
1 change: 0 additions & 1 deletion app/org/maproulette/data/SnapshotManager.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/
package org.maproulette.data


import anorm.SqlParser._
import anorm._
import javax.inject.{Inject, Singleton}
Expand Down
2 changes: 1 addition & 1 deletion app/org/maproulette/filters/Filters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ import play.filters.gzip.GzipFilter
* @author cuthbertm
*/
class Filters @Inject() (corsFilter: CORSFilter, gzipFilter: GzipFilter)
extends DefaultHttpFilters(corsFilter, gzipFilter)
extends DefaultHttpFilters(corsFilter, gzipFilter)
6 changes: 3 additions & 3 deletions app/org/maproulette/filters/HttpLoggingFilter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import scala.concurrent.Future
import scala.concurrent.ExecutionContext

/**
* Filter to provide an http request log at the service side. The HttpLoggingFilter is enabled by default within
* application.conf but will create no output until logback is set to the debug or trace levels.
*/
* Filter to provide an http request log at the service side. The HttpLoggingFilter is enabled by default within
* application.conf but will create no output until logback is set to the debug or trace levels.
*/
class HttpLoggingFilter @Inject() (implicit val mat: Materializer, ec: ExecutionContext)
extends Filter {
def apply(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.maproulette.framework.controller


import javax.inject.Inject
import org.maproulette.data.ActionManager
import org.maproulette.exception.NotFoundException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import org.maproulette.utils.{Crypto, Utils}
import play.api.libs.json._
import play.api.mvc._


/**
* @author nrotstan
*/
Expand All @@ -28,7 +27,6 @@ class NotificationController @Inject() (
) extends AbstractController(components)
with DefaultWrites {


implicit val notificationSubscriptionReads =
NotificationSubscriptions.notificationSubscriptionReads
implicit val notificationSubscriptionWrites =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.maproulette.framework.controller


import javax.inject.Inject
import org.maproulette.exception.InvalidException
import org.maproulette.data._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ import org.maproulette.framework.psql.Paging
import org.maproulette.framework.model.{Challenge, ChallengeListing, Project, User, Tag, Task}
import org.maproulette.framework.mixins.{ParentMixin, TagsControllerMixin}
import org.maproulette.framework.repository.TaskRepository
import org.maproulette.session.{
SessionManager,
SearchParameters,
SearchLocation
}
import org.maproulette.session.{SessionManager, SearchParameters, SearchLocation}
import org.maproulette.utils.Utils
import play.api.mvc._
import play.api.libs.json._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ import org.maproulette.framework.service.{
UserService
}
import org.maproulette.framework.psql.Paging
import org.maproulette.framework.model.{
Challenge,
User,
ReviewMetrics,
Task
}
import org.maproulette.framework.model.{Challenge, User, ReviewMetrics, Task}
import org.maproulette.session.{SessionManager, SearchParameters, SearchTaskParameters}
import org.maproulette.utils.Utils
import play.api.mvc._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.maproulette.framework.controller


import javax.inject.Inject
import org.maproulette.data.ActionManager
import org.maproulette.exception.{MPExceptionUtil, StatusMessage}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ package org.maproulette.framework.controller

import javax.inject.Inject
import org.maproulette.exception.{InvalidException, NotFoundException, StatusMessage}
import org.maproulette.framework.model.{
Challenge,
User,
UserSettings,
GrantTarget,
Task
}
import org.maproulette.framework.model.{Challenge, User, UserSettings, GrantTarget, Task}
import org.maproulette.framework.psql.Paging
import org.maproulette.framework.service.ServiceManager
import org.maproulette.framework.mixins.ParentMixin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import org.maproulette.framework.psql.{AND, OR}
import org.maproulette.framework.model.{TaskReview, Project, Challenge, Task}
import play.api.libs.json.JsDefined


trait SearchParametersMixin {

/**
Expand Down
2 changes: 0 additions & 2 deletions app/org/maproulette/framework/mixins/TaskFilterMixin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
*/
package org.maproulette.framework.mixins


import org.maproulette.framework.model.{User, Challenge, Project}
import org.maproulette.framework.psql.{Query, _}
import org.maproulette.framework.psql.filter._
import org.maproulette.data.Actions


/**
* TaskFilterMixin provides task related methods
*/
Expand Down
1 change: 0 additions & 1 deletion app/org/maproulette/framework/mixins/TaskParserMixin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import org.joda.time.DateTime

import org.maproulette.framework.model.{TaskReview, TaskReviewFields, TaskWithReview, Task}


/**
* TaskParserMixin provides task parsers
*/
Expand Down
2 changes: 1 addition & 1 deletion app/org/maproulette/framework/model/TaskLogEntry.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ case class TaskLogEntry(
reviewRequestedBy: Option[Int],
reviewedBy: Option[Int],
comment: Option[String],
errorTags: Option[String],
errorTags: Option[String]
) {}

object TaskLogEntry {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.maproulette.framework.repository


import javax.inject.{Inject, Singleton}
import org.maproulette.framework.psql.Query
import org.maproulette.framework.psql.filter.BaseParameter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.maproulette.framework.repository


import anorm.SqlParser.{get, scalar, str}
import anorm.ToParameterValue
import anorm._, postgresql._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ class TaskReviewRepository @Inject() (
.executeUpdate()

for (task <- taskList) {
var querystring = """UPDATE task_review SET review_claimed_by = {userId}, review_claimed_at = NOW(), review_started_at = NOW()
var querystring =
"""UPDATE task_review SET review_claimed_by = {userId}, review_claimed_at = NOW(), review_started_at = NOW()
WHERE task_id = {taskId} AND review_claimed_at IS NULL"""

//don't reset review_started_at if task has already been reviewed
if (!task.review.reviewedAt.isEmpty) {
querystring = """UPDATE task_review SET review_claimed_by = {userId}, review_claimed_at = NOW()
querystring =
"""UPDATE task_review SET review_claimed_by = {userId}, review_claimed_at = NOW()
WHERE task_id = {taskId} AND review_claimed_at IS NULL"""
}

Expand Down
1 change: 0 additions & 1 deletion app/org/maproulette/framework/service/GrantService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.maproulette.framework.service


import javax.inject.{Inject, Singleton}
import org.maproulette.Config
import org.maproulette.exception.InvalidException
Expand Down
1 change: 0 additions & 1 deletion app/org/maproulette/framework/service/GroupService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.maproulette.framework.service


import javax.inject.{Inject, Singleton}
import org.maproulette.framework.model.{Group, GroupMember, MemberObject}
import org.maproulette.data.{ItemType}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.maproulette.framework.service


import javax.inject.{Inject, Singleton}
import org.maproulette.exception.{InvalidException, NotFoundException}
import org.maproulette.data.{UserType}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TaskClusterService @Inject() (repository: TaskClusterRepository)
numberOfPoints: Int = this.repository.DEFAULT_NUMBER_OF_POINTS
): List[TaskCluster] = {
val filtered = this.filterOnSearchParameters(params)(false)
val query = this.filterOutDeletedParents(filtered)
val query = this.filterOutDeletedParents(filtered)

this.repository.queryTaskClusters(query, numberOfPoints, params)
}
Expand Down
1 change: 0 additions & 1 deletion app/org/maproulette/framework/service/TeamService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.maproulette.framework.service


import javax.inject.{Inject, Singleton}
import org.maproulette.exception.{InvalidException, NotFoundException}
import org.maproulette.framework.model._
Expand Down
3 changes: 1 addition & 2 deletions app/org/maproulette/models/dal/ChallengeDAL.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,7 @@ class ChallengeDAL @Inject() (
* @param c an implicit connection
*/
def moveChallenges(newParent: Long, challengeIds: List[Long], user: User)(
implicit c: Option[Connection] = None
implicit c: Option[Connection] = None
): List[Long] = {
this.permission.hasAdminAccess(ProjectType(), user)(newParent)
this.serviceManager.project.retrieve(newParent) match {
Expand Down Expand Up @@ -1469,7 +1469,6 @@ class ChallengeDAL @Inject() (
movedChallengeIds.toList
}


/**
* Update the popularity score of the given challenge following completion of a task.
* Challenge popularity p is calculated with the simple formula p = (p + t) / 2 where
Expand Down
9 changes: 1 addition & 8 deletions app/org/maproulette/models/dal/TaskDAL.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,7 @@ import org.locationtech.jts.geom.Envelope
import org.maproulette.Config
import org.maproulette.data._
import org.maproulette.exception.{InvalidException, NotFoundException}
import org.maproulette.framework.model.{
Challenge,
Project,
StatusActions,
User,
GrantTarget,
Task
}
import org.maproulette.framework.model.{Challenge, Project, StatusActions, User, GrantTarget, Task}
import org.maproulette.framework.psql.filter.{BaseParameter, SubQueryFilter}
import org.maproulette.framework.psql.{Order, Paging, Query}
import org.maproulette.framework.repository.{ProjectRepository, TaskRepository}
Expand Down
1 change: 0 additions & 1 deletion app/org/maproulette/provider/EmailProvider.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import org.maproulette.framework.model.{UserNotification, UserNotificationEmail}
@Singleton
class EmailProvider @Inject() (mailerClient: MailerClient, config: Config) {


def emailNotification(toAddress: String, notification: UserNotificationEmail) = {
val notificationName =
UserNotification.notificationTypeMap.get(notification.notificationType).get
Expand Down
1 change: 0 additions & 1 deletion app/org/maproulette/session/TaskPropertySearch.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/
package org.maproulette.session


import org.maproulette.exception.InvalidException

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.maproulette.framework.repository


import org.maproulette.framework.model.{User, Task}
import org.maproulette.framework.util.{TaskTag, FrameworkHelper}
import org.maproulette.framework.psql.Query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.maproulette.framework.repository


import org.maproulette.data.{Actions, TaskItem, ActionManager, TaskStatusSet}
import org.maproulette.framework.model.{User, TaskLogEntry, Task}
import org.maproulette.framework.util.{TaskTag, FrameworkHelper}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.maproulette.framework.repository


import org.maproulette.framework.model.User
import org.maproulette.framework.util.{TaskReviewTag, FrameworkHelper}
import play.api.Application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
package org.maproulette.framework.repository

import org.maproulette.framework.model.User
import org.maproulette.framework.util.{
FrameworkHelper,
UserSavedObjectsRepoTag
}
import org.maproulette.framework.util.{FrameworkHelper, UserSavedObjectsRepoTag}
import play.api.Application

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.maproulette.framework.service


import org.maproulette.framework.util.{ChallengeSnapshotTag, FrameworkHelper}
import org.maproulette.data.SnapshotManager
import play.api.Application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import java.util.concurrent.TimeUnit
import scala.concurrent.duration.FiniteDuration
import play.api.libs.json.Json

import org.maproulette.session.{
SearchParameters,
SearchTaskParameters
}
import org.maproulette.session.{SearchParameters, SearchTaskParameters}
import org.maproulette.framework.model._
import org.maproulette.framework.util.{TaskReviewTag, FrameworkHelper}
import org.maproulette.models.dal.{ChallengeDAL, TaskDAL}
Expand Down

0 comments on commit adc19cf

Please sign in to comment.