package Ġnet . tw ister rob . gradle . quality . parsers Ċ Ċ import Ġse . bj ur r . vi olations . lib . model . SEVER ITY Ċ import Ġse . bj ur r . vi olations . lib . model . Violation Ċ import Ġse . bj ur r . vi olations . lib . model . Violation . violation Builder Ċ import Ġse . bj ur r . vi olations . lib . parsers . Vi olations Parser Ċ import Ġse . bj ur r . vi olations . lib . reports . Parser Ċ import Ġse . bj ur r . vi olations . lib . util . Violation Parser Utils . getAttribute Ċ import Ġse . bj ur r . vi olations . lib . util . Violation Parser Utils . get Chunks Ċ import Ġse . bj ur r . vi olations . lib . util . Violation Parser Utils . getContent Ċ import Ġjava . util . Collections Ċ Ċ class ĠJ Unit Parser Ġ: ĠVi olations Parser Ġ{ ĊĊ ĉ override Ġfun Ġparse Report Output ( report Content : ĠString ): ĠList < Violation > Ġ{ Ċĉ ĉ val Ġviolations Ġ= Ġmutable ListOf < Violation >() Ċĉ ĉ val Ġtests : ĠList < String > Ġ= Ġget Chunks ( report Content , Ġ"< testcase ", Ġ"</ testcase >") Ċĉ ĉ for Ġ( test Chunk Ġin Ġtests ) Ġ{ Ċĉĉ ĉ val ĠclassName Ġ= Ġget Attribute ( test Chunk , Ġ" classname ") !! Ċĉĉ ĉ val ĠmethodName Ġ= Ġget Attribute ( test Chunk , Ġ" name ") !! Ċĉĉ ĉ vi olations Ġ+= Ġparse Sk ips ( test Chunk , ĠclassName , ĠmethodName ) Ċĉĉ ĉ vi olations Ġ+= Ġparse Failures ( test Chunk , ĠclassName , ĠmethodName ) Ċĉ ĉ } Ċĉ ĉ return Ġviolations Ċ ĉ } ĊĊ ĉ private Ġfun Ġparse Sk ips ( test Chunk : ĠString , ĠclassName : ĠString , ĠmethodName : ĠString ): ĠList < Violation > Ġ= Ċĉ ĉ get Chunks ( test Chunk , Ġ"< skipped ", Ġ" /> "). map Ġ{ Ġskipped Chunk Ġ-> Ċĉĉ ĉ val Ġmessage Ġ= Ġget Attribute ( skipped Chunk , Ġ" message ") Ċĉĉ ĉ violation Builder () Ċĉĉĉ ĉ . set Parser ( Parser . P ITE ST ) Ċĉĉĉ ĉ . set Reporter (" JUnit ") Ċĉĉĉ ĉ . set File ( className ) Ċĉĉĉ ĉ . set Start Line ( 0 ) Ċĉĉĉ ĉ . set Rule ( methodName ) Ċĉĉĉ ĉ . set Severity ( SEVER ITY . WARN ) Ċĉĉĉ ĉ . setMessage ( message ) Ċĉĉĉ ĉ . build () Ċĉ ĉ } ĊĊ ĉ private Ġfun Ġparse Failures ( test Chunk : ĠString , ĠclassName : ĠString , ĠmethodName : ĠString ): ĠList < Violation > Ġ= Ċĉ ĉ get Chunks ( test Chunk , Ġ"< failure ", Ġ"</ failure > "). map Ġ{ Ġfailure Chunk Ġ-> Ċĉĉ ĉ val Ġmessage Ġ= Ġget Attribute ( failure Chunk , Ġ" message ") Ċĉĉ ĉ val Ġstack Ġ= ĠgetContent ( failure Chunk , Ġ" failure ") Ċĉĉ ĉ violation Builder () Ċĉĉĉ ĉ . set Parser ( Parser . P ITE ST ) Ċĉĉĉ ĉ . set Reporter (" JUnit ") Ċĉĉĉ ĉ . set File ( className ) Ċĉĉĉ ĉ . set Start Line ( 0 ) Ċĉĉĉ ĉ . set Rule ( methodName ) Ċĉĉĉ ĉ . set Severity ( SEVER ITY . ERROR ) Ċĉĉĉ ĉ . setMessage ( message ) Ċĉĉĉ ĉ . set Specific s ( Collections . singleton Map (" stack trace ", Ġstack )) Ċĉĉĉ ĉ . build () Ċĉ ĉ } Ċ } Ċ