scalastyle / scalastyle-sbt-plugin

scalastyle-sbt-plugin
Apache License 2.0
139 stars 52 forks source link

non-zero exit code #70

Open catena2w opened 6 years ago

catena2w commented 6 years ago

I run sbt scalastyle command end everything looks fine, while exit code of this task is 1 that fails our CI server.

pozharko@pozharko-desktop ~/Code/ergo/ergo $ sbt scalastyle
[info] Loading settings from plugins.sbt ...
[info] Loading project definition from /home/pozharko/Code/ergo/ergo/project
[info] Loading settings from build.sbt,lock.sbt ...
[info] Set current project to ergo (in build file:/home/pozharko/Code/ergo/ergo/)
[info] lock.sbt is up to date.
[info] scalastyle using config /home/pozharko/Code/ergo/ergo/scalastyle-config.xml
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/crypto/Equihash.scala:294:12: Avoid using return
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/crypto/Equihash.scala:311:12: Avoid using return
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/crypto/Equihash.scala:286:37: Avoid using null
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/crypto/Equihash.scala:286:51: Avoid using null
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/crypto/Equihash.scala:126:6: Cyclomatic complexity of 14 exceeds max of 10
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/crypto/Equihash.scala:126:6: Method is longer than 50 lines
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/crypto/Equihash.scala:268:6: Method is longer than 50 lines
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/ErgoApp.scala:74:6: Public method must have explicit type
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/FakePowScheme.scala:20:15: The number of parameters should not exceed 8
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinsEmission.scala:37:4: If block needs braces
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinsEmission.scala:38:9: If block needs braces
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinEmissionPrinter.scala:43: File line length exceeds 160 characters
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinEmissionPrinter.scala:25:2: Regular expression matched 'println'
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinEmissionPrinter.scala:26:4: Regular expression matched 'println'
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinEmissionPrinter.scala:27:4: Regular expression matched 'println'
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinEmissionPrinter.scala:28:4: Regular expression matched 'println'
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinEmissionPrinter.scala:29:2: Regular expression matched 'println'
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinEmissionPrinter.scala:30:2: Regular expression matched 'println'
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinEmissionPrinter.scala:31:2: Regular expression matched 'println'
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinEmissionPrinter.scala:32:2: Regular expression matched 'println'
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinEmissionPrinter.scala:33:2: Regular expression matched 'println'
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinEmissionPrinter.scala:34:2: Regular expression matched 'println'
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinEmissionPrinter.scala:35:2: Regular expression matched 'println'
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinEmissionPrinter.scala:37:2: Regular expression matched 'println'
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinEmissionPrinter.scala:38:2: Regular expression matched 'println'
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/emission/CoinEmissionPrinter.scala:43:58: Regular expression matched 'println'
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/PoWScheme.scala:24:6: The number of parameters should not exceed 8
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/PoWScheme.scala:35:6: The number of parameters should not exceed 8
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/PoWScheme.scala:107:15: The number of parameters should not exceed 8
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/mining/difficulty/RequiredDifficulty.scala:88:27: Avoid using return
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/settings/StateTypeReaders.scala: File must end with newline character
[error] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/nodeView/ErgoReadersHolder.scala: expected start of definition, but was Token(VAL,val,596,val)
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/nodeView/history/ErgoHistory.scala:95:14: Method is longer than 50 lines
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/nodeView/history/ErgoHistory.scala:223:6: Method is longer than 50 lines
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/nodeView/history/ErgoHistoryReader.scala:103:15: Cyclomatic complexity of 12 exceeds max of 10
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/nodeView/history/storage/modifierprocessors/HeadersProcessor.scala:161:16: Cyclomatic complexity of 15 exceeds max of 10
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/nodeView/history/storage/modifierprocessors/HeadersProcessor.scala:189:11: If block needs braces
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/nodeView/history/storage/modifierprocessors/FullBlockProcessor.scala:38:16: Cyclomatic complexity of 13 exceeds max of 10
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/nodeView/history/storage/modifierprocessors/FullBlockProcessor.scala:108:23: If block needs braces
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/nodeView/history/storage/modifierprocessors/FullBlockProcessor.scala:38:16: Method is longer than 50 lines
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/local/ErgoMiner.scala: File must end with newline character
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/local/ErgoMiningThread.scala: File must end with newline character
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/local/TransactionGenerator.scala: File must end with newline character
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/local/ErgoStatsCollector.scala: File must end with newline character
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/Test.scala:27:2: Regular expression matched 'println'
[warn] /home/pozharko/Code/ergo/ergo/src/main/scala/Test.scala:28:2: Regular expression matched 'println'
[info] scalastyle Processed 81 file(s)
[info] scalastyle Found 1 errors
[info] scalastyle Found 45 warnings
[info] scalastyle Found 0 infos
[info] scalastyle Finished in 13 ms
[success] created output: /home/pozharko/Code/ergo/ergo/target
[error] Total time: 2 s, completed Mar 14, 2018, 10:44:40 AM
pozharko@pozharko-desktop ~/Code/ergo/ergo $ $?
1: command not found
matthewfarwell commented 6 years ago

The Scalastyle task has a non-zero exit code when it finds an error. You have one error, which looks like a parse error. If you don't want scalastyle to fail on error, set the scalastyleFailOnError setting to false.

khatkar commented 6 years ago

[error] /home/pozharko/Code/ergo/ergo/src/main/scala/org/ergoplatform/nodeView/ErgoReadersHolder.scala: expected start of definition, but was Token(VAL,val,596,val)

Scalastyle is failing with above error.

Ric137k commented 5 years ago

Do you have a for instance a Seq in your code where the last entry is followed by a , ?

rulle-io commented 5 years ago

Yes, I have a similar issue and the reason was a List() with a trailing comma (last symbol, not followed by an element). However, it is pity that error log print doesn't contain any location info (line number or function name).

edgartanaka commented 4 years ago

Such a terrible error message.