diff options
| author | chick | 2020-08-14 19:47:53 -0700 |
|---|---|---|
| committer | Jack Koenig | 2020-08-14 19:47:53 -0700 |
| commit | 6fc742bfaf5ee508a34189400a1a7dbffe3f1cac (patch) | |
| tree | 2ed103ee80b0fba613c88a66af854ae9952610ce /src/main/scala/logger/phases | |
| parent | b516293f703c4de86397862fee1897aded2ae140 (diff) | |
All of src/ formatted with scalafmt
Diffstat (limited to 'src/main/scala/logger/phases')
| -rw-r--r-- | src/main/scala/logger/phases/AddDefaults.scala | 10 | ||||
| -rw-r--r-- | src/main/scala/logger/phases/Checks.scala | 27 |
2 files changed, 20 insertions, 17 deletions
diff --git a/src/main/scala/logger/phases/AddDefaults.scala b/src/main/scala/logger/phases/AddDefaults.scala index 660de579..ec673637 100644 --- a/src/main/scala/logger/phases/AddDefaults.scala +++ b/src/main/scala/logger/phases/AddDefaults.scala @@ -5,10 +5,10 @@ package logger.phases import firrtl.AnnotationSeq import firrtl.options.Phase -import logger.{LoggerOption, LogLevelAnnotation} +import logger.{LogLevelAnnotation, LoggerOption} /** Add default logger [[Annotation]]s */ -private [logger] class AddDefaults extends Phase { +private[logger] class AddDefaults extends Phase { override def prerequisites = Seq.empty override def optionalPrerequisiteOf = Seq.empty @@ -20,12 +20,12 @@ private [logger] class AddDefaults extends Phase { */ def transform(annotations: AnnotationSeq): AnnotationSeq = { var ll = true - annotations.collect{ case a: LoggerOption => a }.map{ + annotations.collect { case a: LoggerOption => a }.map { case _: LogLevelAnnotation => ll = false - case _ => + case _ => } annotations ++ - (if (ll) Seq(LogLevelAnnotation()) else Seq() ) + (if (ll) Seq(LogLevelAnnotation()) else Seq()) } } diff --git a/src/main/scala/logger/phases/Checks.scala b/src/main/scala/logger/phases/Checks.scala index e945fa98..0109c7ad 100644 --- a/src/main/scala/logger/phases/Checks.scala +++ b/src/main/scala/logger/phases/Checks.scala @@ -6,12 +6,13 @@ import firrtl.AnnotationSeq import firrtl.annotations.Annotation import firrtl.options.{Dependency, Phase} -import logger.{LogLevelAnnotation, LogFileAnnotation, LoggerException} +import logger.{LogFileAnnotation, LogLevelAnnotation, LoggerException} import scala.collection.mutable /** Check that an [[firrtl.AnnotationSeq AnnotationSeq]] has all necessary [[firrtl.annotations.Annotation Annotation]]s - * for a [[Logger]] */ + * for a [[Logger]] + */ object Checks extends Phase { override def prerequisites = Seq(Dependency[AddDefaults]) @@ -26,20 +27,22 @@ object Checks extends Phase { */ def transform(annotations: AnnotationSeq): AnnotationSeq = { val ll, lf = mutable.ListBuffer[Annotation]() - annotations.foreach( - _ match { - case a: LogLevelAnnotation => ll += a - case a: LogFileAnnotation => lf += a - case _ => }) + annotations.foreach(_ match { + case a: LogLevelAnnotation => ll += a + case a: LogFileAnnotation => lf += a + case _ => + }) if (ll.size > 1) { - val l = ll.map{ case LogLevelAnnotation(x) => x } + val l = ll.map { case LogLevelAnnotation(x) => x } throw new LoggerException( s"""|At most one log level can be specified, but found '${l.mkString(", ")}' specified via: - | - an option or annotation: -ll, --log-level, LogLevelAnnotation""".stripMargin )} + | - an option or annotation: -ll, --log-level, LogLevelAnnotation""".stripMargin + ) + } if (lf.size > 1) { - throw new LoggerException( - s"""|At most one log file can be specified, but found ${lf.size} combinations of: - | - an options or annotation: -ltf, --log-to-file, --log-file, LogFileAnnotation""".stripMargin )} + throw new LoggerException(s"""|At most one log file can be specified, but found ${lf.size} combinations of: + | - an options or annotation: -ltf, --log-to-file, --log-file, LogFileAnnotation""".stripMargin) + } annotations } |
