scapegoat-scala / sbt-scapegoat

sbt plugin for scapegoat scala static analysis plugin
Apache License 2.0
139 stars 33 forks source link

Scapegoat doesn't like Play #30

Open luksow opened 9 years ago

luksow commented 9 years ago

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

sksamuel commented 9 years ago

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

On 15 July 2015 at 19:40, Łukasz Sowa notifications@github.com 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.", "._srcmanaged."). 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.

luksow commented 9 years ago

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.

sksamuel commented 9 years ago

can you make me a sample project.

On 15 July 2015 at 19:43, Łukasz Sowa notifications@github.com 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 .

luksow commented 9 years ago

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

sksamuel commented 9 years ago

Thanks.

zenderol commented 9 years ago

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

danielnixon commented 7 years ago

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

(Play 2.5.x only.)

yarosman commented 6 years ago

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 ?