Skip to content

Commit

Permalink
fix: Update Gradle dependencies and remove unused code (#1426)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinWitt authored Jan 6, 2024
1 parent 06c63e9 commit 1deabde
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 45 deletions.
29 changes: 18 additions & 11 deletions github-bot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,38 @@ plugins {
}

dependencies {
implementation 'io.quarkus:quarkus-info'
implementation 'io.quarkiverse.jgit:quarkus-jgit:3.0.6'
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")

implementation 'io.quarkus:quarkus-info'
implementation 'io.quarkiverse.jgit:quarkus-jgit:3.0.6'
implementation 'io.quarkiverse.githubapi:quarkus-github-api:1.318.0'
implementation 'io.quarkus:quarkus-arc'
implementation "io.quarkus:quarkus-scheduler"
implementation 'io.quarkus:quarkus-smallrye-health'
implementation project(path: ':spoon-analyzer')
testImplementation 'io.quarkus:quarkus-junit5'
implementation project(":code-transformation")
annotationProcessor("io.quarkus:quarkus-panache-common")

implementation("io.quarkus:quarkus-smallrye-graphql")
testImplementation("io.quarkus:quarkus-smallrye-graphql-client")
implementation 'io.quarkiverse.quinoa:quarkus-quinoa:2.3.2'
implementation("io.quarkus:quarkus-oidc")
implementation("io.quarkus:quarkus-keycloak-authorization")
implementation("io.quarkus:quarkus-micrometer-registry-prometheus")
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.25.1'
implementation project(":commons")
implementation "io.quarkiverse.loggingmanager:quarkus-logging-manager:3.0.3"
testImplementation 'org.mockito:mockito-core:5.8.0'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.16.1'
annotationProcessor("io.quarkus:quarkus-panache-common")
implementation("io.quarkus:quarkus-hibernate-orm-panache")
implementation("io.quarkus:quarkus-jdbc-mariadb")
implementation("io.quarkus:quarkus-opentelemetry")

implementation project(":commons")
implementation project(path: ':spoon-analyzer')
implementation project(":code-transformation")

testImplementation 'org.mockito:mockito-core:5.8.0'
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.25.1'
testImplementation 'io.quarkus:quarkus-junit5'
testImplementation("io.quarkus:quarkus-smallrye-graphql-client")

annotationProcessor("io.quarkus:quarkus-panache-common")
annotationProcessor("io.quarkus:quarkus-panache-common")

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,18 @@

import com.google.common.flogger.FluentLogger;
import io.github.martinwitt.laughing_train.commons.GitProject;
import io.github.martinwitt.laughing_train.data.QodanaResult;
import io.github.martinwitt.laughing_train.data.result.CodeAnalyzerResult;
import io.github.martinwitt.laughing_train.persistence.BadSmell;
import io.github.martinwitt.laughing_train.persistence.repository.BadSmellRepository;
import io.smallrye.mutiny.Multi;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.util.stream.Collectors;

@ApplicationScoped
public class AnalyzerResultPersistenceService {
private static final FluentLogger logger = FluentLogger.forEnclosingClass();

@Inject BadSmellRepository badSmellRepository;

void persistResults(QodanaResult result) {
if (result instanceof QodanaResult.Success success) {
GitProject gitProject = success.gitProject();
Multi.createFrom()
.iterable(success.result())
.map(
badSmell ->
new BadSmell(
badSmell, gitProject.name(), gitProject.url(), gitProject.commitHash()))
.filter(v -> badSmellRepository.findByIdentifier(v.getIdentifier()).isEmpty())
.map(badSmellRepository::save)
.collect()
.with(Collectors.counting())
.subscribe()
.with(
badSmell ->
logger.atInfo().log(
"Persisted %d qodana bad smells for project %s",
badSmell, gitProject.name()));
}
}

void persistResults(CodeAnalyzerResult.Success success) {
logger.atInfo().log(
"Persisting %s results for project %s",
Expand Down
4 changes: 1 addition & 3 deletions github-bot/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ quarkus.oidc.tls.verification=none
%prod.quarkus.http.auth.permission.authenticated.policy=authenticated
%dev.quarkus.smallrye-graphql.log-payload=queryAndVariables
quarkus.smallrye-graphql.error-extension-fields=[exception,classification,code,description,validationErrorType,queryPath]
quarkus.ssl.native=true
quarkus.http.proxy.proxy-address-forwarding=true
quarkus.http.proxy.allow-forwarded=true
quarkus.http.proxy.allow-x-forwarded=true
quarkus.http.proxy.enable-forwarded-host=true
quarkus.http.proxy.enable-forwarded-prefix=true
%dev.quarkus.scheduler.enabled=false
Expand All @@ -24,5 +22,5 @@ quarkus.http.cors.origins=*
quarkus.vertx.max-worker-execute-time=30m
%test.quarkus.scheduler.enabled=false
quarkus.datasource.db-kind = mariadb
quarkus.hibernate-orm.database.generation = drop-and-create
quarkus.hibernate-orm.database.generation = update
%dev.quarkus.quinoa=false
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.github.martinwitt.laughing_train.data.result.CodeAnalyzerResult;
import io.github.martinwitt.laughing_train.mining.api.AnalyzerRunRepository;
import io.github.martinwitt.laughing_train.mining.requests.StoreResults;
import io.quarkus.test.TestTransaction;
import io.quarkus.test.junit.QuarkusTest;
import jakarta.inject.Inject;
import org.instancio.Instancio;
Expand All @@ -18,6 +19,7 @@ class AnalyzerResultsPersistenceTest {
@Inject AnalyzerRunRepository analyzerRunRepository;

@Test
@TestTransaction
void persistResults() {
StoreResults storeResults =
new StoreResults(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package io.github.martinwitt.laughing_train.persistence.impl;

import static org.assertj.core.api.Assertions.assertThat;

import io.github.martinwitt.laughing_train.domain.entity.RemoteProject;
import io.github.martinwitt.laughing_train.mining.api.AnalyzerRunRepository;
import io.quarkus.test.TestTransaction;
import io.quarkus.test.junit.QuarkusTest;
import jakarta.inject.Inject;
import java.util.List;
import org.instancio.Instancio;
import org.junit.jupiter.api.Test;

import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;

@QuarkusTest
class SqlProjectRepositoryTest {

@Inject SqlProjectRepository sqlProjectRepository;

@Inject AnalyzerRunRepository sqlAnalyzerRunRepository;

@Test
@TestTransaction
void insertProject() {
RemoteProject remoteProject = Instancio.create(RemoteProject.class);
sqlProjectRepository.save(remoteProject);
Expand Down

0 comments on commit 1deabde

Please sign in to comment.