All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wartremover.warts.GlobalExecutionContext.scala Maven / Gradle / Ivy

package org.wartremover
package warts

object GlobalExecutionContext extends WartTraverser {
  private[wartremover] def message = "Don't use ExecutionContext.global"

  override def apply(u: WartUniverse): u.Traverser = {
    import u.universe._
    new Traverser {
      override def traverse(tree: Tree): Unit = {
        tree match {
          case t if hasWartAnnotation(u)(t) =>
          case q"scala.concurrent.ExecutionContext.Implicits.global" | q"scala.concurrent.ExecutionContext.global" =>
            error(u)(tree.pos, message)
          case _ =>
            super.traverse(tree)
        }
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy