@Override public String toString() { return "[key=" + key() + "]"; } }
@Override public int hashCode() { return key().hashCode(); }
public void trackIssues(ScannerReportReader reader, DefaultInputComponent component) { // raw issues = all the issues created by rule engines during this module scan and not excluded by filters List<ScannerReport.Issue> rawIssues = new LinkedList<>(); try (CloseableIterator<ScannerReport.Issue> it = reader.readComponentIssues(component.scannerId())) { while (it.hasNext()) { rawIssues.add(it.next()); } } catch (Exception e) { throw new IllegalStateException("Can't read issues for " + component.key(), e); } List<TrackedIssue> trackedIssues; if (localIssueTracking != null) { trackedIssues = localIssueTracking.trackIssues(component, rawIssues, analysisDate); } else { trackedIssues = doTransition(rawIssues, component); } for (TrackedIssue issue : trackedIssues) { issueCache.put(issue); } }
@Override public void publish(ScannerReportWriter writer) { final ScannerReport.Measure.Builder builder = ScannerReport.Measure.newBuilder(); for (final InputComponent c : componentStore.all()) { DefaultInputComponent component = (DefaultInputComponent) c; if (component.isFile()) { DefaultInputFile file = (DefaultInputFile) component; // Recompute all coverage measures from line data to take into account the possible merge of several reports updateCoverageFromLineData(file); // Recompute test execution measures from MutableTestPlan to take into account the possible merge of several reports updateTestExecutionFromTestPlan(file); } Iterable<DefaultMeasure<?>> scannerMeasures = measureCache.byComponentKey(component.key()); if (scannerMeasures.iterator().hasNext()) { writer.writeComponentMeasures(component.scannerId(), StreamSupport.stream(scannerMeasures.spliterator(), false) .map(input -> { if (input.value() == null) { throw new IllegalArgumentException( String.format("Measure on metric '%s' and component '%s' has no value, but it's not allowed", input.metric().key(), component.key())); } builder.clear(); builder.setMetricKey(input.metric().key()); setValueAccordingToType(builder, input); return builder.build(); }).collect(Collectors.toList())); } } }
@Override public String toString() { return "[key=" + key() + "]"; } }
@Override public int hashCode() { return key().hashCode(); }
public void trackIssues(ScannerReportReader reader, DefaultInputComponent component) { // raw issues = all the issues created by rule engines during this module scan and not excluded by filters List<ScannerReport.Issue> rawIssues = new LinkedList<>(); try (CloseableIterator<ScannerReport.Issue> it = reader.readComponentIssues(component.scannerId())) { while (it.hasNext()) { rawIssues.add(it.next()); } } catch (Exception e) { throw new IllegalStateException("Can't read issues for " + component.key(), e); } List<TrackedIssue> trackedIssues; if (localIssueTracking != null) { trackedIssues = localIssueTracking.trackIssues(component, rawIssues, analysisDate); } else { trackedIssues = doTransition(rawIssues, component); } for (TrackedIssue issue : trackedIssues) { issueCache.put(issue); } }
@Override public void publish(ScannerReportWriter writer) { final ScannerReport.Measure.Builder builder = ScannerReport.Measure.newBuilder(); for (final InputComponent c : componentStore.all()) { DefaultInputComponent component = (DefaultInputComponent) c; if (component.isFile()) { DefaultInputFile file = (DefaultInputFile) component; // Recompute all coverage measures from line data to take into account the possible merge of several reports updateCoverageFromLineData(file); // Recompute test execution measures from MutableTestPlan to take into account the possible merge of several reports updateTestExecutionFromTestPlan(file); } Iterable<DefaultMeasure<?>> scannerMeasures = measureCache.byComponentKey(component.key()); if (scannerMeasures.iterator().hasNext()) { writer.writeComponentMeasures(component.scannerId(), StreamSupport.stream(scannerMeasures.spliterator(), false) .map(input -> { if (input.value() == null) { throw new IllegalArgumentException( String.format("Measure on metric '%s' and component '%s' has no value, but it's not allowed", input.metric().key(), component.key())); } builder.clear(); builder.setMetricKey(input.metric().key()); setValueAccordingToType(builder, input); return builder.build(); }).collect(Collectors.toList())); } } }