sputnik icon indicating copy to clipboard operation
sputnik copied to clipboard

Exit sputnik with error code if checks fail

Open marquiswang opened this issue 5 years ago • 2 comments

This allows scripts/tools to take the return result into account.

Furthermore, Extensions of sputnik like the sputnik-maven-plugin can use a return value of the Engine to communicate the result of a run and do something like fail a build.

Implement this by adding a Score object (with the review label and the score value as fields) and return that in Engine.run().

If a failing score value (< 0) is returned, then call System.exit with the score as the error status.

marquiswang avatar Oct 15 '19 17:10 marquiswang

Codecov Report

Merging #205 into master will decrease coverage by 0.79%. The diff coverage is 66.96%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master     #205     +/-   ##
===========================================
- Coverage     72.52%   71.72%   -0.8%     
- Complexity      592      608     +16     
===========================================
  Files           142      147      +5     
  Lines          1889     1956     +67     
  Branches        121      129      +8     
===========================================
+ Hits           1370     1403     +33     
- Misses          462      490     +28     
- Partials         57       63      +6
Impacted Files Coverage Δ Complexity Δ
...in/java/pl/touk/sputnik/engine/VisitorBuilder.java 100% <ø> (ø) 9 <0> (-5) :arrow_down:
...c/main/java/pl/touk/sputnik/review/ReviewFile.java 92.3% <ø> (ø) 7 <0> (ø) :arrow_down:
src/main/java/pl/touk/sputnik/engine/Engine.java 0% <0%> (ø) 0 <0> (ø) :arrow_down:
src/main/java/pl/touk/sputnik/Main.java 0% <0%> (ø) 0 <0> (ø) :arrow_down:
...ain/java/pl/touk/sputnik/connector/Connectors.java 0% <0%> (ø) 0 <0> (ø) :arrow_down:
src/main/java/pl/touk/sputnik/review/Review.java 65% <100%> (ø) 13 <1> (+1) :arrow_up:
.../java/pl/touk/sputnik/connector/ConnectorType.java 66.66% <100%> (+2.38%) 3 <0> (ø) :arrow_down:
...a/pl/touk/sputnik/configuration/GeneralOption.java 98.36% <100%> (ø) 3 <0> (ø) :arrow_down:
...ouk/sputnik/engine/score/ScoreStrategyFactory.java 100% <100%> (ø) 7 <7> (?)
...uk/sputnik/connector/local/LocalFacadeBuilder.java 14.28% <14.28%> (ø) 1 <1> (?)
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f4d3393...0355151. Read the comment docs.

codecov-io avatar Oct 15 '19 17:10 codecov-io

I've made a change in master branch that fixed one but so I guess you must rebase again.

SpOOnman avatar Nov 25 '19 07:11 SpOOnman