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

com.sksamuel.scapegoat.io.HtmlReportWriter.scala Maven / Gradle / Ivy

package com.sksamuel.scapegoat.io

import scala.xml.Unparsed

import com.sksamuel.scapegoat.{Feedback, Levels}

/**
 * @author Stephen Samuel
 */
object HtmlReportWriter extends ReportWriter {

  override protected def fileName: String = "scapegoat.html"

  private val css =
    """
      |      body {
      |        font-family: 'Ubuntu', sans-serif;
      |        padding: 0 15px;
      |      }
      |
      |      h1 {
      |      	color: #515151;
      |      	font-weight: 700;
      |      }
      |
      |      h3 {
      |      	color: #8a8a8a;
      |      	font-weight: 400;
      |      }
      |
      |      .warning {
      |      	  background :#F1F3F2;
      |      	  border-bottom-left-radius: 6px;
      |		      border-bottom-right-radius: 6px;
      |      	  margin-bottom: 3px;
      |      	  padding: 12px;
      |      }
      |
      |      .title {
      |      	color: #616161;
      |      	font-size: 16px;
      |      }
      |
      |      .source {
      |        float: right;
      |      	 font-style: italic;
      |        color: #868686;
      |      }
      |
      |      .snippet {
      |        padding-top: 8px;
      |        color: #0C0C0C;
      |        font-weight: 300;
      |        font-size: 12px;
      |      }
      |
      |      .inspection {
      |        padding-left: 10px;
      |        font-style:italic;
      |        color: #969696;
      |        font-size: 12px;
      |      }
      |
      |
    """.stripMargin

  private def header =
    
      Scapegoat Inspection Reporter{
      Unparsed(
        ""
      )
    }{
      Unparsed(
        """"""
      )
    }{
      Unparsed {
        """"""
      }
    }
    

  private def body(reporter: Feedback) =
    
      

Scapegoat Inspections

Errors {reporter.warnings(Levels.Error).size.toString} Warnings {reporter.warnings(Levels.Warning).size.toString} Infos {reporter.warnings(Levels.Info).size.toString}

{warnings(reporter)} private def warnings(reporter: Feedback) = { reporter.warningsWithMinimalLevel.map { warning => val source = warning.sourceFileNormalized + ":" + warning.line
{source}
{ warning.level match { case Levels.Info => Info case Levels.Warning => Warning case Levels.Error => Error } } {warning.text}  {warning.inspection}
{warning.explanation}
{ warning.snippet match { case None => case Some(snippet) =>
{snippet}
} }
} } private def toHTML(reporter: Feedback) = {header}{body(reporter)} override protected def generate(feedback: Feedback): String = toHTML(feedback).toString() }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy