|
29 | 29 | */
|
30 | 30 | package com.qulice.spotbugs;
|
31 | 31 |
|
32 |
| -import com.jcabi.log.Logger; |
33 | 32 | import com.qulice.spi.Environment;
|
34 | 33 | import com.qulice.spi.ValidationException;
|
35 | 34 | import com.qulice.spi.Validator;
|
36 |
| -import java.util.Collection; |
37 |
| -import java.util.LinkedList; |
38 | 35 |
|
39 | 36 | /**
|
40 | 37 | * Validates source code and compiled binaries with SpotBugs.
|
41 | 38 | *
|
42 | 39 | * @since 0.19
|
43 | 40 | */
|
44 |
| -@SuppressWarnings({"PMD.ExcessiveImports", "PMD.AvoidDuplicateLiterals"}) |
45 | 41 | public final class SpotBugsValidator implements Validator {
|
46 | 42 |
|
47 | 43 | @Override
|
48 | 44 | public void validate(final Environment env) throws ValidationException {
|
49 |
| - if (env.outdir().exists()) { |
50 |
| - if (!env.exclude("spotbugs", "")) { |
51 |
| - this.check(SpotBugsValidator.spotbugs(env)); |
52 |
| - } |
53 |
| - } else { |
54 |
| - Logger.info( |
55 |
| - this, |
56 |
| - "No classes at %s, no SpotBugs validation", |
57 |
| - env.outdir() |
58 |
| - ); |
59 |
| - } |
| 45 | + throw new UnsupportedOperationException("validate not implemented"); |
60 | 46 | }
|
61 | 47 |
|
62 | 48 | @Override
|
63 | 49 | public String name() {
|
64 | 50 | return "SpotBugs";
|
65 | 51 | }
|
66 | 52 |
|
67 |
| - /** |
68 |
| - * Start spotbugs and return its output. |
69 |
| - * @param env Environment |
70 |
| - * @return Output of spotbugs |
71 |
| - */ |
72 |
| - @SuppressWarnings("PMD.AvoidDuplicateLiterals") |
73 |
| - private static String spotbugs(final Environment env) { |
74 |
| - throw new UnsupportedOperationException("spotbugs not implemented"); |
75 |
| - } |
76 |
| - |
77 |
| - /** |
78 |
| - * Java options. |
79 |
| - * @return Options |
80 |
| - */ |
81 |
| - private static Collection<String> options() { |
82 |
| - return new LinkedList<>(); |
83 |
| - } |
84 |
| - |
85 |
| - /** |
86 |
| - * Check report for errors. |
87 |
| - * @param report The report |
88 |
| - * @throws ValidationException If it contains errors |
89 |
| - */ |
90 |
| - private void check(final String report) throws ValidationException { |
91 |
| - int total = 0; |
92 |
| - for (final String line |
93 |
| - : report.split(System.getProperty("line.separator"))) { |
94 |
| - if (line.matches("[a-zA-Z ]+: .*")) { |
95 |
| - Logger.warn(this, "SpotBugs: %s", line); |
96 |
| - ++total; |
97 |
| - } |
98 |
| - } |
99 |
| - if (total > 0) { |
100 |
| - throw new ValidationException( |
101 |
| - "%d SpotBugs violations (see log above)", |
102 |
| - total |
103 |
| - ); |
104 |
| - } |
105 |
| - } |
106 | 53 | }
|
0 commit comments