From 01a312e0fa75cd5d772df9a1147b19dbf2bb0c17 Mon Sep 17 00:00:00 2001 From: Ioanna Kokkini Date: Fri, 12 Jul 2024 18:27:16 +0100 Subject: [PATCH 1/2] Bump various dependencies --- .scalafmt.conf | 2 +- project/Dependencies.scala | 4 ++-- project/plugins.sbt | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index b3d445963575..e847b556a150 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version=2.7.5 +version=3.8.2 maxColumn = 120 trailingCommas = always diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 3c4f0c0f5ed6..455468efd6e3 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -56,7 +56,7 @@ object Dependencies { val json4s = "org.json4s" %% "json4s-native" % "4.0.7" val macwire = "com.softwaremill.macwire" %% "macros" % "2.5.9" % "provided" val mockito = "org.mockito" % "mockito-all" % "1.10.19" % Test - val paClient = "com.gu" %% "pa-client" % "7.0.9" + val paClient = "com.gu" %% "pa-client" % "7.0.10" val panDomainAuth = "com.gu" %% "pan-domain-auth-play_3-0" % "4.0.0" val editorialPermissions = "com.gu" %% "editorial-permissions-client" % "2.15" val quartzScheduler = "org.quartz-scheduler" % "quartz" % "2.3.2" @@ -76,7 +76,7 @@ object Dependencies { val jerseyCore = "com.sun.jersey" % "jersey-core" % jerseyVersion val jerseyClient = "com.sun.jersey" % "jersey-client" % jerseyVersion val w3cSac = "org.w3c.css" % "sac" % "1.3" - val libPhoneNumber = "com.googlecode.libphonenumber" % "libphonenumber" % "8.13.40" + val libPhoneNumber = "com.googlecode.libphonenumber" % "libphonenumber" % "8.13.41" val pekkoVersion = "1.0.3" val pekkoActor = "org.apache.pekko" %% "pekko-actor" % pekkoVersion val pekkoStream = "org.apache.pekko" %% "pekko-stream" % pekkoVersion diff --git a/project/plugins.sbt b/project/plugins.sbt index e01907d9582c..49d155bc4b04 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,8 +3,8 @@ logLevel := Level.Warn // Dependencies used by the VersionInfo plugin libraryDependencies ++= Seq( - "joda-time" % "joda-time" % "2.3", - "org.joda" % "joda-convert" % "1.7", + "joda-time" % "joda-time" % "2.12.7", + "org.joda" % "joda-convert" % "2.2.3", ) resolvers ++= Resolver.sonatypeOssRepos("releases") From 58f91367969bf48e04fb980b164c0586b1f7bbc5 Mon Sep 17 00:00:00 2001 From: Ioanna Kokkini Date: Fri, 12 Jul 2024 18:31:11 +0100 Subject: [PATCH 2/2] Scala formatting changes --- .scalafmt.conf | 1 + admin/app/controllers/AdminControllers.scala | 4 +-- .../controllers/FrontPressController.scala | 2 +- .../InteractiveLibrarianController.scala | 3 +- .../controllers/admin/R2PressController.scala | 4 +-- .../admin/SwitchboardController.scala | 3 +- admin/app/dfp/ApiHelper.scala | 2 +- admin/app/dfp/DataMapper.scala | 6 ++-- admin/app/jobs/RefreshFrontsJob.scala | 4 +-- admin/app/model/AdminLifecycle.scala | 10 +++---- admin/app/model/deploys/RiffRaff.scala | 2 +- admin/app/tools/AssetMetrics.scala | 2 +- admin/app/tools/charts/charts.scala | 2 +- applications/app/services/NewsSiteMap.scala | 4 ++- .../app/services/NewspaperQuery.scala | 14 ++++----- applications/app/services/VideoSiteMap.scala | 4 ++- .../dotcomrendering/CrosswordsPicker.scala | 3 +- .../dotcomrendering/GalleryPicker.scala | 3 +- .../dotcomrendering/MediaPicker.scala | 3 +- .../test/AllIndexControllerTest.scala | 2 +- applications/test/TagFeatureTest.scala | 2 +- .../app/controllers/LiveBlogController.scala | 11 ++++--- article/test/LiveBlogControllerTest.scala | 4 +-- .../app/common/Assets/DiscussionAssets.scala | 7 ++--- common/app/common/Edition.scala | 2 +- common/app/common/InlineStyles.scala | 23 +++++++------- common/app/common/JsMinifier.scala | 12 ++++---- common/app/common/LinkTo.scala | 2 +- common/app/common/Pagination.scala | 25 ++++++---------- common/app/common/Retry.scala | 3 +- common/app/common/StringEncodings.scala | 11 +++---- common/app/common/TrailsToRss.scala | 2 +- common/app/common/TrailsToShowcase.scala | 2 +- common/app/common/configuration.scala | 11 +++---- .../app/common/dfp/PageSkinSponsorship.scala | 5 ++-- common/app/common/dfp/PageskinAdAgent.scala | 2 +- common/app/common/dfp/TagSponsorship.scala | 4 +-- common/app/common/management.scala | 8 ++--- common/app/conf/HealthCheck.scala | 2 +- common/app/conf/audio/FlagshipContainer.scala | 2 +- .../conf/audio/FlagshipEmailContainer.scala | 4 +-- .../conf/audio/FlagshipFrontContainer.scala | 4 +-- .../conf/switches/SwitchboardLifecycle.scala | 2 +- common/app/contentapi/ContentApiClient.scala | 8 ++--- common/app/contentapi/http.scala | 6 ++-- .../controllers/EmailSignupController.scala | 2 +- .../controllers/IndexControllerCommon.scala | 2 +- common/app/crosswords/CrosswordSvg.scala | 4 ++- .../dev/DevParametersHttpRequestHandler.scala | 4 +-- .../app/http/GuardianAuthWithExemptions.scala | 6 ++-- common/app/implicits/Dates.scala | 2 +- .../FaciaContentFrontendHelpers.scala | 2 +- common/app/implicits/Requests.scala | 2 +- common/app/json/ObjectDeduplication.scala | 30 +++++++++---------- common/app/layout/ContentWidths.scala | 3 +- common/app/layout/SliceWithCards.scala | 4 +-- .../app/layout/slices/FixedContainers.scala | 2 +- common/app/layout/slices/Slice.scala | 4 +-- common/app/model/Cached.scala | 4 +-- common/app/model/CrosswordData.scala | 6 ++-- common/app/model/Encoding.scala | 2 +- common/app/model/Formats.scala | 8 ++--- common/app/model/PressedPage.scala | 8 ++--- common/app/model/RelatedContent.scala | 2 +- common/app/model/SupportedUrl.scala | 12 ++++---- common/app/model/content.scala | 16 +++++----- common/app/model/content/Atom.scala | 2 +- .../DotcomRenderingDataModel.scala | 2 +- .../DotcomRenderingUtils.scala | 8 ++--- .../dotcomrendering/ElementsEnhancer.scala | 5 ++-- common/app/model/facia.scala | 6 ++-- common/app/model/meta.scala | 8 ++--- common/app/navigation/NavLinks.scala | 2 +- common/app/pagepresser/HtmlCleaner.scala | 2 +- common/app/services/ConfigAgentTrait.scala | 13 ++++---- common/app/services/IndexPage.scala | 2 +- common/app/services/repositories.scala | 12 ++++---- common/app/views/support/Commercial.scala | 16 +++++----- common/app/views/support/EmailHelpers.scala | 6 ++-- common/app/views/support/HtmlCleaner.scala | 6 ++-- .../app/views/support/MostPopularTags.scala | 4 +-- common/app/views/support/WitnessCleaner.scala | 2 +- common/app/views/support/package.scala | 6 ++-- common/test/common/ModelOrResultTest.scala | 2 +- common/test/common/TrailsToShowcaseTest.scala | 2 +- common/test/conf/CachedHealthCheckTest.scala | 2 +- common/test/model/ContentTest.scala | 2 +- common/test/model/DateTimeTest.scala | 2 +- .../pageElements/TextCleanerTest.scala | 9 ++++-- common/test/package.scala | 7 ++--- common/test/views/support/TitleTest.scala | 4 +-- .../app/discussion/api/DiscussionApi.scala | 2 +- .../app/frontpress/FapiFrontPress.scala | 2 +- .../app/frontpress/JsonQueueWorker.scala | 5 ++-- facia/app/controllers/FaciaController.scala | 18 +++++------ .../dotcomrendering/FaciaPicker.scala | 3 +- facia/test/FaciaControllerTest.scala | 2 +- .../app/actions/AuthenticatedActions.scala | 2 +- identity/app/clients/DiscussionClient.scala | 6 ++-- .../controllers/PublicProfileController.scala | 4 +-- .../editprofile/ProfileForms.scala | 19 +++++++----- identity/app/form/AddressMapping.scala | 3 +- identity/app/form/DateFormData.scala | 2 +- identity/app/form/Mappings.scala | 3 +- identity/app/form/PrivacyMapping.scala | 12 +++++--- .../app/form/TelephoneNumberMapping.scala | 2 +- identity/app/form/UserFormMapping.scala | 17 ++++++----- .../app/idapiclient/responses/Error.scala | 5 ++-- identity/app/model/PhoneNumbers.scala | 4 +-- identity/app/utils/ConsentOrder.scala | 9 ++++-- .../parser/JsonBodyParserTest.scala | 4 +-- preview/app/AppLoader.scala | 2 +- sport/app/football/conf/context.scala | 6 ++-- .../controllers/MatchController.scala | 2 +- .../controllers/MoreOnMatchController.scala | 2 +- sport/app/football/feed/agent.scala | 6 ++-- sport/app/football/implicits/Football.scala | 4 +-- sport/app/football/model/TeamMap.scala | 6 ++-- sport/app/football/model/model.scala | 8 ++--- sport/app/rugby/conf/RugbyLifecycle.scala | 2 +- 120 files changed, 333 insertions(+), 328 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index e847b556a150..0b72752654f8 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,5 @@ version=3.8.2 +runner.dialect = scala213 maxColumn = 120 trailingCommas = always diff --git a/admin/app/controllers/AdminControllers.scala b/admin/app/controllers/AdminControllers.scala index 463cb682b72d..e6e3f5a0ac38 100644 --- a/admin/app/controllers/AdminControllers.scala +++ b/admin/app/controllers/AdminControllers.scala @@ -60,8 +60,8 @@ trait AdminControllers { s3Client, system = "frontend-admin", extraDoNotAuthenticatePathPrefixes = Seq( - "/deploys", //not authenticated so it can be accessed by Prout to determine which builds have been deployed - "/deploy", //not authenticated so it can be accessed by Riff-Raff to notify about a new build being deployed + "/deploys", // not authenticated so it can be accessed by Prout to determine which builds have been deployed + "/deploy", // not authenticated so it can be accessed by Riff-Raff to notify about a new build being deployed // Date: 06 July 2021 // Author: Pascal // Added as part of posing the ground for the interactive migration. diff --git a/admin/app/controllers/FrontPressController.scala b/admin/app/controllers/FrontPressController.scala index f8881eb2b077..cdcfe37e151d 100644 --- a/admin/app/controllers/FrontPressController.scala +++ b/admin/app/controllers/FrontPressController.scala @@ -20,7 +20,7 @@ class FrontPressController(pekkoAsync: PekkoAsync, val controllerComponents: Con Action { implicit request => RefreshFrontsJob.runAll(pekkoAsync) match { case Some(l) => Ok(s"Pushed ${l.length} fronts to the SQS queue") - case None => InternalServerError("Could not push to the SQS queue, is there an SNS topic set? (frontPressSns)") + case None => InternalServerError("Could not push to the SQS queue, is there an SNS topic set? (frontPressSns)") } } diff --git a/admin/app/controllers/admin/InteractiveLibrarianController.scala b/admin/app/controllers/admin/InteractiveLibrarianController.scala index 61684e2e5016..2b865a5deb22 100644 --- a/admin/app/controllers/admin/InteractiveLibrarianController.scala +++ b/admin/app/controllers/admin/InteractiveLibrarianController.scala @@ -26,7 +26,8 @@ class InteractiveLibrarianController( /** This function combines both pressing and cleaning * * @param path - * @return success or failure, including message + * @return + * success or failure, including message */ def press(path: String): Action[AnyContent] = Action.async { implicit request => diff --git a/admin/app/controllers/admin/R2PressController.scala b/admin/app/controllers/admin/R2PressController.scala index 1d35cbc108a7..a6eeb563b345 100644 --- a/admin/app/controllers/admin/R2PressController.scala +++ b/admin/app/controllers/admin/R2PressController.scala @@ -61,7 +61,7 @@ class R2PressController( .getLines() .map { line => if (line.nonEmpty) { - //TODO: other validation? + // TODO: other validation? if (isTakedown) { normaliseAndEnqueueTakedown(line) } else { @@ -84,7 +84,7 @@ class R2PressController( val path = url.getPath val normalisedPath = RedirectService.normalisePath(path) List(s"https://$host$path", s"http://$host$path", s"https://$host$normalisedPath", s"http://$host$normalisedPath") - //An http version of the redirect may exist so preemptively delete it. + // An http version of the redirect may exist so preemptively delete it. } } diff --git a/admin/app/controllers/admin/SwitchboardController.scala b/admin/app/controllers/admin/SwitchboardController.scala index 84f45291fb50..fd2a9427a03d 100644 --- a/admin/app/controllers/admin/SwitchboardController.scala +++ b/admin/app/controllers/admin/SwitchboardController.scala @@ -61,7 +61,8 @@ class SwitchboardController( log.info("saving switchboard") val requester: String = - auth.readAuthenticatedUser(request) map (authed => s"${authed.user.firstName} ${authed.user.lastName}", + auth.readAuthenticatedUser(request) map (authed => + s"${authed.user.firstName} ${authed.user.lastName}" ) getOrElse "unknown user (dev-build?)" val updates: Seq[String] = request.body.asFormUrlEncoded.map { params => Switches.all map { switch => diff --git a/admin/app/dfp/ApiHelper.scala b/admin/app/dfp/ApiHelper.scala index 5268ce689706..9458356e8211 100644 --- a/admin/app/dfp/ApiHelper.scala +++ b/admin/app/dfp/ApiHelper.scala @@ -36,6 +36,6 @@ private[dfp] object ApiHelper extends GuLogging { def toSeq[A](as: Array[A]): Seq[A] = Option(as) map (_.toSeq) getOrElse Nil - //noinspection IfElseToOption + // noinspection IfElseToOption def optJavaInt(i: java.lang.Integer): Option[Int] = if (i == null) None else Some(i) } diff --git a/admin/app/dfp/DataMapper.scala b/admin/app/dfp/DataMapper.scala index 9ffdc3d671f1..8fba37698855 100644 --- a/admin/app/dfp/DataMapper.scala +++ b/admin/app/dfp/DataMapper.scala @@ -22,11 +22,11 @@ class DataMapper( def toIncludedGuAdUnits(inventoryTargeting: InventoryTargeting): Seq[GuAdUnit] = { - //noinspection MapFlatten + // noinspection MapFlatten val directAdUnits = toSeq(inventoryTargeting.getTargetedAdUnits).map(_.getAdUnitId).map(adUnitService.activeAdUnit).flatten - //noinspection MapFlatten + // noinspection MapFlatten val adUnitsDerivedFromPlacements = { toSeq(inventoryTargeting.getTargetedPlacementIds).map(placementService.placementAdUnitIds(session)).flatten } @@ -47,7 +47,7 @@ class DataMapper( customTargetingService.targetingKey(session)(criterion.getKeyId), criterion.getOperator.getValue, criterion.getValueIds.toSeq map (valueId => - customTargetingService.targetingValue(session)(criterion.getKeyId, valueId), + customTargetingService.targetingValue(session)(criterion.getKeyId, valueId) ), ) diff --git a/admin/app/jobs/RefreshFrontsJob.scala b/admin/app/jobs/RefreshFrontsJob.scala index 4c5673929e8b..0df4919dba62 100644 --- a/admin/app/jobs/RefreshFrontsJob.scala +++ b/admin/app/jobs/RefreshFrontsJob.scala @@ -52,8 +52,8 @@ object RefreshFrontsJob extends GuLogging { } } - //This is used by a route in admin to push ALL paths to the facia-press SQS queue. - //The facia-press boxes will start to pick these off one by one, so there is no direct overloading of these boxes + // This is used by a route in admin to push ALL paths to the facia-press SQS queue. + // The facia-press boxes will start to pick these off one by one, so there is no direct overloading of these boxes def runAll(pekkoAsync: PekkoAsync)(implicit executionContext: ExecutionContext): Option[Seq[Unit]] = { Configuration.aws.frontPressSns.map(Function.const { log.info("Putting press jobs on Facia Cron (MANUAL REQUEST)") diff --git a/admin/app/model/AdminLifecycle.scala b/admin/app/model/AdminLifecycle.scala index 19bae62c6709..73c204d11e24 100644 --- a/admin/app/model/AdminLifecycle.scala +++ b/admin/app/model/AdminLifecycle.scala @@ -46,17 +46,17 @@ class AdminLifecycle( private def scheduleJobs(): Unit = { - //every 0, 30 seconds past the minute + // every 0, 30 seconds past the minute jobs.schedule("AdminLoadJob", "0/30 * * * * ?") { model.abtests.AbTestJob.run() } - //every 4, 19, 34, 49 minutes past the hour, on the 2nd second past the minute (e.g 13:04:02, 13:19:02) + // every 4, 19, 34, 49 minutes past the hour, on the 2nd second past the minute (e.g 13:04:02, 13:19:02) jobs.schedule("LoadBalancerLoadJob", "2 4/15 * * * ?") { LoadBalancer.refresh() } - //every 2 minutes starting 5 seconds past the minute (e.g 13:02:05, 13:04:05) + // every 2 minutes starting 5 seconds past the minute (e.g 13:02:05, 13:04:05) jobs.schedule("FastlyCloudwatchLoadJob", "5 0/2 * * * ?") { fastlyCloudwatchLoadJob.run() } @@ -65,7 +65,7 @@ class AdminLifecycle( r2PagePressJob.run() } - //every 2, 17, 32, 47 minutes past the hour, on the 12th second past the minute (e.g 13:02:12, 13:17:12) + // every 2, 17, 32, 47 minutes past the hour, on the 12th second past the minute (e.g 13:02:12, 13:17:12) jobs.schedule("AnalyticsSanityCheckJob", "12 2/15 * * * ?") { analyticsSanityCheckJob.run() } @@ -85,7 +85,7 @@ class AdminLifecycle( if (FrontPressJobSwitch.isSwitchedOn) RefreshFrontsJob.runFrequency(pekkoAsync)(LowFrequency) Future.successful(()) } - //every 2, 17, 32, 47 minutes past the hour, on the 9th second past the minute (e.g 13:02:09, 13:17:09) + // every 2, 17, 32, 47 minutes past the hour, on the 9th second past the minute (e.g 13:02:09, 13:17:09) jobs.schedule("RebuildIndexJob", s"9 0/$adminRebuildIndexRateInMinutes * 1/1 * ? *") { rebuildIndexJob.run() } diff --git a/admin/app/model/deploys/RiffRaff.scala b/admin/app/model/deploys/RiffRaff.scala index bddf3788575b..518c3b61df37 100644 --- a/admin/app/model/deploys/RiffRaff.scala +++ b/admin/app/model/deploys/RiffRaff.scala @@ -47,7 +47,7 @@ class RiffRaffService(httpClient: HttpLike) { case 200 => (response.json \ "response" \ "results").validate[List[RiffRaffDeploy]] match { case JsSuccess(listOfDeploys, _) => Right(listOfDeploys) - case JsError(error) => Left(ApiErrors(List(ApiError(s"Invalid JSON from RiffRaff API: $error", 500)))) + case JsError(error) => Left(ApiErrors(List(ApiError(s"Invalid JSON from RiffRaff API: $error", 500)))) } case statusCode => Left(ApiErrors(List(ApiError(s"Invalid status code from RiffRaff: $statusCode", 500)))) } diff --git a/admin/app/tools/AssetMetrics.scala b/admin/app/tools/AssetMetrics.scala index efe1c0f3ffd9..8bed8295839e 100644 --- a/admin/app/tools/AssetMetrics.scala +++ b/admin/app/tools/AssetMetrics.scala @@ -35,7 +35,7 @@ object AssetMetrics { new GetMetricStatisticsRequest() .withStartTime(new DateTime().minusDays(timePeriodInDays).toDate) .withEndTime(new DateTime().toDate) - .withPeriod(86400) //One day + .withPeriod(86400) // One day .withStatistics("Average") .withNamespace("Assets") .withMetricName(metric.getMetricName) diff --git a/admin/app/tools/charts/charts.scala b/admin/app/tools/charts/charts.scala index b4e6904902b2..2be583f82d92 100644 --- a/admin/app/tools/charts/charts.scala +++ b/admin/app/tools/charts/charts.scala @@ -53,7 +53,7 @@ class ChartTable(private val labels: Seq[String]) { trait Chart[K] { - //used in html as element id + // used in html as element id lazy val id = UUID.randomUUID().toString def name: String diff --git a/applications/app/services/NewsSiteMap.scala b/applications/app/services/NewsSiteMap.scala index 1d48efe8965c..c8f9be07447c 100644 --- a/applications/app/services/NewsSiteMap.scala +++ b/applications/app/services/NewsSiteMap.scala @@ -46,7 +46,9 @@ class NewsSiteMap(contentApiClient: ContentApiClient) { en {genres} - {webPublicationDate.withZone(DateTimeZone.UTC).toISODateTimeNoMillisString} + { + webPublicationDate.withZone(DateTimeZone.UTC).toISODateTimeNoMillisString + } {title} {keywords} diff --git a/applications/app/services/NewspaperQuery.scala b/applications/app/services/NewspaperQuery.scala index b2243d49a13a..5a3ba584b829 100644 --- a/applications/app/services/NewspaperQuery.scala +++ b/applications/app/services/NewspaperQuery.scala @@ -65,13 +65,13 @@ class NewspaperQuery(contentApiClient: ContentApiClient) extends Dates with GuLo .toDate(jodaToJavaInstant(newspaperDate)) contentApiClient.getResponse(itemQuery).map { resp => - //filter out the first page results to make a Front Page container + // filter out the first page results to make a Front Page container val (firstPageContent, otherContent) = resp.results.getOrElse(Nil).partition(content => getNewspaperPageNumber(content).contains(1)) val firstPageContainer = { val content = firstPageContent.map(c => FaciaContentConvert.contentToFaciaContent(c)) - //for /theguardian fetch date links either side of date requested, for /theobserver, fetch each sunday around the date and the day before + // for /theguardian fetch date links either side of date requested, for /theobserver, fetch each sunday around the date and the day before val snaps = createSnap(newspaperDate, publication) bookSectionContainer( None, @@ -107,7 +107,7 @@ class NewspaperQuery(contentApiClient: ContentApiClient) extends Dates with GuLo content.tags.find(_.`type`.name == "NewspaperBookSection").map(t => TagWithContent(t, content)) } - //group content by booksection tag type + // group content by booksection tag type tagWithContent .groupBy(_.tag) .map(bookSectionContent => BookSectionContent(bookSectionContent._1, bookSectionContent._2.map(_.content))) @@ -116,12 +116,12 @@ class NewspaperQuery(contentApiClient: ContentApiClient) extends Dates with GuLo private def orderByPageNumber(unorderedBookSections: List[BookSectionContent]): List[BookSectionContent] = { - //order content for each book section + // order content for each book section val orderedContentForBookSection: List[BookSectionContent] = unorderedBookSections.map { bookSection => bookSection.copy(content = orderContentByPageNumber(bookSection.content)) } - //order booksections by first content item in each booksection + // order booksections by first content item in each booksection val pageNumberToFaciaContainer: List[BookSectionContentByPage] = orderedContentForBookSection.flatMap { bookSection => val pageNumberOpt = bookSection.content.headOption.flatMap(content => getNewspaperPageNumber(content)) @@ -180,9 +180,9 @@ class NewspaperQuery(contentApiClient: ContentApiClient) extends Dates with GuLo if (date.getDayOfWeek == DateTimeConstants.SUNDAY) date.minusDays(1) else date private def createSnap(date: DateTime, publication: String) = { - //if /theguardian get links for date either side of the date requests + // if /theguardian get links for date either side of the date requests // else for theobserver get dates either sunday around the date and the previous Saturday. - //filter out any dates in the future + // filter out any dates in the future val daysAroundDateToFetchLinksFor = if (publication == "theguardian") List(1, -1) else List(7, -1, -7) val datesAroundNewspaperDate = daysAroundDateToFetchLinksFor.map(date.plusDays) datesAroundNewspaperDate.filter(d => d.isBeforeNow).map { d => diff --git a/applications/app/services/VideoSiteMap.scala b/applications/app/services/VideoSiteMap.scala index bdde8bd92387..28441ad79278 100644 --- a/applications/app/services/VideoSiteMap.scala +++ b/applications/app/services/VideoSiteMap.scala @@ -45,7 +45,9 @@ class VideoSiteMap(contentApiClient: ContentApiClient) { {description.map(desc => {desc}).getOrElse(Nil)} {content_loc.map(content => {content}).getOrElse(Nil)} {duration} - {publication.withZone(DateTimeZone.UTC).toISODateTimeNoMillisString} + { + publication.withZone(DateTimeZone.UTC).toISODateTimeNoMillisString + } {tags.map(tag => {tag})} {category} yes diff --git a/applications/app/services/dotcomrendering/CrosswordsPicker.scala b/applications/app/services/dotcomrendering/CrosswordsPicker.scala index 8d0558bbdc51..58d4db53329f 100644 --- a/applications/app/services/dotcomrendering/CrosswordsPicker.scala +++ b/applications/app/services/dotcomrendering/CrosswordsPicker.scala @@ -8,8 +8,7 @@ import utils.DotcomponentsLogger object CrosswordsPicker extends GuLogging { - /** Add to this function any logic for including/excluding - * a crossword page from being rendered with DCR + /** Add to this function any logic for including/excluding a crossword page from being rendered with DCR * * Currently defaulting to false until we implement crosswords in DCR */ diff --git a/applications/app/services/dotcomrendering/GalleryPicker.scala b/applications/app/services/dotcomrendering/GalleryPicker.scala index 88f8fadc67cf..06daee8bbf84 100644 --- a/applications/app/services/dotcomrendering/GalleryPicker.scala +++ b/applications/app/services/dotcomrendering/GalleryPicker.scala @@ -8,8 +8,7 @@ import utils.DotcomponentsLogger object GalleryPicker extends GuLogging { - /** Add to this function any logic for including/excluding - * a gallery article from being rendered with DCR + /** Add to this function any logic for including/excluding a gallery article from being rendered with DCR * * Currently defaulting to false until we implement image articles in DCR */ diff --git a/applications/app/services/dotcomrendering/MediaPicker.scala b/applications/app/services/dotcomrendering/MediaPicker.scala index 201848b9de5a..29cdfc7a52d2 100644 --- a/applications/app/services/dotcomrendering/MediaPicker.scala +++ b/applications/app/services/dotcomrendering/MediaPicker.scala @@ -11,8 +11,7 @@ import conf.switches.Switches.DCRVideoPages object MediaPicker extends GuLogging { - /** Add to this function any logic for including/excluding - * an audio/video article from being rendered with DCR + /** Add to this function any logic for including/excluding an audio/video article from being rendered with DCR * * Currently defaulting to false until we implement in DCR */ diff --git a/applications/test/AllIndexControllerTest.scala b/applications/test/AllIndexControllerTest.scala index eb489792cfcb..cc704443884f 100644 --- a/applications/test/AllIndexControllerTest.scala +++ b/applications/test/AllIndexControllerTest.scala @@ -115,7 +115,7 @@ import play.api.test.Helpers._ } it should "correctly parse the date" in { - //this would only error in UTC + // this would only error in UTC val oldTimezone = DateTimeZone.getDefault DateTimeZone.setDefault(DateTimeZone.UTC) try { diff --git a/applications/test/TagFeatureTest.scala b/applications/test/TagFeatureTest.scala index 7809e4427b1e..9f3004d5f941 100644 --- a/applications/test/TagFeatureTest.scala +++ b/applications/test/TagFeatureTest.scala @@ -111,7 +111,7 @@ import org.scalatest.matchers.should.Matchers } } - //I'm not having a happy time with the selectors on links... + // I'm not having a happy time with the selectors on links... private def findByRel(elements: FluentList[FluentWebElement], rel: String) = elements.asScala.find(_.attribute("rel") == rel) } diff --git a/article/app/controllers/LiveBlogController.scala b/article/app/controllers/LiveBlogController.scala index 6b61d30af6c3..fc743f48967c 100644 --- a/article/app/controllers/LiveBlogController.scala +++ b/article/app/controllers/LiveBlogController.scala @@ -122,9 +122,9 @@ class LiveBlogController( mapModel(path, range, filter, topicResult) { case (blog: LiveBlogPage, _) if rendered.contains(false) => getJsonForFronts(blog) - /** When DCR requests new blocks from the client, it will add a `lastUpdate` parameter. - * If no such parameter is present, we should return a JSON representation of the whole - * payload that would be sent to DCR when initially server side rendering the LiveBlog page. + /** When DCR requests new blocks from the client, it will add a `lastUpdate` parameter. If no such parameter is + * present, we should return a JSON representation of the whole payload that would be sent to DCR when + * initially server side rendering the LiveBlog page. */ case (blog: LiveBlogPage, blocks) if request.forceDCR && lastUpdate.isEmpty => Future.successful(renderDCRJson(blog, blocks, filter, availableTopics, topicResult)) @@ -428,9 +428,8 @@ class LiveBlogController( topicResult, ).map(_ -> blocks) case nonLiveBlogArticle: Article => - /** If `isLiveBlog` is false, it must be because the article has no blocks, or lacks - * the `tone/minutebyminute` tag, or both. - * Logging these values will help us to identify which is causing the issue. + /** If `isLiveBlog` is false, it must be because the article has no blocks, or lacks the `tone/minutebyminute` + * tag, or both. Logging these values will help us to identify which is causing the issue. */ val hasBlocks = nonLiveBlogArticle.fields.blocks.nonEmpty; val hasMinuteByMinuteTag = nonLiveBlogArticle.tags.isLiveBlog; diff --git a/article/test/LiveBlogControllerTest.scala b/article/test/LiveBlogControllerTest.scala index fb7c08f65ef9..b30927109f25 100644 --- a/article/test/LiveBlogControllerTest.scala +++ b/article/test/LiveBlogControllerTest.scala @@ -100,10 +100,10 @@ import services.newsletters.{NewsletterApi, NewsletterSignupAgent} content should include("block-56d039fce4b0d38537b1f61e") content should not include "56d04877e4b0bd5a0524cbe2" // at the moment it only tries 5 either way, reverse this test once we use blocks:published-since - //this blockLiveBlogCurrentPageTest.scala + // this blockLiveBlogCurrentPageTest.scala content should not include lastUpdateBlock - //older block + // older block content should not include "block-56d02bd2e4b0d38537b1f5fa" } diff --git a/common/app/common/Assets/DiscussionAssets.scala b/common/app/common/Assets/DiscussionAssets.scala index c01a7dbffac1..04456dea7fb6 100644 --- a/common/app/common/Assets/DiscussionAssets.scala +++ b/common/app/common/Assets/DiscussionAssets.scala @@ -15,11 +15,8 @@ import scala.util.{Failure, Success, Try} * * This class pull the assets map regularly and translates a generic name into a full URL * - * The map is a JSON object looking like - * { - * "name": "js/name.min.hash.js" - * } - * The path in the object value is relative to the assets map + * The map is a JSON object looking like { "name": "js/name.min.hash.js" } The path in the object value is relative to + * the assets map */ class DiscussionExternalAssetsLifecycle( config: GuardianConfiguration, diff --git a/common/app/common/Edition.scala b/common/app/common/Edition.scala index d6af407c3745..16a98c586dc6 100644 --- a/common/app/common/Edition.scala +++ b/common/app/common/Edition.scala @@ -145,7 +145,7 @@ object Editionalise { import Edition.defaultEdition - //TODO - understand RSS + // TODO - understand RSS def apply(id: String, edition: Edition): String = { if (edition.isEditionalised(id)) id match { diff --git a/common/app/common/InlineStyles.scala b/common/app/common/InlineStyles.scala index e616e53a038b..e7ad874c14a3 100644 --- a/common/app/common/InlineStyles.scala +++ b/common/app/common/InlineStyles.scala @@ -67,8 +67,8 @@ object InlineStyles extends GuLogging { /** Attempt to inline the rules from the - + { for { diff --git a/common/app/dev/DevParametersHttpRequestHandler.scala b/common/app/dev/DevParametersHttpRequestHandler.scala index 4c8105ea4371..99e16c1e73ae 100644 --- a/common/app/dev/DevParametersHttpRequestHandler.scala +++ b/common/app/dev/DevParametersHttpRequestHandler.scala @@ -35,7 +35,7 @@ class DevParametersHttpRequestHandler( */ val insignificantParams = Seq( "view", - "_edition", //allows us to spoof edition in tests + "_edition", // allows us to spoof edition in tests "c", // used for counts in the Diagnostics server "shortUrl", // Used by series component in onwards journeys "switchesOn", // turn switches on for non-prod, http requests @@ -54,7 +54,7 @@ class DevParametersHttpRequestHandler( "amp_latest_update_time", // used by amp-live-list to check for latest updates "heatmap", // used by ophan javascript to enable the heatmap "format", // used to determine whether HTML should be served in email-friendly format or not - "timestamp", //used to get specific builds for inteactive serviceworkers + "timestamp", // used to get specific builds for inteactive serviceworkers "pbjs_debug", // set to `true` to enable prebid debugging, "amzn_debug_mode", // set to `1` to enable A9 debugging "force-braze-message", // JSON encoded representation of "extras" data from Braze diff --git a/common/app/http/GuardianAuthWithExemptions.scala b/common/app/http/GuardianAuthWithExemptions.scala index 1259eb75ff09..8ad6bf82c71a 100644 --- a/common/app/http/GuardianAuthWithExemptions.scala +++ b/common/app/http/GuardianAuthWithExemptions.scala @@ -69,9 +69,9 @@ class GuardianAuthWithExemptions( PanDomain.guardianValidation(authedUser) } - /** By default, the user validation method is called every request. If your validation - * method has side-effects or is expensive (perhaps hitting a database), setting this - * to true will ensure that validateUser is only called when the OAuth session is refreshed + /** By default, the user validation method is called every request. If your validation method has side-effects or is + * expensive (perhaps hitting a database), setting this to true will ensure that validateUser is only called when the + * OAuth session is refreshed */ override def cacheValidation = false diff --git a/common/app/implicits/Dates.scala b/common/app/implicits/Dates.scala index 341ae23adcc1..87044543a1f5 100644 --- a/common/app/implicits/Dates.scala +++ b/common/app/implicits/Dates.scala @@ -48,7 +48,7 @@ trait Dates { def isOlderThan(period: Period): Boolean = d.plus(period).isBeforeNow } - //http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + // http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 private val HTTPDateFormat = DateTimeFormat.forPattern("EEE, dd MMM yyyy HH:mm:ss 'GMT'").withZone(DateTimeZone.UTC) implicit class DateTime2ToCommonDateFormats(date: DateTime) { diff --git a/common/app/implicits/FaciaContentFrontendHelpers.scala b/common/app/implicits/FaciaContentFrontendHelpers.scala index 702a8ed5b8b1..9f6c46e19084 100644 --- a/common/app/implicits/FaciaContentFrontendHelpers.scala +++ b/common/app/implicits/FaciaContentFrontendHelpers.scala @@ -22,7 +22,7 @@ object FaciaContentFrontendHelpers { imageOverride.orElse(defaultTrailPicture) } - //TODO: Use the blocks field of CAPI to derive this in a more structured way + // TODO: Use the blocks field of CAPI to derive this in a more structured way def mainYouTubeMediaAtom: Option[MediaAtom] = for { main <- faciaContent.properties.maybeContent.map(_.fields.main) diff --git a/common/app/implicits/Requests.scala b/common/app/implicits/Requests.scala index 897a450da5e3..5f10adeadf4c 100644 --- a/common/app/implicits/Requests.scala +++ b/common/app/implicits/Requests.scala @@ -95,7 +95,7 @@ trait Requests { lazy val rawQueryStringOption: Option[String] = if (r.rawQueryString.nonEmpty) Some(r.rawQueryString) else None - //This is a header reliably set by jQuery for AJAX requests used in facia-tool + // This is a header reliably set by jQuery for AJAX requests used in facia-tool lazy val isXmlHttpRequest: Boolean = r.headers.get("X-Requested-With").contains("XMLHttpRequest") lazy val isCrosswordFront: Boolean = r.path.endsWith("/crosswords") diff --git a/common/app/json/ObjectDeduplication.scala b/common/app/json/ObjectDeduplication.scala index db77720fafc0..48acac1fef59 100644 --- a/common/app/json/ObjectDeduplication.scala +++ b/common/app/json/ObjectDeduplication.scala @@ -4,28 +4,26 @@ import com.github.blemale.scaffeine.Scaffeine import com.gu.etagcaching.ConfigCache import play.api.libs.json.Format -/** This class is a memory optimisation for when many identical objects (eg `Tag`s) are being - * read from JSON, and then held in memory. If the objects are immutable & identical, - * we don't want to hold multiple copies of them - we can just hold one in a cache, and have all - * references to the object point to that same object. +/** This class is a memory optimisation for when many identical objects (eg `Tag`s) are being read from JSON, and then + * held in memory. If the objects are immutable & identical, we don't want to hold multiple copies of them - we can + * just hold one in a cache, and have all references to the object point to that same object. * - * In practice, this means when we deserialize Json to some Scala object, we _do_ create a - * new instance of that Scala object, but we immediately throw it away if we find we already - * have a matching one in our cache - we use the cached one in preference, and we get the desired - * situation where all the instances of that unique value in memory are represented by one single - * instance. + * In practice, this means when we deserialize Json to some Scala object, we _do_ create a new instance of that Scala + * object, but we immediately throw it away if we find we already have a matching one in our cache - we use the cached + * one in preference, and we get the desired situation where all the instances of that unique value in memory are + * represented by one single instance. * * We key our cached instances by hashcode (which is mostly unique, apart from - * https://en.wikipedia.org/wiki/Birthday_problem collisions) combined with a user-defined id function - * (which is a only precaution, to eliminate Birthday Problem collisions). So in our cache, we - * might have several instances of the Tag `sport/cycling`, if the tag has changed - but the hashcode - * ensures that we do not substitute old data in place of new data. Old data can be configured to - * eventually expire out of the cache (eg `.expireAfterAccess(1.hour)`). + * https://en.wikipedia.org/wiki/Birthday_problem collisions) combined with a user-defined id function (which is a only + * precaution, to eliminate Birthday Problem collisions). So in our cache, we might have several instances of the Tag + * `sport/cycling`, if the tag has changed - but the hashcode ensures that we do not substitute old data in place of + * new data. Old data can be configured to eventually expire out of the cache (eg `.expireAfterAccess(1.hour)`). */ object ObjectDeduplication { - /** @param id as precaution, this function provides an object distinguisher beyond the object hashcode. For a Tag, - * you might just provide the tag id. + /** @param id + * as precaution, this function provides an object distinguisher beyond the object hashcode. For a Tag, you might + * just provide the tag id. */ def deduplicate[A](f: Format[A], id: A => Any, configCache: ConfigCache): Format[A] = { val cache = configCache(Scaffeine()).build[(Int, Any), A]().asMap() diff --git a/common/app/layout/ContentWidths.scala b/common/app/layout/ContentWidths.scala index d4db6e24d8a2..2cecf2306220 100644 --- a/common/app/layout/ContentWidths.scala +++ b/common/app/layout/ContentWidths.scala @@ -109,8 +109,7 @@ object ContentWidths { wide = Some(1300.px), ) - /** Used when the main image is an immersive image - * like on galleries and immersive articles + /** Used when the main image is an immersive image like on galleries and immersive articles */ override val immersive = WidthsByBreakpoint( mobile = Some(480.px), diff --git a/common/app/layout/SliceWithCards.scala b/common/app/layout/SliceWithCards.scala index 20f85e2aba19..f7dc9f0e12e0 100644 --- a/common/app/layout/SliceWithCards.scala +++ b/common/app/layout/SliceWithCards.scala @@ -65,8 +65,8 @@ object SliceWithCards { ) } - /** The slice with cards assigned to columns, and the remaining cards that were not consumed, and the new - * context for creating further cards. + /** The slice with cards assigned to columns, and the remaining cards that were not consumed, and the new context for + * creating further cards. */ def fromItems( items: Seq[IndexedTrail], diff --git a/common/app/layout/slices/FixedContainers.scala b/common/app/layout/slices/FixedContainers.scala index 5a223c3ef123..06ab44488de1 100644 --- a/common/app/layout/slices/FixedContainers.scala +++ b/common/app/layout/slices/FixedContainers.scala @@ -5,7 +5,7 @@ import conf.Configuration object FixedContainers { import ContainerDefinition.{ofSlices => slices} - //TODO: Temporary vals for content until we refactor + // TODO: Temporary vals for content until we refactor val fixedSmallSlowI = slices(FullMedia75) val fixedSmallSlowII = slices(HalfHalf) val fixedSmallSlowIV = slices(QuarterQuarterQuarterQuarter) diff --git a/common/app/layout/slices/Slice.scala b/common/app/layout/slices/Slice.scala index 1f9d1ce4b45a..81f6f9f6c156 100644 --- a/common/app/layout/slices/Slice.scala +++ b/common/app/layout/slices/Slice.scala @@ -304,8 +304,8 @@ case object HalfQuarterQl2Ql4 extends Slice { ) } -/** Basically the same as above but for when there is another slice above that has already degraded from a standard to - * a media list item. Editorial have asked that the first item in this slice then gets the media list behaviour as +/** Basically the same as above but for when there is another slice above that has already degraded from a standard to a + * media list item. Editorial have asked that the first item in this slice then gets the media list behaviour as * opposed to being a standard item at mobile. */ case object HalfQuarterQl2Ql4B extends Slice { diff --git a/common/app/model/Cached.scala b/common/app/model/Cached.scala index b83c84c606f2..97bff365e70f 100644 --- a/common/app/model/Cached.scala +++ b/common/app/model/Cached.scala @@ -61,7 +61,7 @@ object Cached extends implicits.Dates { } def apply(seconds: Int)(result: CacheableResult)(implicit request: RequestHeader): Result = { - apply(CacheTime(seconds), result, request.headers.get("If-None-Match")) //FIXME could be comma separated + apply(CacheTime(seconds), result, request.headers.get("If-None-Match")) // FIXME could be comma separated } def apply(cacheTime: CacheTime)(result: CacheableResult)(implicit request: RequestHeader): Result = { @@ -120,7 +120,7 @@ object Cached extends implicits.Dates { val etagHeaderString: String = maybeEtag.getOrElse( s""""guRandomEtag${scala.util.Random.nextInt()}${scala.util.Random - .nextInt()}"""", // setting a random tag still helps + .nextInt()}"""", // setting a random tag still helps ) result.withHeaders( diff --git a/common/app/model/CrosswordData.scala b/common/app/model/CrosswordData.scala index 25eeffc0a17e..89e0289afdc3 100644 --- a/common/app/model/CrosswordData.scala +++ b/common/app/model/CrosswordData.scala @@ -17,9 +17,9 @@ object Entry { def formatHumanNumber(numbers: String): Option[String] = { - //Adding space between number and direction - //as well as after comma - //ex: "2,24across,16" => "2, 24 across, 16" + // Adding space between number and direction + // as well as after comma + // ex: "2,24across,16" => "2, 24 across, 16" val clues: Seq[Option[String]] = numbers.split(',').toIndexedSeq.map { singleClue => // Acceptable clue is a number followed by an optional direction "([0-9]+)([a-z]+)?".r.findFirstMatchIn(singleClue).map { m => diff --git a/common/app/model/Encoding.scala b/common/app/model/Encoding.scala index d189ff888729..acbdbe6c1908 100644 --- a/common/app/model/Encoding.scala +++ b/common/app/model/Encoding.scala @@ -36,6 +36,6 @@ object EncodingOrdering extends Ordering[Encoding] { if (p < 0) precedence.length else p } - //Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. + // Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. def compare(x: Encoding, y: Encoding): Int = precedenceOf(x) - precedenceOf(y) } diff --git a/common/app/model/Formats.scala b/common/app/model/Formats.scala index b24625341243..65c300bd6203 100644 --- a/common/app/model/Formats.scala +++ b/common/app/model/Formats.scala @@ -275,10 +275,10 @@ object ItemKickerFormat { case JsSuccess(JsString("AnalysisKicker"), _) => JsSuccess(AnalysisKicker) case JsSuccess(JsString("ReviewKicker"), _) => JsSuccess(ReviewKicker) case JsSuccess(JsString("CartoonKicker"), _) => JsSuccess(CartoonKicker) - case JsSuccess(JsString("PodcastKicker"), _) => (json \ "series").validate[PodcastKicker](podcastKickerFormat) - case JsSuccess(JsString("TagKicker"), _) => (json \ "item").validate[TagKicker](tagKickerFormat) - case JsSuccess(JsString("SectionKicker"), _) => (json \ "item").validate[SectionKicker](sectionKickerFormat) - case JsSuccess(JsString("FreeHtmlKicker"), _) => (json \ "item").validate[FreeHtmlKicker](freeHtmlKickerFormat) + case JsSuccess(JsString("PodcastKicker"), _) => (json \ "series").validate[PodcastKicker](podcastKickerFormat) + case JsSuccess(JsString("TagKicker"), _) => (json \ "item").validate[TagKicker](tagKickerFormat) + case JsSuccess(JsString("SectionKicker"), _) => (json \ "item").validate[SectionKicker](sectionKickerFormat) + case JsSuccess(JsString("FreeHtmlKicker"), _) => (json \ "item").validate[FreeHtmlKicker](freeHtmlKickerFormat) case JsSuccess(JsString("FreeHtmlKickerWithLink"), _) => (json \ "item").validate[FreeHtmlKickerWithLink](freeHtmlKickerWithLinkFormat) case _ => JsError("Could not convert ItemKicker") diff --git a/common/app/model/PressedPage.scala b/common/app/model/PressedPage.scala index 074533f078de..81d66dfe4b16 100644 --- a/common/app/model/PressedPage.scala +++ b/common/app/model/PressedPage.scala @@ -46,8 +46,8 @@ object PressedPage { id = id, section = Some(SectionId.fromId(seoData.navSection)), webTitle = seoData.webTitle, - //For network fronts we want the string "Network Front" - //This allows us to change webTitle in tool easily on fronts + // For network fronts we want the string "Network Front" + // This allows us to change webTitle in tool easily on fronts description = seoData.description, isFront = true, isPressedPage = true, @@ -125,8 +125,8 @@ case class PressedPage( /** If a Facia front is a tag or section page, it ought to exist as a tag or section ID for one of its pieces of * content. * - * There are fronts that exist in Facia but have no equivalent tag or section page, which is why we need to make - * this check. + * There are fronts that exist in Facia but have no equivalent tag or section page, which is why we need to make this + * check. */ def allPath: Option[String] = { val tagAndSectionIds = for { diff --git a/common/app/model/RelatedContent.scala b/common/app/model/RelatedContent.scala index b8d041677477..1e2a3cf3779a 100644 --- a/common/app/model/RelatedContent.scala +++ b/common/app/model/RelatedContent.scala @@ -26,7 +26,7 @@ object StoryPackages { val storyPackagesContent: Seq[ApiContent] = response.packages .map { packages => val allContentsPerPackage: Seq[Seq[ApiContent]] = packages.map(_.articles.map(_.content).toSeq).toSeq - if (packages.size > 1) { //intermix packages only if more than one + if (packages.size > 1) { // intermix packages only if more than one allContentsPerPackage .flatMap(_.zipWithIndex) // zip content with its position .groupBy(_._1.id) diff --git a/common/app/model/SupportedUrl.scala b/common/app/model/SupportedUrl.scala index cf0921733fbb..4560b861cca3 100644 --- a/common/app/model/SupportedUrl.scala +++ b/common/app/model/SupportedUrl.scala @@ -15,14 +15,14 @@ object SupportedUrl { fc match { case curatedContent: CuratedContent => s"/${curatedContent.properties.webUrl - .map(_.replaceFirst("^https?://www.theguardian.com/", "")) - .orElse(curatedContent.properties.href) - .getOrElse(curatedContent.card.id)}" + .map(_.replaceFirst("^https?://www.theguardian.com/", "")) + .orElse(curatedContent.properties.href) + .getOrElse(curatedContent.card.id)}" case supportingCuratedContent: SupportingCuratedContent => s"/${supportingCuratedContent.properties.webUrl - .map(_.replaceFirst("^https?://www.theguardian.com/", "")) - .orElse(supportingCuratedContent.properties.href) - .getOrElse(supportingCuratedContent.card.id)}" + .map(_.replaceFirst("^https?://www.theguardian.com/", "")) + .orElse(supportingCuratedContent.properties.href) + .getOrElse(supportingCuratedContent.card.id)}" case linkSnap: LinkSnap => linkSnap.properties.href.getOrElse(linkSnap.card.id) case latestSnap: LatestSnap => latestSnap.properties.maybeContent diff --git a/common/app/model/content.scala b/common/app/model/content.scala index 369db43edea9..23f7bd2753ab 100644 --- a/common/app/model/content.scala +++ b/common/app/model/content.scala @@ -164,12 +164,12 @@ final case class Content( case paid if isPaidContent => Paid case oldcommentObserver if isOldOpinion && isFromTheObserver => CommentObserverOldContent(trail.webPublicationDate.getYear) - case oldComment if isOldOpinion => CommentGuardianOldContent(trail.webPublicationDate.getYear) - case commentObserver if tags.isComment && isFromTheObserver => ObserverOpinion - case comment if tags.isComment => GuardianOpinion - case live if tags.isLiveBlog => Live - case oldObserver if isOldNews && isFromTheObserver => ObserverOldContent(trail.webPublicationDate.getYear) - case old if isOldNews => GuardianOldContent(trail.webPublicationDate.getYear) + case oldComment if isOldOpinion => CommentGuardianOldContent(trail.webPublicationDate.getYear) + case commentObserver if tags.isComment && isFromTheObserver => ObserverOpinion + case comment if tags.isComment => GuardianOpinion + case live if tags.isLiveBlog => Live + case oldObserver if isOldNews && isFromTheObserver => ObserverOldContent(trail.webPublicationDate.getYear) + case old if isOldNews => GuardianOldContent(trail.webPublicationDate.getYear) case ratingObserver if starRating.isDefined && isFromTheObserver => ObserverStarRating(starRating.get) case rating if starRating.isDefined => GuardianStarRating(starRating.get) case observerDefault if isFromTheObserver => ObserverDefault @@ -397,7 +397,7 @@ final case class Content( val twitterProperties: Map[String, String] = Map( "twitter:app:url:googleplay" -> metadata.webUrl - .replaceFirst("^[a-zA-Z]*://", "guardian://"), //replace current scheme with guardian mobile app scheme + .replaceFirst("^[a-zA-Z]*://", "guardian://"), // replace current scheme with guardian mobile app scheme "twitter:image" -> twitterCardImage, "twitter:card" -> "summary_large_image", ) ++ contributorTwitterHandle.map(handle => "twitter:creator" -> s"@$handle").toList @@ -962,7 +962,7 @@ case class GenericLightbox( "ratio" -> Try(JsNumber(img.width.toDouble / img.height.toDouble)).getOrElse(JsNumber(1)), "role" -> JsString(img.role.toString), "parentContentId" -> JsString(properties.id), - "id" -> JsString(properties.id), //duplicated to simplify lightbox logic + "id" -> JsString(properties.id), // duplicated to simplify lightbox logic ), ) } diff --git a/common/app/model/content/Atom.scala b/common/app/model/content/Atom.scala index 543a8dc19d66..6dd7f0d37c52 100644 --- a/common/app/model/content/Atom.scala +++ b/common/app/model/content/Atom.scala @@ -183,7 +183,7 @@ final case class MediaAtom( val oneHour = new Duration(Duration.standardHours(1)) val durationPattern = if (jodaDuration.isShorterThan(oneHour)) "mm:ss" else "HH:mm:ss" val formattedDuration = DurationFormatUtils.formatDuration(jodaDuration.getMillis, durationPattern, true) - "^0".r.replaceFirstIn(formattedDuration, "") //strip leading zero + "^0".r.replaceFirstIn(formattedDuration, "") // strip leading zero } } } diff --git a/common/app/model/dotcomrendering/DotcomRenderingDataModel.scala b/common/app/model/dotcomrendering/DotcomRenderingDataModel.scala index 5707f408a0b7..dd594707ba46 100644 --- a/common/app/model/dotcomrendering/DotcomRenderingDataModel.scala +++ b/common/app/model/dotcomrendering/DotcomRenderingDataModel.scala @@ -429,7 +429,7 @@ object DotcomRenderingDataModel { bodyBlocks = bodyBlocks, pageType = pageType, hasStoryPackage = page.related.hasStoryPackage, - storyPackage = getStoryPackage(page.related.faciaItems, request), //todo + storyPackage = getStoryPackage(page.related.faciaItems, request), // todo pinnedPost = pinnedPost, keyEvents = timelineBlocks, filterKeyEvents = filterKeyEvents, diff --git a/common/app/model/dotcomrendering/DotcomRenderingUtils.scala b/common/app/model/dotcomrendering/DotcomRenderingUtils.scala index 68eddff3de33..10b70491d263 100644 --- a/common/app/model/dotcomrendering/DotcomRenderingUtils.scala +++ b/common/app/model/dotcomrendering/DotcomRenderingUtils.scala @@ -246,10 +246,10 @@ object DotcomRenderingUtils { val contentHtml = Jsoup.parse(content.fields.body) val bodyElements = contentHtml.select("body").first().children() - /** On smaller devices, the disclaimer is inserted before paragraph 2 of the article body and floats left. - * This logic ensures there are two clear paragraphs of text at the top of the article. - * We don't support inserting the disclaimer next to other element types. - * It also ensures the second paragraph is long enough to accommodate the disclaimer appearing alongside it. + /** On smaller devices, the disclaimer is inserted before paragraph 2 of the article body and floats left. This + * logic ensures there are two clear paragraphs of text at the top of the article. We don't support inserting the + * disclaimer next to other element types. It also ensures the second paragraph is long enough to accommodate the + * disclaimer appearing alongside it. */ if (bodyElements.size >= 2) { val firstEl = bodyElements.get(0) diff --git a/common/app/model/dotcomrendering/ElementsEnhancer.scala b/common/app/model/dotcomrendering/ElementsEnhancer.scala index 0e2f595479a2..8e74f7fe4a05 100644 --- a/common/app/model/dotcomrendering/ElementsEnhancer.scala +++ b/common/app/model/dotcomrendering/ElementsEnhancer.scala @@ -2,8 +2,9 @@ package model.dotcomrendering import play.api.libs.json.{Json, _} -/** The `ElementsEnhancer` object provides functions to enhance JSON representations of elements used in Dotcom Rendering. - * It adds unique identifiers to elements, as expected by the DCR schemas. More information on the decision for this can be found in PageElement-Identifiers.md or by searching for "03feb394-a17d-4430-8384-edd1891e0d01" +/** The `ElementsEnhancer` object provides functions to enhance JSON representations of elements used in Dotcom + * Rendering. It adds unique identifiers to elements, as expected by the DCR schemas. More information on the decision + * for this can be found in PageElement-Identifiers.md or by searching for "03feb394-a17d-4430-8384-edd1891e0d01" */ object ElementsEnhancer { diff --git a/common/app/model/facia.scala b/common/app/model/facia.scala index 30eb0ad3571b..fcf01bdc5ace 100644 --- a/common/app/model/facia.scala +++ b/common/app/model/facia.scala @@ -8,8 +8,8 @@ import play.api.libs.json.{Json, OFormat} case class SeoDataJson( id: String, navSection: Option[String], - webTitle: Option[String], //Always short, eg, "Reviews" for "tone/reviews" id - title: Option[String], //Long custom title entered by editors + webTitle: Option[String], // Always short, eg, "Reviews" for "tone/reviews" id + title: Option[String], // Long custom title entered by editors description: Option[String], ) @@ -22,7 +22,7 @@ object SeoData extends GuLogging { def fromPath(path: String): SeoData = (path.split('/').toList: @unchecked) match { // split() never gives the empty list - //This case is only to handle the nonevent of uk/technology/games + // This case is only to handle the nonevent of uk/technology/games case edition :: section :: name :: tail if editions.contains(edition.toLowerCase) => val webTitle: String = webTitleFromTail(name :: tail) SeoData(path, section, webTitle, None, descriptionFromWebTitle(webTitle)) diff --git a/common/app/model/meta.scala b/common/app/model/meta.scala index 94b3158cc085..3de1ebb0ec37 100644 --- a/common/app/model/meta.scala +++ b/common/app/model/meta.scala @@ -423,7 +423,7 @@ case class MetaData( "al:ios:url" -> s"gnmguardian://$iosId", "al:ios:app_store_id" -> "409128287", "al:ios:app_name" -> "The Guardian", - ), + ) ) getOrElse Nil) } @@ -438,7 +438,7 @@ case class MetaData( "twitter:app:url:ipad" -> s"gnmguardian://$iosId", "twitter:app:name:googleplay" -> "The Guardian", "twitter:app:id:googleplay" -> "com.guardian", - ), + ) ) getOrElse Nil) def linkedData: List[LinkedData] = @@ -571,7 +571,7 @@ case class TagCombiner( pagination = pagination, description = Some(DotcomContentType.TagIndex.name), commercial = Some( - //We only use the left tag for CommercialProperties + // We only use the left tag for CommercialProperties CommercialProperties( editionBrandings = leftTag.properties.commercial.map(_.editionBrandings).getOrElse(Set.empty), editionAdTargetings = leftTag.properties.commercial.map(_.editionAdTargetings).getOrElse(Set.empty), @@ -857,7 +857,7 @@ final case class Tags(tags: List[Tag]) { lazy val isClimateChangeSeries: Boolean = tags.exists(t => t.id == "environment/series/keep-it-in-the-ground") lazy val isPrintSalesSeries: Boolean = tags.exists(t => t.id == "artanddesign/series/guardian-print-shop") lazy val isTheMinuteArticle: Boolean = tags.exists(t => t.id == "tone/minute") - //this is for the immersive header to access this info + // this is for the immersive header to access this info lazy val isPaidContent: Boolean = tags.exists(t => t.id == "tone/advertisement-features") lazy val isPolitics: Boolean = tags.exists(t => t.id == "politics/politics") diff --git a/common/app/navigation/NavLinks.scala b/common/app/navigation/NavLinks.scala index 5fd28e38e43c..b8c2cac2d48b 100644 --- a/common/app/navigation/NavLinks.scala +++ b/common/app/navigation/NavLinks.scala @@ -385,7 +385,7 @@ object NavLinks { ), ) - //Sport Pillar + // Sport Pillar val ukSportPillar = NavLink( "Sport", "/sport", diff --git a/common/app/pagepresser/HtmlCleaner.scala b/common/app/pagepresser/HtmlCleaner.scala index 0748617bec15..9503682e5863 100644 --- a/common/app/pagepresser/HtmlCleaner.scala +++ b/common/app/pagepresser/HtmlCleaner.scala @@ -19,7 +19,7 @@ abstract class HtmlCleaner extends GuLogging { removeAds(document) removeByClass(document, "top-search-box") removeByClass(document, "share-links") - //removeRelatedComponent(document) This removes the byline on datablog pieces, but may be needed elsewhere + // removeRelatedComponent(document) This removes the byline on datablog pieces, but may be needed elsewhere removeByClass(document, "user-details") removeByClass(document, "initially-off") removeByClass(document, "comment-count") diff --git a/common/app/services/ConfigAgentTrait.scala b/common/app/services/ConfigAgentTrait.scala index a24b2164badc..067631fe260f 100644 --- a/common/app/services/ConfigAgentTrait.scala +++ b/common/app/services/ConfigAgentTrait.scala @@ -22,15 +22,12 @@ case class CollectionConfigWithId(id: String, config: CollectionConfig) /** ConfigAgent is a cache for Fronts config. * - * It is the metadata overview for all fronts on www.theguardian.com. It - * describes the fronts on website along with the collections they contain. The - * data is pulled from a single file in S3 in the CMS Fronts AWS account. + * It is the metadata overview for all fronts on www.theguardian.com. It describes the fronts on website along with the + * collections they contain. The data is pulled from a single file in S3 in the CMS Fronts AWS account. * - * Note, it is pre 'pressing', which means that collections do not contain CAPI - * article data for backfill etc. Instead, only the metadata is stored - e.g. - * if the backfill is CAPI-driven and, if so, the query to use. Full data can - * then be retrieved from the (pressed) Fronts API, which again is really a - * wrapper over an S3 bucket. + * Note, it is pre 'pressing', which means that collections do not contain CAPI article data for backfill etc. Instead, + * only the metadata is stored - e.g. if the backfill is CAPI-driven and, if so, the query to use. Full data can then + * be retrieved from the (pressed) Fronts API, which again is really a wrapper over an S3 bucket. */ object ConfigAgent extends GuLogging { implicit lazy val alterTimeout: Timeout = Configuration.faciatool.configBeforePressTimeout.millis diff --git a/common/app/services/IndexPage.scala b/common/app/services/IndexPage.scala index a3682baf8ac2..0325eb8c37d5 100644 --- a/common/app/services/IndexPage.scala +++ b/common/app/services/IndexPage.scala @@ -54,7 +54,7 @@ object IndexPage { case _ => None } - //noinspection ScalaStyle + // noinspection ScalaStyle def makeFront(indexPage: IndexPage, edition: Edition)(implicit context: ApplicationContext): Front = { val isCartoonPage = indexPage.isTagWithId("type/cartoon") val isReviewPage = indexPage.isTagWithId("tone/reviews") diff --git a/common/app/services/repositories.scala b/common/app/services/repositories.scala index 5ccf12490b2d..6a73603e413b 100644 --- a/common/app/services/repositories.scala +++ b/common/app/services/repositories.scala @@ -89,7 +89,7 @@ trait Index extends ConciergeRepository { promiseOfResponse .recover({ - //this is the best handle we have on a wrong 'page' number + // this is the best handle we have on a wrong 'page' number case ContentApiError(400, _, _) => Left(Found(s"/$leftSide+$rightSide")) }) .recover(convertApiExceptions) @@ -99,7 +99,7 @@ trait Index extends ConciergeRepository { private def findTag(trail: ContentType, tagId: String) = trail.content.tags.tags .filter(tag => tagId.contains(tag.id)) - .sortBy(tag => tagId.replace(tag.id, "")) //effectively sorts by best match + .sortBy(tag => tagId.replace(tag.id, "")) // effectively sorts by best match .headOption private def pagination(response: ItemResponse) = @@ -133,8 +133,8 @@ trait Index extends ConciergeRepository { * * As items can only have one section, but can have multiple section tags, this is how we get content of what are * essentially 'subsections' in the nav. e.g., if you looked up 'culture' as a section, you would only get the - * items that directly belong to that section, which would exclude items in the 'books' section. If you look up - * the 'culture/culture' tag, however, you'll get all of the things in 'culture', but also all of the things in + * items that directly belong to that section, which would exclude items in the 'books' section. If you look up the + * 'culture/culture' tag, however, you'll get all of the things in 'culture', but also all of the things in * 'books', as everything in 'books' is also tagged 'culture/culture'. */ val queryPath = maybeSection.fold(path)(s => SectionTagLookUp.tagId(s.id)) @@ -176,7 +176,7 @@ trait Index extends ConciergeRepository { promiseOfResponse .recover({ - //this is the best handle we have on a wrong 'page' number + // this is the best handle we have on a wrong 'page' number case ContentApiError(400, _, _) if pageNum != 1 => Left(Found(s"/$path")) }) .recover(convertApiExceptions) @@ -204,7 +204,7 @@ trait Index extends ConciergeRepository { val leadContentCutOff = DateTime.now - QueryDefaults.leadContentMaxAge val editorsPicks = response.editorsPicks.getOrElse(Nil).map(IndexPageItem(_)) val leadContent = - if (editorsPicks.isEmpty && page == 1) //only promote lead content on first page + if (editorsPicks.isEmpty && page == 1) // only promote lead content on first page response.leadContent .getOrElse(Nil) .take(1) diff --git a/common/app/views/support/Commercial.scala b/common/app/views/support/Commercial.scala index b3c1a3bc2eac..8bfbea4fda95 100644 --- a/common/app/views/support/Commercial.scala +++ b/common/app/views/support/Commercial.scala @@ -163,16 +163,18 @@ object Commercial { def numberOfItems(container: FaciaContainer): Int = container.containerLayout .map { - _.slices.flatMap { - _.columns.flatMap { case ColumnAndCards(_, cards) => - cards.flatMap { - _.item match { - case card: ContentCard => Some(card) - case _ => None + _.slices + .flatMap { + _.columns.flatMap { case ColumnAndCards(_, cards) => + cards.flatMap { + _.item match { + case card: ContentCard => Some(card) + case _ => None + } } } } - }.length + .length } .getOrElse(0) diff --git a/common/app/views/support/EmailHelpers.scala b/common/app/views/support/EmailHelpers.scala index 067938e9ec3a..4a9e1e8d32af 100644 --- a/common/app/views/support/EmailHelpers.scala +++ b/common/app/views/support/EmailHelpers.scala @@ -67,9 +67,9 @@ object EmailHelpers { card.header.url match { case EditionalisedLink(urlMatcher(baseUrl)) => { s"""${img(width)( - url, - Some(altTextOverride.getOrElse(card.header.headline)), - )}""" + url, + Some(altTextOverride.getOrElse(card.header.headline)), + )}""" } case _ => { s"""${img(width)(url, Some(altTextOverride.getOrElse(card.header.headline)))}""" diff --git a/common/app/views/support/HtmlCleaner.scala b/common/app/views/support/HtmlCleaner.scala index 4ee281f9c381..30d1d63409f2 100644 --- a/common/app/views/support/HtmlCleaner.scala +++ b/common/app/views/support/HtmlCleaner.scala @@ -795,9 +795,9 @@ case class CommercialMPUForFronts()(implicit val request: RequestHeader) extends for (container <- containersForCommercialMPUs) { container.after(s"""
${sliceSlot( - containersForCommercialMPUs.indexOf(container), - isMobile = true, - )}
""") + containersForCommercialMPUs.indexOf(container), + isMobile = true, + )}""") } // On desktop, a MPU slot is simply inserted when there is a slice available diff --git a/common/app/views/support/MostPopularTags.scala b/common/app/views/support/MostPopularTags.scala index 39eb738178f0..8a8f52d6e121 100644 --- a/common/app/views/support/MostPopularTags.scala +++ b/common/app/views/support/MostPopularTags.scala @@ -7,8 +7,8 @@ import implicits.FaciaContentFrontendHelpers.FaciaContentFrontendHelper object MostPopularTags { - /** A descending list of the tags that occur most frequently within the given items of content and how frequently - * they occur + /** A descending list of the tags that occur most frequently within the given items of content and how frequently they + * occur */ def apply(items: Seq[PressedContent]): Seq[(Tag, Int)] = items diff --git a/common/app/views/support/WitnessCleaner.scala b/common/app/views/support/WitnessCleaner.scala index fc2c3922469a..6840ff415c3b 100644 --- a/common/app/views/support/WitnessCleaner.scala +++ b/common/app/views/support/WitnessCleaner.scala @@ -7,7 +7,7 @@ object WitnessCleaner extends HtmlCleaner { override def clean(document: Document): Document = { document.getElementsByClass("element-witness-video").asScala.foreach { embed: Element => - //remove height from video iframe + // remove height from video iframe embed.getElementsByClass("element-witness--main").asScala.foreach { main => main.getElementsByTag("iframe").asScala.foreach(_.attr("height", "")) } diff --git a/common/app/views/support/package.scala b/common/app/views/support/package.scala index 0e5b8fdaa6b2..1ff524e6ded1 100644 --- a/common/app/views/support/package.scala +++ b/common/app/views/support/package.scala @@ -27,8 +27,8 @@ case class PreviousAndNext(prev: Option[String], next: Option[String]) { } object JSON { - //we wrap the result in an Html so that play does not escape it as html - //after we have gone to the trouble of escaping it as Javascript + // we wrap the result in an Html so that play does not escape it as html + // after we have gone to the trouble of escaping it as Javascript def apply[T](json: T)(implicit tjs: Writes[T]): Html = Html(stringify(toJson(json))) } @@ -206,7 +206,7 @@ object StripHtmlTagsAndUnescapeEntities { val doc = new Cleaner(Safelist.none()).clean(Jsoup.parse(html)) val stripped = doc.body.html val unescaped = StringEscapeUtils.unescapeHtml(stripped) - unescaped.replace("\"", """) //double quotes will break HTML attributes + unescaped.replace("\"", """) // double quotes will break HTML attributes } } diff --git a/common/test/common/ModelOrResultTest.scala b/common/test/common/ModelOrResultTest.scala index 074f2e6aec21..e98c296f5962 100644 --- a/common/test/common/ModelOrResultTest.scala +++ b/common/test/common/ModelOrResultTest.scala @@ -160,7 +160,7 @@ class ModelOrResultTest extends AnyFlatSpec with Matchers with WithTestExecution status(notFound) should be(200) headers(notFound).apply("X-Accel-Redirect") should be( "/facia/type/article", - ) //Back to facia in case it is overridden + ) // Back to facia in case it is overridden } it should "internal redirect to a section if it has shown up at the wrong server" in { diff --git a/common/test/common/TrailsToShowcaseTest.scala b/common/test/common/TrailsToShowcaseTest.scala index 225851b83622..325d7b10d90b 100644 --- a/common/test/common/TrailsToShowcaseTest.scala +++ b/common/test/common/TrailsToShowcaseTest.scala @@ -1077,7 +1077,7 @@ class TrailsToShowcaseTest extends AnyFlatSpec with Matchers with EitherValues { val outcome = TrailsToShowcase.asSingleStoryPanel(withLongByline) outcome.value.author should be(None) - //outcome.left.get.contains("Author was too long and was dropped") shouldBe(true) + // outcome.left.get.contains("Author was too long and was dropped") shouldBe(true) } "TrailToShowcase validation" should "reject single panels with no image" in { diff --git a/common/test/conf/CachedHealthCheckTest.scala b/common/test/conf/CachedHealthCheckTest.scala index c8db040ad3f7..886f9550e630 100644 --- a/common/test/conf/CachedHealthCheckTest.scala +++ b/common/test/conf/CachedHealthCheckTest.scala @@ -23,7 +23,7 @@ import scala.util.Random with WithMaterializer with WithTestWsClient { - //Helper method to construct mock Results + // Helper method to construct mock Results def mockResult( statusCode: Int, date: DateTime = DateTime.now, diff --git a/common/test/model/ContentTest.scala b/common/test/model/ContentTest.scala index 174a95929a0c..9f6c7a978587 100644 --- a/common/test/model/ContentTest.scala +++ b/common/test/model/ContentTest.scala @@ -55,7 +55,7 @@ class ContentTest webTitle = "Some article", webUrl = "http://www.guardian.co.uk/foo/2012/jan/07/bar", apiUrl = "http://content.guardianapis.com/foo/2012/jan/07/bar", - //mediaAssets = media, + // mediaAssets = media, tags = List(tag("type/article")), elements = Some(elements), ) diff --git a/common/test/model/DateTimeTest.scala b/common/test/model/DateTimeTest.scala index 1e567f41169d..89b772f2cc67 100644 --- a/common/test/model/DateTimeTest.scala +++ b/common/test/model/DateTimeTest.scala @@ -8,7 +8,7 @@ import org.scalatest.flatspec.AnyFlatSpec class DateTimeTest extends AnyFlatSpec with Matchers with implicits.Dates { - //http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + // http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 "Date pimps" should "understand HTTP date time" in { diff --git a/common/test/model/dotcomrendering/pageElements/TextCleanerTest.scala b/common/test/model/dotcomrendering/pageElements/TextCleanerTest.scala index 74488a1b535f..576a0e4278a6 100644 --- a/common/test/model/dotcomrendering/pageElements/TextCleanerTest.scala +++ b/common/test/model/dotcomrendering/pageElements/TextCleanerTest.scala @@ -31,9 +31,12 @@ class TextCleanerTest extends AnyFlatSpec with Matchers { "Add link" should "link tags in a text block element and return linked terms" in { val examples = List( TextBlockElement("the Champions League is great!") -> - (TextBlockElement( - s"""the Champions League is great!""", - ), Set("Champions League")), + ( + TextBlockElement( + s"""the Champions League is great!""", + ), + Set("Champions League"), + ), TextBlockElement("What do you think about the Champions?") -> (TextBlockElement("What do you think about the Champions?"), Set.empty), ) diff --git a/common/test/package.scala b/common/test/package.scala index 7ef41a5fef3b..f7102aac8933 100644 --- a/common/test/package.scala +++ b/common/test/package.scala @@ -56,9 +56,8 @@ trait ConfiguredTestSuite extends TestSuite with ConfiguredServer with Configure block(testBrowser) } - /** `HTMLUnit` doesn't support [[io.fluentlenium.core.domain.FluentWebElement.html]] - * via TestBrowser, so use [[WebClient]] to retrieve a [[WebResponse]] instead, so - * we can use [[WebResponse.getContentAsString]] + /** `HTMLUnit` doesn't support [[io.fluentlenium.core.domain.FluentWebElement.html]] via TestBrowser, so use + * [[WebClient]] to retrieve a [[WebResponse]] instead, so we can use [[WebResponse.getContentAsString]] */ protected def getContentString[T](path: String)(block: String => T): T = { webClient.getOptions.setJavaScriptEnabled(false) @@ -178,7 +177,7 @@ trait WithTestFrontJsonFapi { val recorder = new HttpRecorder[Option[PressedPage]] { override lazy val baseDir = new File(System.getProperty("user.dir"), "data/pressedPage") - //No transformation for now as we only store content that's there. + // No transformation for now as we only store content that's there. override def toResponse(b: Array[Byte]): Option[PressedPage] = Json.parse(new String(b, UTF8.charSet)).asOpt[PressedPage] diff --git a/common/test/views/support/TitleTest.scala b/common/test/views/support/TitleTest.scala index a5ba0a235ef4..feec22fb033c 100644 --- a/common/test/views/support/TitleTest.scala +++ b/common/test/views/support/TitleTest.scala @@ -19,7 +19,7 @@ class TitleTest extends AnyFlatSpec with Matchers with GuiceOneAppPerSuite { it should "should create a 'default' title" in { val page = SimplePage(MetaData.make("", None, "The title", None)) - //without pagination + // without pagination Title(page).body should be("The title | The Guardian") val withPagination = SimplePage( @@ -31,7 +31,7 @@ class TitleTest extends AnyFlatSpec with Matchers with GuiceOneAppPerSuite { ), ) - //with pagination + // with pagination Title(withPagination).body should be("The title | Page 7 of 50 | The Guardian") } diff --git a/discussion/app/discussion/api/DiscussionApi.scala b/discussion/app/discussion/api/DiscussionApi.scala index a23c01e2830d..f43c86be04d3 100644 --- a/discussion/app/discussion/api/DiscussionApi.scala +++ b/discussion/app/discussion/api/DiscussionApi.scala @@ -28,7 +28,7 @@ trait DiscussionApiLike extends Http with GuLogging { protected val defaultParams = List("api-key" -> Some("dotcom")) protected val pageSize: String = "10" - def endpointUrl(relativePath: String, params: List[(String, Option[String])] = List()): String = { //Using List for params because order is important for caching reason + def endpointUrl(relativePath: String, params: List[(String, Option[String])] = List()): String = { // Using List for params because order is important for caching reason implicit val config: UriConfig = UriConfig(renderQuery = ExcludeNones) Url.parse(apiRoot + relativePath).addParams(params ++ defaultParams).toString() } diff --git a/facia-press/app/frontpress/FapiFrontPress.scala b/facia-press/app/frontpress/FapiFrontPress.scala index 2426c800788b..3315e7cb3a47 100644 --- a/facia-press/app/frontpress/FapiFrontPress.scala +++ b/facia-press/app/frontpress/FapiFrontPress.scala @@ -504,7 +504,7 @@ trait FapiFrontPress extends EmailFrontPress with GuLogging { .map(_.webTitle) .orElse(itemResponse.section.map(_.webTitle)) - //This will turn au/culture into culture. We want to stay consistent with the manual entry and autogeneration + // This will turn au/culture into culture. We want to stay consistent with the manual entry and autogeneration private def removeLeadEditionFromSectionId(sectionId: String): String = sectionId.split('/').toList match { case edition :: tail if Edition.byId(edition).isDefined => tail.mkString("/") diff --git a/facia-press/app/frontpress/JsonQueueWorker.scala b/facia-press/app/frontpress/JsonQueueWorker.scala index b35e06487a58..600d702898ad 100644 --- a/facia-press/app/frontpress/JsonQueueWorker.scala +++ b/facia-press/app/frontpress/JsonQueueWorker.scala @@ -58,7 +58,8 @@ object JsonQueueWorker { * * Provides two * - * @tparam A The job + * @tparam A + * The job */ abstract class JsonQueueWorker[A: Reads]()(implicit executionContext: ExecutionContext) extends GuLogging { import JsonQueueWorker._ @@ -119,7 +120,7 @@ abstract class JsonQueueWorker[A: Reads]()(implicit executionContext: ExecutionC case error: ContentApiError => log.error( s"Encountered content api error receiving message from queue: httpMessage: ${error.httpMessage}; status: ${error.httpStatus}; response: ${error.errorResponse - .getOrElse("")}.", + .getOrElse("")}.", error, ) case error: Throwable => log.error("Encountered error receiving message from queue", error) diff --git a/facia/app/controllers/FaciaController.scala b/facia/app/controllers/FaciaController.scala index fddbfb770497..cf6fabb2db0d 100644 --- a/facia/app/controllers/FaciaController.scala +++ b/facia/app/controllers/FaciaController.scala @@ -63,14 +63,14 @@ trait FaciaController ) } - //ApplePay MerchantId + // ApplePay MerchantId def appleDeveloperMerchantId(): Action[AnyContent] = if (Configuration.environment.isProd) assets.at(path = "/public", file = "apple-developer-merchantid-domain-association-prod.txt") else assets.at(path = "/public", file = "apple-developer-merchantid-domain-association-code.txt") - //Only used by dev-build for rending special urls such as lifeandstyle/home-and-garden + // Only used by dev-build for rending special urls such as lifeandstyle/home-and-garden def renderFrontPressSpecial(path: String): Action[AnyContent] = Action.async { implicit request => renderFrontPressResult(path) } @@ -253,7 +253,7 @@ trait FaciaController val pageType = PageType(faciaPage, request, context) log.info( s"Front Geo Request (212): ${Edition(request).id} ${request.headers.toSimpleMap - .getOrElse("X-GU-GeoLocation", "country:row")}", + .getOrElse("X-GU-GeoLocation", "country:row")}", ) withVaryHeader( remoteRenderer.getFront( @@ -278,7 +278,7 @@ trait FaciaController val result = if (request.forceDCR) { log.info( s"Front Geo Request (237): ${Edition(request).id} ${request.headers.toSimpleMap - .getOrElse("X-GU-GeoLocation", "country:row")}", + .getOrElse("X-GU-GeoLocation", "country:row")}", ) JsonComponent.fromWritable( DotcomFrontsRenderingDataModel( @@ -458,12 +458,10 @@ trait FaciaController ) } - /** Note, the way this method works is a bit circuitous. Firstly, it finds a - * front that contains the collection (via the ConfigAgent, which is - * basically a cache of configuration for Guardian Fronts). It then looks up - * that front in Frontend's S3 and extracts the full collection from it (with - * curated and backfill content etc.). It would be easier if collections were - * stored somewhere independently of Fronts. + /** Note, the way this method works is a bit circuitous. Firstly, it finds a front that contains the collection (via + * the ConfigAgent, which is basically a cache of configuration for Guardian Fronts). It then looks up that front in + * Frontend's S3 and extracts the full collection from it (with curated and backfill content etc.). It would be + * easier if collections were stored somewhere independently of Fronts. */ private def getPressedCollection( collectionId: String, diff --git a/facia/app/services/dotcomrendering/FaciaPicker.scala b/facia/app/services/dotcomrendering/FaciaPicker.scala index f379cc7c453e..165676e1bb87 100644 --- a/facia/app/services/dotcomrendering/FaciaPicker.scala +++ b/facia/app/services/dotcomrendering/FaciaPicker.scala @@ -16,7 +16,8 @@ object FrontChecks { * * **It must be kept in sync manually.** * - * @see https://github.com/guardian/dotcom-rendering/blob/07b8f29decc1/dotcom-rendering/src/types/front.ts#L61-L83 + * @see + * https://github.com/guardian/dotcom-rendering/blob/07b8f29decc1/dotcom-rendering/src/types/front.ts#L61-L83 */ val SUPPORTED_COLLECTIONS: Set[String] = Set( diff --git a/facia/test/FaciaControllerTest.scala b/facia/test/FaciaControllerTest.scala index 565c582855ff..0af2e567ad5e 100644 --- a/facia/test/FaciaControllerTest.scala +++ b/facia/test/FaciaControllerTest.scala @@ -96,7 +96,7 @@ import scala.concurrent.{Await, Future} } it should "serve an X-Accel-Redirect for something it doesn't know about" in { - val result = faciaController.renderFront("does-not-exist")(TestRequest()) //Film is actually a facia front ON PROD + val result = faciaController.renderFront("does-not-exist")(TestRequest()) // Film is actually a facia front ON PROD status(result) should be(200) header("X-Accel-Redirect", result) should be(Some("/applications/does-not-exist")) } diff --git a/identity/app/actions/AuthenticatedActions.scala b/identity/app/actions/AuthenticatedActions.scala index 69f0e3c4233b..2904447da9f9 100644 --- a/identity/app/actions/AuthenticatedActions.scala +++ b/identity/app/actions/AuthenticatedActions.scala @@ -42,7 +42,7 @@ class AuthenticatedActions( "clientId", "encryptedEmail", "autoSignInToken", - ) //only forward these if they exist in original query string + ) // only forward these if they exist in original query string .flatMap(name => request.getQueryString(name).map(value => name -> value), ) :+ createAuthenticationComponentEventTuple(SigninRedirect) diff --git a/identity/app/clients/DiscussionClient.scala b/identity/app/clients/DiscussionClient.scala index 19e2a510b05f..82a5a7186243 100644 --- a/identity/app/clients/DiscussionClient.scala +++ b/identity/app/clients/DiscussionClient.scala @@ -95,9 +95,9 @@ class DiscussionClient(wsClient: WSClient, config: conf.IdentityConfiguration)(i } } - /** Check if the user has at least one comment. - * This method simply requests a single comment, and checks if the response is non-empty. - * If it is, the user has at least one publicly visible comment, and their profile can be shown. + /** Check if the user has at least one comment. This method simply requests a single comment, and checks if the + * response is non-empty. If it is, the user has at least one publicly visible comment, and their profile can be + * shown. */ def profileHasAtLeastOneComment(userId: String): Future[Boolean] = { diff --git a/identity/app/controllers/PublicProfileController.scala b/identity/app/controllers/PublicProfileController.scala index 86e0cd81e626..9d16cb5381bc 100644 --- a/identity/app/controllers/PublicProfileController.scala +++ b/identity/app/controllers/PublicProfileController.scala @@ -53,8 +53,8 @@ class PublicProfileController( Future.successful(renderUserNotFoundPage(url, request)) case Right(user) => - /** Only render public profile if a user in Identity also exists in Discussion - * and has one or more comments, otherwise return a no comments page. + /** Only render public profile if a user in Identity also exists in Discussion and has one or more comments, + * otherwise return a no comments page. */ discussionService.findDiscussionUserFilterCommented(user.id).map { case None => diff --git a/identity/app/controllers/editprofile/ProfileForms.scala b/identity/app/controllers/editprofile/ProfileForms.scala index d58fa5c0f69d..2ed759f08e8e 100644 --- a/identity/app/controllers/editprofile/ProfileForms.scala +++ b/identity/app/controllers/editprofile/ProfileForms.scala @@ -8,8 +8,10 @@ import play.api.i18n.MessagesProvider /** Holds all Edit Profile forms and designates which one is user currently viewing * - * @param privacyForm /privacy/edit - * @param activePage which page is user currently viewing and hence which form + * @param privacyForm + * /privacy/edit + * @param activePage + * which page is user currently viewing and hence which form */ case class ProfileForms( privacyForm: Form[PrivacyFormData], @@ -18,12 +20,15 @@ case class ProfileForms( object ProfileForms { - /** Constructs ProfileForms instance by filling all the Edit Profile forms (Public, Account, Privacy) - * with the corresponding DTO that will be constructed out of the provided User DO + /** Constructs ProfileForms instance by filling all the Edit Profile forms (Public, Account, Privacy) with the + * corresponding DTO that will be constructed out of the provided User DO * - * @param userDO User domain object from IDAPI used to create per-form specialised DTO fillers - * @param activePage Which page is user currently viewing - * @return instance of ProfileForms having all the forms bound to their respective specialised DTO + * @param userDO + * User domain object from IDAPI used to create per-form specialised DTO fillers + * @param activePage + * Which page is user currently viewing + * @return + * instance of ProfileForms having all the forms bound to their respective specialised DTO */ def apply(userDO: User, activePage: IdentityPage)(implicit profileFormsMapping: ProfileFormsMapping, diff --git a/identity/app/form/AddressMapping.scala b/identity/app/form/AddressMapping.scala index 67343e3177c3..ee800dbb32ff 100644 --- a/identity/app/form/AddressMapping.scala +++ b/identity/app/form/AddressMapping.scala @@ -14,7 +14,8 @@ trait AddressMapping extends Mappings { private def idAddressLine(implicit messagesProvider: MessagesProvider): Mapping[String] = textField verifying ( - Messages("error.address"), { value => value.isEmpty || value.forall(isValidAddressChar) } + Messages("error.address"), + { value => value.isEmpty || value.forall(isValidAddressChar) }, ) def idAddress(implicit messagesProvider: MessagesProvider): Mapping[AddressFormData] = diff --git a/identity/app/form/DateFormData.scala b/identity/app/form/DateFormData.scala index f5aeac955cd8..26c4b5d6df1a 100644 --- a/identity/app/form/DateFormData.scala +++ b/identity/app/form/DateFormData.scala @@ -15,7 +15,7 @@ trait DateMapping { "day" -> optional(number(min = 1, max = 31)), )(DateFormData.apply)(DateFormData.unapply) verifying ( Messages("error.date"), - dateData => dateData.isValid + dateData => dateData.isValid, ) } diff --git a/identity/app/form/Mappings.scala b/identity/app/form/Mappings.scala index 4bf910f57f78..be1a5748ad7a 100644 --- a/identity/app/form/Mappings.scala +++ b/identity/app/form/Mappings.scala @@ -24,7 +24,8 @@ trait Mappings { def idPassword(implicit messagesProvider: MessagesProvider): Mapping[String] = text verifying ( - Messages("error.passwordLength"), { value => 6 <= value.length && value.length <= 72 } + Messages("error.passwordLength"), + { value => 6 <= value.length && value.length <= 72 }, ) val idCountry: Mapping[String] = comboList("" :: Countries.all) diff --git a/identity/app/form/PrivacyMapping.scala b/identity/app/form/PrivacyMapping.scala index 20162e39ea5a..314a8461e54d 100644 --- a/identity/app/form/PrivacyMapping.scala +++ b/identity/app/form/PrivacyMapping.scala @@ -40,8 +40,10 @@ object PrivacyFormData extends SafeLogging { /** Converts User DO from IDAPI to form processing DTO PrivacyFromData * - * @param userDO Identity User domain model from IDAPI defiend in identity-model library - * @return form processing DTO PrivacyFromData + * @param userDO + * Identity User domain model from IDAPI defiend in identity-model library + * @return + * form processing DTO PrivacyFromData */ def apply(userDO: User): PrivacyFormData = { PrivacyFormData( @@ -55,8 +57,10 @@ object PrivacyFormData extends SafeLogging { * * For example, if consent id is renamed, then some users might still have the old consent. * - * @param userDO Identity User domain model from IDAPI defiend that might contain some old invalid consents - * @return list of valid consents + * @param userDO + * Identity User domain model from IDAPI defiend that might contain some old invalid consents + * @return + * list of valid consents */ private def onlyValidConsents(userDO: User): List[Consent] = { def consentExistsInModel(consent: Consent): Boolean = diff --git a/identity/app/form/TelephoneNumberMapping.scala b/identity/app/form/TelephoneNumberMapping.scala index 45f4d2ba4f4d..a552072bf5a2 100644 --- a/identity/app/form/TelephoneNumberMapping.scala +++ b/identity/app/form/TelephoneNumberMapping.scala @@ -19,7 +19,7 @@ trait TelephoneNumberMapping { "localNumber" -> optional(text), )(TelephoneNumberFormData.apply)(TelephoneNumberFormData.unapply) verifying ( Messages("error.telephoneNumber"), - data => data.isValid + data => data.isValid, ) } diff --git a/identity/app/form/UserFormMapping.scala b/identity/app/form/UserFormMapping.scala index ee12462792fe..a1a374b81895 100644 --- a/identity/app/form/UserFormMapping.scala +++ b/identity/app/form/UserFormMapping.scala @@ -9,12 +9,14 @@ trait UserFormMapping[T <: UserFormData] extends Mappings { type IdapiErrorContext = String type FormFieldKey = String - /** Returns a Form filled with existing UserFormData DTO value (as opposed to binding data from request) - * which is in turn created from User DO from IDAPI. + /** Returns a Form filled with existing UserFormData DTO value (as opposed to binding data from request) which is in + * turn created from User DO from IDAPI. * - * @param userDO User domain object from IDAPI defined in identity-model library + * @param userDO + * User domain object from IDAPI defined in identity-model library * @param messagesProvider - * @return Form filled with UserFormData DTO + * @return + * Form filled with UserFormData DTO */ def fillForm(userDO: User)(implicit messagesProvider: MessagesProvider): Form[T] = Form(formMapping) fill toUserFormData(userDO) // note the indirection where userDO is converted to UserFormData @@ -24,14 +26,15 @@ trait UserFormMapping[T <: UserFormData] extends Mappings { /** Converts User domain object from IDAPI to form processing DTO * * @param userDO - * @return form processing DTO + * @return + * form processing DTO */ protected def toUserFormData(userDO: User): T } -/** Trait to represent form specific Data Transfer Objects used for form data binding. - * These DTOs are meant to represent parts of User Domain Object form +/** Trait to represent form specific Data Transfer Objects used for form data binding. These DTOs are meant to represent + * parts of User Domain Object form */ trait UserFormData { diff --git a/identity/app/idapiclient/responses/Error.scala b/identity/app/idapiclient/responses/Error.scala index 3e599f1bdf73..237cbf525e1c 100644 --- a/identity/app/idapiclient/responses/Error.scala +++ b/identity/app/idapiclient/responses/Error.scala @@ -2,9 +2,8 @@ package idapiclient.responses import play.api.libs.json.{Json, OFormat} -/** FIXME: - * This seems to be exactly the same as com.gu.identity.model.Error from identity-request library. - * Is this only representing IDAPI errors? +/** FIXME: This seems to be exactly the same as com.gu.identity.model.Error from identity-request library. Is this only + * representing IDAPI errors? */ case class Error(message: String, description: String, statusCode: Int = 500, context: Option[String] = None) diff --git a/identity/app/model/PhoneNumbers.scala b/identity/app/model/PhoneNumbers.scala index 106888384b6e..83942f731ecb 100644 --- a/identity/app/model/PhoneNumbers.scala +++ b/identity/app/model/PhoneNumbers.scala @@ -8,8 +8,8 @@ object PhoneNumbers { val phoneNumberUtil = PhoneNumberUtil.getInstance() - /** Unfortunately the country code map is not accessible in PhoneNumberUtil. This code uses reflection to obtain access - * then transform it to the correct structure. + /** Unfortunately the country code map is not accessible in PhoneNumberUtil. This code uses reflection to obtain + * access then transform it to the correct structure. */ val countryCodes = { val m = ru.runtimeMirror(phoneNumberUtil.getClass.getClassLoader) diff --git a/identity/app/utils/ConsentOrder.scala b/identity/app/utils/ConsentOrder.scala index 6c9295a4a0f8..f889004c632e 100644 --- a/identity/app/utils/ConsentOrder.scala +++ b/identity/app/utils/ConsentOrder.scala @@ -22,9 +22,12 @@ object ConsentOrder { /** Ordered + optionally hintend consents * - * @param userDO user object from identity-model which has consents field - * @param consentHint optional hint which would move that particular consent to the front - * @return copy of user with reordered consents + * @param userDO + * user object from identity-model which has consents field + * @param consentHint + * optional hint which would move that particular consent to the front + * @return + * copy of user with reordered consents */ def userWithOrderedConsents(userDO: User, consentHint: Option[String]): User = { val consentsToReorder = diff --git a/identity/test/idapiclient/parser/JsonBodyParserTest.scala b/identity/test/idapiclient/parser/JsonBodyParserTest.scala index 4cea43943136..c3dbd96c3f45 100644 --- a/identity/test/idapiclient/parser/JsonBodyParserTest.scala +++ b/identity/test/idapiclient/parser/JsonBodyParserTest.scala @@ -40,7 +40,7 @@ class JsonBodyParserTest extends PathAnyFreeSpec with Matchers { "extracts the provided type from the JSON body of a successful response" in { TestJsonBodyParser.extract[TestType]()(Right(validJSONResponse)) match { - case Left(result) => fail("extract did not return a Right, got Left(%s)".format(result.toString())) + case Left(result) => fail("extract did not return a Right, got Left(%s)".format(result.toString())) case Right(testObject: TestType) => testObject should have(Symbol("test")("value")) case Right(result) => fail("extract did not return a Right of the required type, got a %s".format(result.getClass.getName)) @@ -57,7 +57,7 @@ class JsonBodyParserTest extends PathAnyFreeSpec with Matchers { "extracts the provided type from the JSON body of a successful unit response" in { TestJsonBodyParser.extract[Unit]()(Right(emptyResponse)) match { case Left(result) => fail("extract did not return a Right, got Left(%s)".format(result.toString())) - case Right(testObject: Unit) => //good + case Right(testObject: Unit) => // good } } diff --git a/preview/app/AppLoader.scala b/preview/app/AppLoader.scala index ede57304cd22..e0e2fe332e1f 100644 --- a/preview/app/AppLoader.scala +++ b/preview/app/AppLoader.scala @@ -45,7 +45,7 @@ trait PreviewLifecycleComponents with TopicServices { self: FrontendComponents => - //Override conflicting members + // Override conflicting members override lazy val capiHttpClient: HttpClient = wire[CapiHttpClient] override lazy val contentApiClient = wire[ContentApiClient] override lazy val ophanApi = wire[OphanApi] diff --git a/sport/app/football/conf/context.scala b/sport/app/football/conf/context.scala index a284807abd7f..052086489c88 100644 --- a/sport/app/football/conf/context.scala +++ b/sport/app/football/conf/context.scala @@ -31,7 +31,7 @@ class FootballLifecycle( private def scheduleJobs(): Unit = { competitionsService.competitionIds.zipWithIndex foreach { case (id, index) => - //stagger fixtures and results refreshes to avoid timeouts + // stagger fixtures and results refreshes to avoid timeouts val seconds = index * 5 % 60 val minutes = index * 5 / 60 % 5 val cron = s"$seconds $minutes/5 * * * ?" @@ -103,8 +103,8 @@ class FootballClient(wsClient: WSClient)(implicit executionContext: ExecutionCon val promiseOfResponse = wsClient.url(urlString).withRequestTimeout(2.second).get() promiseOfResponse.map { r => - //this feed has a funny character at the start of it http://en.wikipedia.org/wiki/Zero-width_non-breaking_space - //I have reported to PA, but just trimming here so we can carry on development + // this feed has a funny character at the start of it http://en.wikipedia.org/wiki/Zero-width_non-breaking_space + // I have reported to PA, but just trimming here so we can carry on development pa.Response(r.status, r.body.dropWhile(_ != '<'), r.statusText) } } diff --git a/sport/app/football/controllers/MatchController.scala b/sport/app/football/controllers/MatchController.scala index 318650e24445..adddbfd3dfa1 100644 --- a/sport/app/football/controllers/MatchController.scala +++ b/sport/app/football/controllers/MatchController.scala @@ -45,7 +45,7 @@ case class MatchPage(theMatch: FootballMatch, lineUp: LineUp) extends Standalone id = id, section = Some(SectionId.fromId("football")), webTitle = s"${theMatch.homeTeam.name} ${theMatch.homeTeam.score.getOrElse("")} - ${theMatch.awayTeam.score - .getOrElse("")} ${theMatch.awayTeam.name}", + .getOrElse("")} ${theMatch.awayTeam.name}", javascriptConfigOverrides = javascriptConfig, ) } diff --git a/sport/app/football/controllers/MoreOnMatchController.scala b/sport/app/football/controllers/MoreOnMatchController.scala index 9c318b47fd62..44495a7e9b59 100644 --- a/sport/app/football/controllers/MoreOnMatchController.scala +++ b/sport/app/football/controllers/MoreOnMatchController.scala @@ -458,7 +458,7 @@ class MoreOnMatchController( } } - //for our purposes we expect exactly 2 football teams + // for our purposes we expect exactly 2 football teams private def hasExactlyTwoTeams(content: ContentType): Boolean = content.tags.tags.count(_.isFootballTeam) == 2 private def populateNavModel(theMatch: FootballMatch, related: Seq[ContentType])(implicit diff --git a/sport/app/football/feed/agent.scala b/sport/app/football/feed/agent.scala index 10ea60fce503..cc4e8cad44bf 100644 --- a/sport/app/football/feed/agent.scala +++ b/sport/app/football/feed/agent.scala @@ -97,8 +97,8 @@ trait Results extends GuLogging { executionContext: ExecutionContext, ): Future[List[Result]] = { log.info(s"refreshing results for ${competition.id} with startDate: ${competition.startDate}") - //it is possible that we do not know the startdate of the competition yet (concurrency) - //in that case just get the last 30 days results, the start date will catch up soon enough + // it is possible that we do not know the startdate of the competition yet (concurrency) + // in that case just get the last 30 days results, the start date will catch up soon enough val startDate = competition.startDate.getOrElse(LocalDate.now(clock).minusDays(30)) footballClient .results(competition.id, startDate) @@ -145,7 +145,7 @@ class CompetitionAgent( def addMatches(newMatches: Seq[FootballMatch]): Future[Competition] = agent.alter { comp => - //log any changes to the status of the match + // log any changes to the status of the match newMatches.foreach { newMatch => comp.matches.find(_.id == newMatch.id).foreach { oldMatch => val newSummary = newMatch.statusSummary diff --git a/sport/app/football/implicits/Football.scala b/sport/app/football/implicits/Football.scala index 475a97e32fdf..60d309109c9b 100644 --- a/sport/app/football/implicits/Football.scala +++ b/sport/app/football/implicits/Football.scala @@ -47,7 +47,7 @@ trait Football { def isOn(date: LocalDate): Boolean = m.date.toLocalDate.isAfter(date) && m.date.toLocalDate.isBefore(date.plusDays(1)) - //results and fixtures do not actually have a status field in the API + // results and fixtures do not actually have a status field in the API lazy val matchStatus = m match { case f: Fixture => "Fixture" case l: LiveMatch => l.status @@ -141,7 +141,7 @@ trait Football { "64643", "64644", "64645", - "64646", //semi final + "64646", // semi final "64647", "64648", // 3rd place playoff "64649", diff --git a/sport/app/football/model/TeamMap.scala b/sport/app/football/model/TeamMap.scala index bc6df6cf078b..03a38cb790b0 100644 --- a/sport/app/football/model/TeamMap.scala +++ b/sport/app/football/model/TeamMap.scala @@ -109,7 +109,7 @@ object TeamMap extends GuLogging { def findUrlNameFor(teamId: String): Option[String] = teamAgent().get(teamId).map(_.metadata.url.replace("/football/", "")) - def refresh(page: Int = 1)(implicit contentApiClient: ContentApiClient, executionContext: ExecutionContext): Unit = { //pages are 1 based + def refresh(page: Int = 1)(implicit contentApiClient: ContentApiClient, executionContext: ExecutionContext): Unit = { // pages are 1 based log.info(s"Refreshing team tag mappings - page $page") contentApiClient .getResponse( @@ -149,8 +149,8 @@ object MatchUrl { if homeTeam.startsWith("/football/") && awayTeam.startsWith("/football/") } yield { s"/football/match/${theMatch.date.format(DateTimeFormatter.ofPattern("yyyy/MMM/dd")).toLowerCase}/${homeTeam - .replace("/football/", "")}-v-${awayTeam - .replace("/football/", "")}" + .replace("/football/", "")}-v-${awayTeam + .replace("/football/", "")}" }).getOrElse(s"/football/match/${theMatch.id}") } diff --git a/sport/app/football/model/model.scala b/sport/app/football/model/model.scala index f928d2f00db3..84d274c55ecd 100644 --- a/sport/app/football/model/model.scala +++ b/sport/app/football/model/model.scala @@ -6,10 +6,10 @@ import pa.MatchDayTeam import java.awt.Color import java.time.LocalDate -/** @param tableDividers divides the league table into zones for promotion/relegation, or for qualification to another competition. - * Only add a table divider where the boundaries for progression are clear, e.g do not add - * a divider in Euro group stages as there are complicated rules which means some (but not all) - * teams finishing third could qualify +/** @param tableDividers + * divides the league table into zones for promotion/relegation, or for qualification to another competition. Only + * add a table divider where the boundaries for progression are clear, e.g do not add a divider in Euro group stages + * as there are complicated rules which means some (but not all) teams finishing third could qualify */ case class Competition( id: String, diff --git a/sport/app/rugby/conf/RugbyLifecycle.scala b/sport/app/rugby/conf/RugbyLifecycle.scala index f73e63f6e3e9..757f661913ed 100644 --- a/sport/app/rugby/conf/RugbyLifecycle.scala +++ b/sport/app/rugby/conf/RugbyLifecycle.scala @@ -38,7 +38,7 @@ class RugbyLifecycle( rugbyStatsJob.fetchFixturesAndResults() } - //delay to allow previous jobs to complete + // delay to allow previous jobs to complete pekkoAsync.after(initializationTimeout) { val refreshedNavContent = capiFeed.getMatchArticles(rugbyStatsJob.getAllResults()) rugbyStatsJob.sendMatchArticles(refreshedNavContent)