sbt-scapegoat icon indicating copy to clipboard operation
sbt-scapegoat copied to clipboard

scapegoat failOnError := false

Open fernaspiazu opened this issue 7 years ago • 8 comments

Hi, Is there any way to do NOT fail if an error is found while scapegoat task is executed? Since I have to upload the scapegoat-report to sonar, wouldn't be better to have this option? Do you have some example in order to go ahead even if errors are found? Thanks in advance.

fernaspiazu avatar Feb 09 '18 11:02 fernaspiazu

Seems like there is an option to allow some warnings/errors before failing the build, but I could not make it work with 1.0.5. See issue #60

antoon-r avatar Mar 13 '18 06:03 antoon-r

Same here, couldn't make it work. Is making the build fail on the report intended? I would expect it to go through so you can send report to sonar as well.

Cinetik avatar Apr 03 '18 11:04 Cinetik

I think this is related to #72 .

hkupty avatar Apr 11 '18 09:04 hkupty

Any news on it ? Thanks!

thomas-chauvet avatar May 23 '18 12:05 thomas-chauvet

It would be great to have this in place. Any news regarding this? Any workaround?

javiercanillas avatar Jun 29 '18 20:06 javiercanillas

If you want to upload the report to Sonar you can change the level of Error inspections to Warning. Doing this the run don't fail (even with warnings) and given that what you really want is to see the quality profile of Sonar not the real scapegoat report it "solves the problem".

You can add to you project settings scalacOptions in Scapegoat ++= Seq("-P:scapegoat:overrideLevels:ArraysInFormat=Warning:CatchNpe=Warning:ComparingFloatingPointTypes=Warning:ComparingUnrelatedTypes=Warning:EitherGet=Warning:EmptyInterpolatedString=Warning:IllegalFormatString=Warning:ImpossibleOptionSizeCondition=Warning:IncorrectNumberOfArgsToFormat=Warning:IncorrectlyNamedExceptions=Warning:LonelySealedTrait=Warning:MapGetAndGetOrElse=Warning:NanComparison=Warning:OptionGet=Warning:OptionSize=Warning:StripMarginOnRegex=Warning:TraversableHead=Warning:TraversableLast=Warning:TryGet=Warning:UnsafeContains=Warning")

Is not the best option but it works at least with Sonar. Anyway as you say, it would be great to have this failOnError := false option instead of doing this hack.

GastonTS avatar Jun 29 '18 20:06 GastonTS

Another workaround is to do sbt scapegoat || true. This will ignore any errors and with the next command you can upload the report to SonarQube.

n3ziniuka5 avatar Aug 13 '19 10:08 n3ziniuka5

I can see the situation haven't changed anything. It's sad, that we have to do those workarounds. I would like to help in order to inject this failOnError := false, but im only a grey-user, who doesn't really know how to Scala :D

portikCoder avatar May 17 '21 09:05 portikCoder