How to make the build break in case of Scala style errors?

453 views
Skip to first unread message

Olivier Bruchez

unread,
Dec 12, 2013, 5:22:14 AM12/12/13
to scalasty...@googlegroups.com, mat...@farwell.co.uk
Hello,

I've just added Scalastyle to our project and I'd like our automatic build to fail if Scalastyle generates any error.

The build command I use is:

sbt scalastyle clean test

And here's what I get:

Processed 497 file(s)
Found 1 errors
Found 0 warnings
Finished in 0 ms
[success] created: .../target/scalastyle-result.xml
[error] exists error
[success] Total time: 2 s, completed Dec 12, 2013 11:04:46 AM

So, apparently, SBT returns an exit code of 0, instead of 1, and the build doesn't break (no email sent, etc.).

Is there anything I can do (SBT configuration) to get the correct behavior?

Thanks,
Olivier

Matthew Farwell

unread,
Dec 12, 2013, 12:30:55 PM12/12/13
to scalasty...@googlegroups.com
Hi,

You can do

$ sbt scalastyle && sbt clean test

This should work. In the next version the scalastyle task will behave correctly: see https://github.com/scalastyle/scalastyle-sbt-plugin/pull/10

Thanks.

Matthew Farwell.


2013/12/12 Olivier Bruchez <olivier...@gmail.com>

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes Scalastyle users.
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse scalastyle-use...@googlegroups.com.
Pour envoyer un message à ce groupe, adressez un e-mail à scalasty...@googlegroups.com.
Visitez ce groupe à l'adresse http://groups.google.com/group/scalastyle-users .
Pour plus d'options, visitez le site https://groups.google.com/groups/opt_out .

Olivier Bruchez

unread,
Dec 13, 2013, 1:08:16 AM12/13/13
to scalasty...@googlegroups.com
Excellent. Thanks!

Olivier

Olivier Bruchez

unread,
Dec 16, 2013, 5:17:03 AM12/16/13
to scalasty...@googlegroups.com
Actually, this hack doesn't work. "sbt scalastyle" alone doesn't return a non-null exit code in case of error.

Olivier

On Thursday, December 12, 2013 6:30:55 PM UTC+1, Matthew Farwell wrote:
Reply all
Reply to author
Forward
0 new messages