Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make warnings fatal #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions admin/app/Application.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.lucidchart.piezo.admin

import com.lucidchart.piezo.util.DummyClassGenerator
import com.softwaremill.macwire._
import play.api.ApplicationLoader.Context
import play.api._
Expand All @@ -12,7 +11,7 @@ import play.api.Mode
import play.api.routing.Router
import router.Routes
import scala.concurrent.Future
import com.lucidchart.piezo.admin.models._
import scala.annotation.nowarn
import com.lucidchart.piezo.admin.controllers._
import com.lucidchart.piezo.WorkerSchedulerFactory
import _root_.controllers.AssetsComponents
Expand All @@ -38,7 +37,7 @@ class PiezoAdminComponents(context: Context) extends BuiltInComponentsFromContex
override val httpFilters: Seq[EssentialFilter] = {
val ec = controllerComponents.executionContext
Seq(
wire[RequestStatCollector]
new RequestStatCollector(ec)
)
}
val logger = Logger("com.lucidchart.piezo.Global")
Expand Down Expand Up @@ -72,6 +71,7 @@ class PiezoAdminComponents(context: Context) extends BuiltInComponentsFromContex

lazy val router: Router = {
// add the prefix string in local scope for the Routes constructor
@nowarn
val prefix: String = "/"
wire[Routes]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.lucidchart.piezo.admin.controllers

import play.api._
import play.api.mvc._

class ApplicationController(cc: ControllerComponents) extends AbstractController(cc) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class HealthCheck(configuration: Configuration, cc: ControllerComponents) extend
5
}

def main = cc.actionBuilder { implicit requests=>
def main = cc.actionBuilder { request =>
val workerHealth = areWorkersHealthy()
val responseBody = Json.toJson(Map("HeartbeatTime" -> Json.toJson(workerHealth._2)))
if(workerHealth._1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.lucidchart.piezo.admin.controllers

import org.quartz.JobDataMap
import play.api.libs.json._
import play.api.data.Form
import play.api.data.Forms._

case class DataMap(key: String, value: String)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.lucidchart.piezo.admin.controllers

import org.quartz._
import play.api.Logger
import play.api.data.Form
import play.api.data.Forms._
import com.lucidchart.piezo.GeneratorClassLoader
Expand Down
5 changes: 2 additions & 3 deletions admin/app/com/lucidchart/piezo/admin/controllers/Jobs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.lucidchart.piezo.{JobHistoryModel, TriggerHistoryModel, TriggerMonito
import org.quartz._
import org.quartz.impl.matchers.GroupMatcher
import play.api._
import play.api.libs.functional.syntax._
import play.api.libs.json._
import play.api.mvc._
import scala.jdk.CollectionConverters._
Expand Down Expand Up @@ -306,15 +305,15 @@ class Jobs(schedulerFactory: WorkerSchedulerFactory, jobView: html.job, cc: Cont
)
}

def jobGroupTypeAhead(sofar: String) = Action { implicit request =>
def jobGroupTypeAhead(sofar: String) = Action { request =>
val groups = scheduler.getJobGroupNames().asScala.toList

Ok(Json.obj("groups" -> groups.filter{ group =>
group.toLowerCase.contains(sofar.toLowerCase)
}))
}

def jobNameTypeAhead(group: String, sofar: String) = Action { implicit request =>
def jobNameTypeAhead(group: String, sofar: String) = Action { request =>
val jobs = scheduler.getJobKeys(GroupMatcher.jobGroupEquals(group)).asScala.toSet

Ok(Json.obj("jobs" -> jobs.filter(_.getName.toLowerCase.contains(sofar.toLowerCase)).map(_.getName)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import org.quartz._
import play.api.data.Form
import play.api.data.Forms._
import play.api.data.validation.{Constraint, Invalid, Valid, ValidationError}
import scala.language.existentials

class TriggerFormHelper(scheduler: Scheduler) extends JobDataHelper {

Expand Down Expand Up @@ -72,7 +73,7 @@ class TriggerFormHelper(scheduler: Scheduler) extends JobDataHelper {
)
] = {
val trigger = tp._1
val (triggerType: String, simple, cron) = trigger match {
val (triggerType: String, simple, cron) = (trigger: @unchecked) match {
case cron: CronTrigger => ("cron", None, Some(cron.getScheduleBuilder))
case simple: SimpleTrigger => ("simple", Some(simple.getScheduleBuilder), None)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ import java.util.Date
import org.quartz.Trigger.TriggerState
import org.quartz._
import org.quartz.impl.triggers.{CronTriggerImpl, SimpleTriggerImpl}
import play.api._
import play.api.libs.json._
import play.api.mvc._
import com.lucidchart.piezo.admin.models._
import scala.collection.mutable
import scala.jdk.CollectionConverters._
import scala.util.Try
import play.api.Logging
import play.api.i18n.I18nSupport

class Triggers(schedulerFactory: WorkerSchedulerFactory, cc: ControllerComponents) extends AbstractController(cc) with Logging with ErrorLogging with play.api.i18n.I18nSupport {

Expand Down Expand Up @@ -293,15 +290,15 @@ class Triggers(schedulerFactory: WorkerSchedulerFactory, cc: ControllerComponent
)
}

def triggerGroupTypeAhead(sofar: String) = Action { implicit request =>
def triggerGroupTypeAhead(sofar: String) = Action { request =>
val groups = scheduler.getTriggerGroupNames().asScala.toList

Ok(Json.obj("groups" -> groups.filter{ group =>
group.toLowerCase.contains(sofar.toLowerCase)
}))
}

def triggerJob(group: String, name: String) = Action { implicit request =>
def triggerJob(group: String, name: String) = Action { request =>
val jobKey = new JobKey(name, group)

if (scheduler.checkExists(jobKey)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.lucidchart.piezo.admin.utils
import play.api.libs.json._
import org.quartz._
import scala.collection.JavaConverters._
import com.lucidchart.piezo.admin.controllers.{JobFormHelper, JobDataHelper, TriggerHelper}
import com.lucidchart.piezo.TriggerMonitoringModel

Expand Down
3 changes: 0 additions & 3 deletions admin/app/com/lucidchart/piezo/admin/views/editJob.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
messagesProvider: play.api.i18n.MessagesProvider
)

@import com.lucidchart.piezo.admin.controllers.{routes=>piezoRoutes}
@import com.lucidchart.piezo.admin.views
@import org.quartz._
@import com.lucidchart.piezo.admin.views.FormHelpers._

@com.lucidchart.piezo.admin.views.html.jobsLayout(jobsByGroup, None, scripts) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

@import com.lucidchart.piezo.TriggerMonitoringPriority
@import com.lucidchart.piezo.admin.controllers.{routes=>piezoRoutes}
@import com.lucidchart.piezo.admin.views
@import java.net.URLEncoder
@import org.quartz._
@import com.lucidchart.piezo.admin.views.FormHelpers._

@com.lucidchart.piezo.admin.views.html.triggersLayout(triggersByGroup, None, scripts) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
implicit
request: RequestHeader
)
@import com.lucidchart.piezo.admin.views

@com.lucidchart.piezo.admin.views.html.main("Piezo Error") {
<div>
<h1 class="text-danger">Error</h1>
<p class="large">@errorMessage.getOrElse("Unknown Error")</p>
</div>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
implicit
request: RequestHeader
)
@import com.lucidchart.piezo.admin.views

@com.lucidchart.piezo.admin.views.html.main("Piezo Error") {
<div>
<h1 class="text-danger">Page Not Found</h1>
<p class="large">@message.getOrElse("The page you requested could not be located.")</p>
</div>
}
}
2 changes: 0 additions & 2 deletions admin/app/com/lucidchart/piezo/admin/views/index.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
implicit
request: play.api.mvc.Request[AnyContent]
)
@import com.lucidchart.piezo.admin.controllers.{routes=>piezoRoutes}
@import com.lucidchart.piezo.admin.views

@com.lucidchart.piezo.admin.views.html.main("Piezo Admin Home") {
<div class="clearfix" style="text-align: center; margin: 15px 0;">
Expand Down
2 changes: 0 additions & 2 deletions admin/app/com/lucidchart/piezo/admin/views/job.scala.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@import com.lucidchart.piezo.admin.controllers.{routes=>piezoRoutes}
@import com.lucidchart.piezo.admin.views
@import play.api.Configuration
@import java.net.URLEncoder
@import org.quartz.TriggerKey
@this(configuration: Configuration)

Expand Down
2 changes: 0 additions & 2 deletions admin/app/com/lucidchart/piezo/admin/views/jobs.scala.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
@import com.lucidchart.piezo.admin.controllers.{routes=>piezoRoutes}
@import com.lucidchart.piezo.admin.views
@import java.net.URLEncoder
@import org.joda.time.format.DateTimeFormat
@import org.joda.time.DateTime
@import org.quartz.{JobKey, SchedulerMetaData}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h3 class="text-danger">@errorMessage.get</h3>
@if(!currentTrigger.isEmpty) {
<h3 class="pull-left">@currentTrigger.get.getKey.getGroup() &raquo; <span class="text-info">@currentTrigger.get.getKey.getName()</span></h3>
<a class="piezo-button pull-right" data-toggle="tooltip" title="Duplicate trigger" href="@{piezoRoutes.Triggers.getNewTriggerForm(
currentTrigger.get match {
(currentTrigger.get: @unchecked) match {
case c: CronTrigger => "cron"
case s: SimpleTrigger => "simple"
}
Expand Down
5 changes: 5 additions & 0 deletions admin/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ libraryDependencies ++= Seq(
specs2 % Test
)

scalacOptions ++= Seq(
"-Wconf:cat=unused-imports&src=(routes|twirl)/.*:info-summary",
"-Wconf:cat=other-match-analysis&src=routes/.*:silent",
)

maintainer := "Lucid Software Team <[email protected]>"

name := "piezo-admin"
Expand Down
6 changes: 6 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ inThisBuild(Seq(
scmInfo := Some(ScmInfo(url("https://github.com/lucidsoftware/piezo"), "scm:git:[email protected]:lucidsoftware/piezo.git")),
version := sys.props.getOrElse("build.version", "0-SNAPSHOT"),
versionScheme := Some("early-semver"),
scalacOptions ++= Seq(
"-Xfatal-warnings",
"-deprecation",
"-feature",
"-Xlint",
)
))

publishTo := sonatypePublishToBundle.value
6 changes: 1 addition & 5 deletions worker/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ javaOptions ++= Seq(
"-Dorg.quartz.properties=quartz.properties"
)

scalacOptions ++= Seq(
"-deprecation",
"-feature",
"-Xlint"
)
scalacOptions += "-Xlint"

Compile / unmanagedClasspath += sourceDirectory.value / "run" / "resources"

Expand Down