From c9c9811b0cc0139093517208c9a6fc25e48098a4 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Fri, 14 Jul 2023 20:49:57 +0200 Subject: [PATCH] fix(spoon): Fix cleaning of repositories --- .../laughing_train/mining/QodanaPeriodicMiner.java | 1 + .../martinwitt/laughing_train/mining/SpoonPeriodicMiner.java | 1 + .../laughing_train/services/SpoonAnalyzerService.java | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/QodanaPeriodicMiner.java b/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/QodanaPeriodicMiner.java index 6ec0e52e3..1916ec05f 100644 --- a/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/QodanaPeriodicMiner.java +++ b/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/QodanaPeriodicMiner.java @@ -93,6 +93,7 @@ private void storeFailure(ProjectResult.Success success, QodanaResult.Failure er private void storeSuccess(ProjectResult.Success success, QodanaResult.Success qodanaSuccess) { logger.atInfo().log("Successfully analyzed project %s with qodana", success.project()); + tryDeleteProject(success); StoreResults storeResults = new StoreResults( success.project(), new CodeAnalyzerResult.Success(qodanaSuccess.result(), success.project()), diff --git a/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/SpoonPeriodicMiner.java b/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/SpoonPeriodicMiner.java index 6738534de..faed32297 100644 --- a/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/SpoonPeriodicMiner.java +++ b/github-bot/src/main/java/io/github/martinwitt/laughing_train/mining/SpoonPeriodicMiner.java @@ -92,6 +92,7 @@ private void storeFailure(ProjectResult.Success success, CodeAnalyzerResult.Fail private void storeSuccess(ProjectResult.Success success, CodeAnalyzerResult.Success spoonSuccess) { logger.atInfo().log("Successfully analyzed project %s with spoon", success.project()); + tryDeleteProject(success); StoreResults storeResults = new StoreResults( success.project(), new CodeAnalyzerResult.Success(spoonSuccess.results(), success.project()), diff --git a/github-bot/src/main/java/io/github/martinwitt/laughing_train/services/SpoonAnalyzerService.java b/github-bot/src/main/java/io/github/martinwitt/laughing_train/services/SpoonAnalyzerService.java index 0be1c8477..b7e0dc542 100644 --- a/github-bot/src/main/java/io/github/martinwitt/laughing_train/services/SpoonAnalyzerService.java +++ b/github-bot/src/main/java/io/github/martinwitt/laughing_train/services/SpoonAnalyzerService.java @@ -2,6 +2,7 @@ import com.google.common.base.Strings; import com.google.common.flogger.FluentLogger; +import com.google.common.flogger.StackSize; import io.github.martinwitt.laughing_train.data.request.AnalyzerRequest; import io.github.martinwitt.laughing_train.data.result.CodeAnalyzerResult; import io.github.martinwitt.laughing_train.domain.entity.AnalyzerResult; @@ -46,8 +47,8 @@ public CodeAnalyzerResult analyze(AnalyzerRequest request) { } else { return new CodeAnalyzerResult.Failure("Unknown request type"); } - } catch (Exception e) { - logger.atSevere().withCause(e).log("Error while analyzing code"); + } catch (Throwable e) { + logger.atSevere().withStackTrace(StackSize.SMALL).withCause(e).log("Error while analyzing code"); return new CodeAnalyzerResult.Failure(Strings.nullToEmpty(e.getMessage())); } }