use of org.sonarlint.intellij.issue.AnalysisResultIssues in project sonarlint-intellij by SonarSource.
the class SonarClearAnalysisResultsActionTest method clear.
@Test
public void clear() {
AnalysisResultIssues analysisResultIssues = mock(AnalysisResultIssues.class);
super.register(AnalysisResultIssues.class, analysisResultIssues);
AnActionEvent event = mock(AnActionEvent.class);
when(event.getProject()).thenReturn(project);
action.actionPerformed(event);
verify(analysisResultIssues).clear();
}
use of org.sonarlint.intellij.issue.AnalysisResultIssues in project sonarlint-intellij by SonarSource.
the class SonarLintCheckinHandler method processResult.
private ReturnResult processResult(Collection<VirtualFile> affectedFiles) {
AnalysisResultIssues analysisResultIssues = SonarLintUtils.get(project, AnalysisResultIssues.class);
IssueManager issueManager = SonarLintUtils.get(project, IssueManager.class);
Map<VirtualFile, Collection<LiveIssue>> map = affectedFiles.stream().collect(Collectors.toMap(Function.identity(), issueManager::getForFile));
long numIssues = map.entrySet().stream().flatMap(e -> e.getValue().stream()).filter(i -> !i.isResolved()).count();
analysisResultIssues.set(map, "SCM changed files");
long numBlockerIssues = map.entrySet().stream().flatMap(e -> e.getValue().stream()).filter(i -> !i.isResolved()).filter(i -> "BLOCKER".equals(i.getSeverity())).count();
if (numIssues == 0) {
return ReturnResult.COMMIT;
}
long numFiles = map.keySet().size();
String msg = createMessage(numFiles, numIssues, numBlockerIssues);
if (ApplicationManager.getApplication().isHeadlessEnvironment()) {
LOGGER.info(msg);
return ReturnResult.CANCEL;
}
return showYesNoCancel(msg);
}
use of org.sonarlint.intellij.issue.AnalysisResultIssues in project sonarlint-intellij by SonarSource.
the class SonarClearAnalysisResultsAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getProject();
if (project == null) {
return;
}
AnalysisResultIssues store = SonarLintUtils.get(project, AnalysisResultIssues.class);
store.clear();
}
Aggregations