Skip to content

Commit

Permalink
turn on more scalac options and remove some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Qi77Qi committed Sep 17, 2018
1 parent dee9a5d commit 8da050f
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jdk:
language: scala

scala:
- 2.12.2
- 2.12.6

sudo: required

Expand Down
10 changes: 5 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ scalacOptions ++= Seq(
"-Xlint:doc-detached", // A Scaladoc comment appears to be detached from its element.
"-Xlint:inaccessible", // Warn about inaccessible types in method signatures.
"-Xlint:missing-interpolator", // A string literal appears to be missing an interpolator id.
// "-Xlint:nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
"-Xlint:nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
"-Xlint:option-implicit", // Option.apply used implicit view.
"-Xlint:package-object-classes", // Class or object defined in package object.
"-Xlint:poly-implicit-overload", // Parameterized overloaded implicit methods are not visible as view bounds.
"-Xlint:private-shadow", // A private field (or class parameter) shadows a superclass field.
"-Xlint:stars-align", // Pattern sequence wildcard must align with sequence component.
"-Xlint:type-parameter-shadow", // A local type parameter shadows a type already in scope.
// "-Xlint:unsound-match", // Pattern match may not be typesafe.
"-Ypartial-unification", // Enable partial unification in type constructor inference
"-Ypartial-unification", // Enable partial unification in type constructor inference
"-Ywarn-dead-code", // Warn when dead code is identified.
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
"-Ywarn-inaccessible", // Warn about inaccessible types in method signatures.
"-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
// "-Ywarn-numeric-widen", // Warn when numerics are widened.
// "-Ywarn-unused:implicits", // Warn if an implicit parameter is unused.
"-Ywarn-unused:imports" // Warn if an import selector is not referenced.
// "-Ywarn-value-discard" // Warn when non-Unit expression results are unused.
"-Ywarn-unused:implicits", // Warn if an implicit parameter is unused.
"-Ywarn-unused:imports", // Warn if an import selector is not referenced.
"-Ywarn-value-discard" // Warn when non-Unit expression results are unused.
)

scalacOptions in (Compile, console) --= Seq("-Ywarn-unused:imports", "-Xfatal-warnings")
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package org.broadinstitute.dsde.workbench.sam.directory

import java.util.Date

import org.broadinstitute.dsde.workbench.model.google._
import org.broadinstitute.dsde.workbench.model._
import org.broadinstitute.dsde.workbench.sam.model.{BasicWorkbenchGroup, ResourceId}
import org.broadinstitute.dsde.workbench.model.google._
import org.broadinstitute.dsde.workbench.sam.model.BasicWorkbenchGroup

import scala.concurrent.Future

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import java.util.Date

import akka.http.scaladsl.model.StatusCodes
import com.unboundid.ldap.sdk._
import org.broadinstitute.dsde.workbench.sam._
import org.broadinstitute.dsde.workbench.model._
import org.broadinstitute.dsde.workbench.model.google.{ServiceAccount, ServiceAccountDisplayName, ServiceAccountSubjectId}
import org.broadinstitute.dsde.workbench.sam._
import org.broadinstitute.dsde.workbench.sam.config.DirectoryConfig
import org.broadinstitute.dsde.workbench.sam.model.{BasicWorkbenchGroup, ResourceId}
import org.broadinstitute.dsde.workbench.sam.model.BasicWorkbenchGroup
import org.broadinstitute.dsde.workbench.sam.schema.JndiSchemaDAO.{Attr, ObjectClass}
import org.broadinstitute.dsde.workbench.sam.util.LdapSupport

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import org.broadinstitute.dsde.workbench.sam.model.ResourceAndPolicyName
import org.broadinstitute.dsde.workbench.util.FutureSupport
import spray.json._

import scala.concurrent.ExecutionContext
import scala.concurrent.duration.{FiniteDuration, _}
import scala.language.postfixOps
import scala.util.{Failure, Success, Try}
Expand All @@ -26,12 +25,12 @@ object GoogleGroupSyncMonitorSupervisor {
case object Init extends GoogleGroupSyncMonitorSupervisorMessage
case object Start extends GoogleGroupSyncMonitorSupervisorMessage

def props(pollInterval: FiniteDuration, pollIntervalJitter: FiniteDuration, pubSubDao: GooglePubSubDAO, pubSubTopicName: String, pubSubSubscriptionName: String, workerCount: Int, googleExtensions: GoogleExtensions)(implicit executionContext: ExecutionContext): Props = {
def props(pollInterval: FiniteDuration, pollIntervalJitter: FiniteDuration, pubSubDao: GooglePubSubDAO, pubSubTopicName: String, pubSubSubscriptionName: String, workerCount: Int, googleExtensions: GoogleExtensions): Props = {
Props(new GoogleGroupSyncMonitorSupervisor(pollInterval, pollIntervalJitter, pubSubDao, pubSubTopicName, pubSubSubscriptionName, workerCount, googleExtensions))
}
}

class GoogleGroupSyncMonitorSupervisor(val pollInterval: FiniteDuration, pollIntervalJitter: FiniteDuration, pubSubDao: GooglePubSubDAO, pubSubTopicName: String, pubSubSubscriptionName: String, workerCount: Int, googleExtensions: GoogleExtensions)(implicit executionContext: ExecutionContext) extends Actor with LazyLogging {
class GoogleGroupSyncMonitorSupervisor(val pollInterval: FiniteDuration, pollIntervalJitter: FiniteDuration, pubSubDao: GooglePubSubDAO, pubSubTopicName: String, pubSubSubscriptionName: String, workerCount: Int, googleExtensions: GoogleExtensions) extends Actor with LazyLogging {
import GoogleGroupSyncMonitorSupervisor._
import context._

Expand Down Expand Up @@ -70,12 +69,12 @@ class GoogleGroupSyncMonitorSupervisor(val pollInterval: FiniteDuration, pollInt
object GoogleGroupSyncMonitor {
case object StartMonitorPass

def props(pollInterval: FiniteDuration, pollIntervalJitter: FiniteDuration, pubSubDao: GooglePubSubDAO, pubSubSubscriptionName: String, googleExtensions: GoogleExtensions)(implicit executionContext: ExecutionContext): Props = {
def props(pollInterval: FiniteDuration, pollIntervalJitter: FiniteDuration, pubSubDao: GooglePubSubDAO, pubSubSubscriptionName: String, googleExtensions: GoogleExtensions): Props = {
Props(new GoogleGroupSyncMonitorActor(pollInterval, pollIntervalJitter, pubSubDao, pubSubSubscriptionName, googleExtensions))
}
}

class GoogleGroupSyncMonitorActor(val pollInterval: FiniteDuration, pollIntervalJitter: FiniteDuration, pubSubDao: GooglePubSubDAO, pubSubSubscriptionName: String, googleExtensions: GoogleExtensions)(implicit executionContext: ExecutionContext) extends Actor with LazyLogging with FutureSupport {
class GoogleGroupSyncMonitorActor(val pollInterval: FiniteDuration, pollIntervalJitter: FiniteDuration, pubSubDao: GooglePubSubDAO, pubSubSubscriptionName: String, googleExtensions: GoogleExtensions) extends Actor with LazyLogging with FutureSupport {
import GoogleGroupSyncMonitor._
import context._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.broadinstitute.dsde.workbench.model.google.{GoogleProject, ServiceAcc
import org.broadinstitute.dsde.workbench.util.FutureSupport
import spray.json._

import scala.concurrent.{ExecutionContext, Future}
import scala.concurrent.Future
import scala.concurrent.duration.{FiniteDuration, _}
import scala.language.postfixOps

Expand All @@ -24,12 +24,12 @@ object GoogleKeyCacheMonitorSupervisor {
case object Init extends GoogleKeyCacheMonitorSupervisorMessage
case object Start extends GoogleKeyCacheMonitorSupervisorMessage

def props(pollInterval: FiniteDuration, pollIntervalJitter: FiniteDuration, pubSubDao: GooglePubSubDAO, googleIamDAO: GoogleIamDAO, pubSubTopicName: String, pubSubSubscriptionName: String, projectServiceAccount: WorkbenchEmail, workerCount: Int, googleKeyCache: GoogleKeyCache)(implicit executionContext: ExecutionContext): Props = {
def props(pollInterval: FiniteDuration, pollIntervalJitter: FiniteDuration, pubSubDao: GooglePubSubDAO, googleIamDAO: GoogleIamDAO, pubSubTopicName: String, pubSubSubscriptionName: String, projectServiceAccount: WorkbenchEmail, workerCount: Int, googleKeyCache: GoogleKeyCache): Props = {
Props(new GoogleKeyCacheMonitorSupervisor(pollInterval, pollIntervalJitter, pubSubDao, googleIamDAO, pubSubTopicName, pubSubSubscriptionName, projectServiceAccount, workerCount, googleKeyCache))
}
}

class GoogleKeyCacheMonitorSupervisor(val pollInterval: FiniteDuration, pollIntervalJitter: FiniteDuration, pubSubDao: GooglePubSubDAO, googleIamDAO: GoogleIamDAO, pubSubTopicName: String, pubSubSubscriptionName: String, projectServiceAccount: WorkbenchEmail, workerCount: Int, googleKeyCache: GoogleKeyCache)(implicit executionContext: ExecutionContext) extends Actor with LazyLogging {
class GoogleKeyCacheMonitorSupervisor(val pollInterval: FiniteDuration, pollIntervalJitter: FiniteDuration, pubSubDao: GooglePubSubDAO, googleIamDAO: GoogleIamDAO, pubSubTopicName: String, pubSubSubscriptionName: String, projectServiceAccount: WorkbenchEmail, workerCount: Int, googleKeyCache: GoogleKeyCache) extends Actor with LazyLogging {
import GoogleKeyCacheMonitorSupervisor._
import context._

Expand Down Expand Up @@ -72,12 +72,12 @@ class GoogleKeyCacheMonitorSupervisor(val pollInterval: FiniteDuration, pollInte
object GoogleKeyCacheMonitor {
case object StartMonitorPass

def props(pollInterval: FiniteDuration, pollIntervalJitter: FiniteDuration, pubSubDao: GooglePubSubDAO, googleIamDAO: GoogleIamDAO, pubSubSubscriptionName: String, googleKeyCache: GoogleKeyCache)(implicit executionContext: ExecutionContext): Props = {
def props(pollInterval: FiniteDuration, pollIntervalJitter: FiniteDuration, pubSubDao: GooglePubSubDAO, googleIamDAO: GoogleIamDAO, pubSubSubscriptionName: String, googleKeyCache: GoogleKeyCache): Props = {
Props(new GoogleKeyCacheMonitorActor(pollInterval, pollIntervalJitter, pubSubDao, googleIamDAO, pubSubSubscriptionName, googleKeyCache))
}
}

class GoogleKeyCacheMonitorActor(val pollInterval: FiniteDuration, pollIntervalJitter: FiniteDuration, pubSubDao: GooglePubSubDAO, googleIamDAO: GoogleIamDAO, pubSubSubscriptionName: String, googleKeyCache: GoogleKeyCache)(implicit executionContext: ExecutionContext) extends Actor with LazyLogging with FutureSupport {
class GoogleKeyCacheMonitorActor(val pollInterval: FiniteDuration, pollIntervalJitter: FiniteDuration, pubSubDao: GooglePubSubDAO, googleIamDAO: GoogleIamDAO, pubSubSubscriptionName: String, googleKeyCache: GoogleKeyCache) extends Actor with LazyLogging with FutureSupport {
import GoogleKeyCacheMonitor._
import context._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import akka.http.scaladsl.testkit.ScalatestRouteTest
import org.broadinstitute.dsde.workbench.model._
import org.broadinstitute.dsde.workbench.model.google.{GoogleProject, ServiceAccount, ServiceAccountDisplayName, ServiceAccountSubjectId}
import org.broadinstitute.dsde.workbench.sam.Generator._
import org.broadinstitute.dsde.workbench.sam.TestSupport.eqThrowable
import org.broadinstitute.dsde.workbench.sam.api.SamRoutes.myExceptionHandler
import org.broadinstitute.dsde.workbench.sam.api.StandardUserInfoDirectives._
import org.broadinstitute.dsde.workbench.sam.directory.{DirectoryDAO, MockDirectoryDAO}
import org.broadinstitute.dsde.workbench.sam.service.{CloudExtensions, UserService}
import org.scalatest.concurrent.ScalaFutures
import org.broadinstitute.dsde.workbench.sam.service.CloudExtensions
import org.broadinstitute.dsde.workbench.sam.service.UserService._
import org.scalatest.concurrent.ScalaFutures

import scala.concurrent.ExecutionContext
import TestSupport.eqThrowable
import org.broadinstitute.dsde.workbench.sam.api.SamRoutes.myExceptionHandler

class StandardUserInfoDirectivesSpec extends PropertyBasedTesting with ScalatestRouteTest with ScalaFutures{
def directives: StandardUserInfoDirectives = new StandardUserInfoDirectives {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import java.util.Date
import akka.http.scaladsl.model.StatusCodes
import cats.implicits._
import org.broadinstitute.dsde.workbench.model._
import org.broadinstitute.dsde.workbench.model.google.{GoogleProject, ServiceAccountSubjectId}
import org.broadinstitute.dsde.workbench.model.google.ServiceAccountSubjectId
import org.broadinstitute.dsde.workbench.sam._
import org.broadinstitute.dsde.workbench.sam.model.{AccessPolicy, BasicWorkbenchGroup}
import org.broadinstitute.dsde.workbench.sam.schema.JndiSchemaDAO.Attr

import scala.collection.concurrent.TrieMap
import scala.collection.mutable
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
import org.broadinstitute.dsde.workbench.sam._
import org.broadinstitute.dsde.workbench.sam.model.{AccessPolicy, BasicWorkbenchGroup}
import org.broadinstitute.dsde.workbench.sam.schema.JndiSchemaDAO.Attr
import scala.concurrent.Future

/**
* Created by mbemis on 6/23/17.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ class ManagedGroupServiceSpec extends FlatSpec with Matchers with TestSupport wi
val policies = runAndWait(policyDAO.listAccessPolicies(resource))
policies.map(_.id.accessPolicyName.value) shouldEqual expectedPolicies.map(_.value)
expectedPolicies.foreach { policyName =>
runAndWait(policyDAO.loadPolicy(ResourceAndPolicyName(resource, policyName))) shouldBe a[Some[AccessPolicy]] //TODO: fix "Type parameter should not be specified because it will be erased at runtime, please use _ instead. Note that in future version of ScalaTest this will give a compiler error."
val res = policyDAO.loadPolicy(ResourceAndPolicyName(resource, policyName)).futureValue
res.isInstanceOf[Some[AccessPolicy]] shouldBe true
}
}

Expand Down

0 comments on commit 8da050f

Please sign in to comment.