Skip to content

Commit

Permalink
Merge pull request #27311 from guardian/bump-various-dependencies
Browse files Browse the repository at this point in the history
Bump various dependencies
  • Loading branch information
ioannakok authored Jul 15, 2024
2 parents db72fe3 + 58f9136 commit 1c71a22
Show file tree
Hide file tree
Showing 122 changed files with 338 additions and 333 deletions.
3 changes: 2 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
version=2.7.5
version=3.8.2
runner.dialect = scala213

maxColumn = 120
trailingCommas = always
4 changes: 2 additions & 2 deletions admin/app/controllers/AdminControllers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion admin/app/controllers/FrontPressController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand Down
4 changes: 2 additions & 2 deletions admin/app/controllers/admin/R2PressController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class R2PressController(
.getLines()
.map { line =>
if (line.nonEmpty) {
//TODO: other validation?
// TODO: other validation?
if (isTakedown) {
normaliseAndEnqueueTakedown(line)
} else {
Expand All @@ -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.
}
}

Expand Down
3 changes: 2 additions & 1 deletion admin/app/controllers/admin/SwitchboardController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand Down
2 changes: 1 addition & 1 deletion admin/app/dfp/ApiHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
6 changes: 3 additions & 3 deletions admin/app/dfp/DataMapper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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)
),
)

Expand Down
4 changes: 2 additions & 2 deletions admin/app/jobs/RefreshFrontsJob.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down
10 changes: 5 additions & 5 deletions admin/app/model/AdminLifecycle.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand Down
2 changes: 1 addition & 1 deletion admin/app/model/deploys/RiffRaff.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))))
}
Expand Down
2 changes: 1 addition & 1 deletion admin/app/tools/AssetMetrics.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion admin/app/tools/charts/charts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion applications/app/services/NewsSiteMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class NewsSiteMap(contentApiClient: ContentApiClient) {
<news:language>en</news:language>
</news:publication>
<news:genres>{genres}</news:genres>
<news:publication_date>{webPublicationDate.withZone(DateTimeZone.UTC).toISODateTimeNoMillisString}</news:publication_date>
<news:publication_date>{
webPublicationDate.withZone(DateTimeZone.UTC).toISODateTimeNoMillisString
}</news:publication_date>
<news:title>{title}</news:title>
<news:keywords>{keywords}</news:keywords>
</news:news>
Expand Down
14 changes: 7 additions & 7 deletions applications/app/services/NewspaperQuery.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)))
Expand All @@ -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))
Expand Down Expand Up @@ -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 =>
Expand Down
4 changes: 3 additions & 1 deletion applications/app/services/VideoSiteMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class VideoSiteMap(contentApiClient: ContentApiClient) {
{description.map(desc => <video:description>{desc}</video:description>).getOrElse(Nil)}
{content_loc.map(content => <video:content_loc>{content}</video:content_loc>).getOrElse(Nil)}
<video:duration>{duration}</video:duration>
<video:publication_date>{publication.withZone(DateTimeZone.UTC).toISODateTimeNoMillisString}</video:publication_date>
<video:publication_date>{
publication.withZone(DateTimeZone.UTC).toISODateTimeNoMillisString
}</video:publication_date>
{tags.map(tag => <video:tag>{tag}</video:tag>)}
<video:category>{category}</video:category>
<video:family_friendly>yes</video:family_friendly>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
3 changes: 1 addition & 2 deletions applications/app/services/dotcomrendering/MediaPicker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion applications/test/AllIndexControllerTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion applications/test/TagFeatureTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
11 changes: 5 additions & 6 deletions article/app/controllers/LiveBlogController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions article/test/LiveBlogControllerTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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"

}
Expand Down
7 changes: 2 additions & 5 deletions common/app/common/Assets/DiscussionAssets.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion common/app/common/Edition.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading

0 comments on commit 1c71a22

Please sign in to comment.