Search in sources :

Example 1 with IssueStore

use of org.sonarsource.sonarlint.core.container.connected.IssueStore in project sonarlint-core by SonarSource.

the class PartialUpdater method updateFileIssues.

public void updateFileIssues(String moduleKey, String filePath) {
    Path serverIssuesPath = storagePaths.getServerIssuesPath(moduleKey);
    IssueStore issueStore = issueStoreFactory.apply(serverIssuesPath);
    String fileKey = issueStoreReader.getFileKey(moduleKey, filePath);
    List<ServerIssue> issues;
    try {
        issues = downloader.apply(fileKey);
    } catch (Exception e) {
        // null as cause so that it doesn't get wrapped
        throw new DownloadException("Failed to update file issues: " + e.getMessage(), null);
    }
    issueStore.save(issues);
}
Also used : Path(java.nio.file.Path) DownloadException(org.sonarsource.sonarlint.core.client.api.exceptions.DownloadException) IssueStore(org.sonarsource.sonarlint.core.container.connected.IssueStore) ServerIssue(org.sonar.scanner.protocol.input.ScannerInput.ServerIssue) DownloadException(org.sonarsource.sonarlint.core.client.api.exceptions.DownloadException)

Example 2 with IssueStore

use of org.sonarsource.sonarlint.core.container.connected.IssueStore in project sonarlint-core by SonarSource.

the class IssueStoreReader method getServerIssues.

public List<ServerIssue> getServerIssues(String moduleKey, String filePath) {
    String fileKey = getFileKey(moduleKey, filePath);
    Path serverIssuesPath = storagePaths.getServerIssuesPath(moduleKey);
    IssueStore issueStore = issueStoreFactory.apply(serverIssuesPath);
    List<ScannerInput.ServerIssue> loadedIssues = issueStore.load(fileKey);
    return loadedIssues.stream().map(pbIssue -> transformIssue(pbIssue, moduleKey, filePath)).collect(Collectors.toList());
}
Also used : Path(java.nio.file.Path) IssueStore(org.sonarsource.sonarlint.core.container.connected.IssueStore) List(java.util.List) DefaultServerIssue(org.sonarsource.sonarlint.core.container.model.DefaultServerIssue) Map(java.util.Map) IssueStoreFactory(org.sonarsource.sonarlint.core.container.connected.IssueStoreFactory) ModuleConfiguration(org.sonarsource.sonarlint.core.proto.Sonarlint.ModuleConfiguration) ServerIssue(org.sonarsource.sonarlint.core.client.api.connected.ServerIssue) Instant(java.time.Instant) ScannerInput(org.sonar.scanner.protocol.input.ScannerInput) Path(java.nio.file.Path) Collectors(java.util.stream.Collectors) IssueStore(org.sonarsource.sonarlint.core.container.connected.IssueStore) DefaultServerIssue(org.sonarsource.sonarlint.core.container.model.DefaultServerIssue) ServerIssue(org.sonarsource.sonarlint.core.client.api.connected.ServerIssue)

Aggregations

Path (java.nio.file.Path)2 IssueStore (org.sonarsource.sonarlint.core.container.connected.IssueStore)2 Instant (java.time.Instant)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 ScannerInput (org.sonar.scanner.protocol.input.ScannerInput)1 ServerIssue (org.sonar.scanner.protocol.input.ScannerInput.ServerIssue)1 ServerIssue (org.sonarsource.sonarlint.core.client.api.connected.ServerIssue)1 DownloadException (org.sonarsource.sonarlint.core.client.api.exceptions.DownloadException)1 IssueStoreFactory (org.sonarsource.sonarlint.core.container.connected.IssueStoreFactory)1 DefaultServerIssue (org.sonarsource.sonarlint.core.container.model.DefaultServerIssue)1 ModuleConfiguration (org.sonarsource.sonarlint.core.proto.Sonarlint.ModuleConfiguration)1