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

Scapegoat doesn't like Play

Open luksow opened this issue 9 years ago • 8 comments

Hi, I'm trying to integrate scapegoat with Play 2.3.4 and it turns out that there're some issues with Play's code generation feature. First of all, scapgegoat is desperately trying to go through compiled templates, spitting out enormous number of issues - this however can be with a rule like scapegoatIgnoredFiles := Seq(".*assets.*", ".*src_managed.*"). The bigger problem is that it fails (2 out of 3 times) during code generation with some cryptic error messages like: source file '...target/scala-2.11/src_managed/main/assets/controllers/routes.java' could not be found or similar. Any ideas? Thanks! Łukasz

luksow avatar Jul 15 '15 18:07 luksow

I'm not familiar with play, what is src_managed?

On 15 July 2015 at 19:40, Łukasz Sowa [email protected] wrote:

Hi, I'm trying to integrate scapegoat with Play 2.3.4 and it turns out that there're some issues with Play's code generation feature. First of all, scapgegoat is desperately trying to go through compiled templates, spitting out enormous number of issues - this however can be with a rule like scapegoatIgnoredFiles := Seq(".assets.", ".src_managed."). The bigger problem is that it fails (2 out of 3 times) during code generation with some cryptic error messages like: source file '...target/scala-2.11/src_managed/main/assets/controllers/routes.java' could not be found or similar. Any ideas? Thanks! Łukasz

— Reply to this email directly or view it on GitHub https://github.com/sksamuel/sbt-scapegoat/issues/30.

sksamuel avatar Jul 15 '15 18:07 sksamuel

Wow, that was quick! I'm not familiar with Play internals but I guess src_managed is a dir that is being created on-the-fly for generated code. You should be able to repro this bug by creating a template Play project and running scapegoat on it.

luksow avatar Jul 15 '15 18:07 luksow

can you make me a sample project.

On 15 July 2015 at 19:43, Łukasz Sowa [email protected] wrote:

Wow, that was quick! I'm not familiar with Play internals but I guess src_managed is a dir that is being created on-the-fly for generated code. You should be able to repro this bug by creating a template Play project and running scapegoat on it.

— Reply to this email directly or view it on GitHub https://github.com/sksamuel/sbt-scapegoat/issues/30#issuecomment-121709176 .

sksamuel avatar Jul 15 '15 23:07 sksamuel

https://github.com/luksow/play-scapegoat-bug fire up sbt inside play-scapegoat-bug directory, then try different combinations of commands compile clean scapegoat, you'll see plenty of false-positive warnings (complaining about generated code in target dir) and also strange errors on scapegoat command like

[error] source file '/home/luke/projects/play-scapegoat-bug/target/scala-2.11/twirl/main/views/html/index.template.scala' could not be found [error] one error found [error] (scapegoat:compileIncremental) Compilation failed

or

[error] /home/luke/projects/play-scapegoat-bug/app/views/index.scala.html:3: not found: value main [error] @main("Welcome to Play") { [error] ^ [error] one error found [error] (scapegoat:compileIncremental) Compilation failed

luksow avatar Jul 16 '15 10:07 luksow

Thanks.

sksamuel avatar Jul 16 '15 11:07 sksamuel

Having same issue here during builds on Jenkins. Any updated on what causes the problem and how to fix it?

zenderol avatar Oct 18 '15 17:10 zenderol

Does this help? https://github.com/danielnixon/sbt-ignore-play-generated

(Play 2.5.x only.)

danielnixon avatar Feb 23 '17 05:02 danielnixon

In my play2.5-project with sbt-ignore-play-generated when I execute sbt clean scapegoat I will get

[warn] 28 warnings found  
[error] 34 errors found  
[error] (scapegoat:compileIncremental) Compilation failed

How can I fix it ?

yarosman avatar Jan 29 '18 15:01 yarosman