Skip to content

Commit

Permalink
refactor: cleanup gitignore file removing duplicate entries (#1163)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinWitt authored Oct 15, 2023
1 parent 583eaee commit d23cf9d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 62 deletions.
28 changes: 0 additions & 28 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,10 @@ gradle-app.setting
.idea
# Gradle
.gradle/
build/

# Eclipse
.project
.classpath
.settings/
bin/

# IntelliJ
.idea
*.ipr
*.iml
*.iws
Expand All @@ -153,13 +147,11 @@ nb-configuration.xml

# Visual Studio Code
.vscode
.factorypath

# OSX
.DS_Store

# Vim
*.swp
*.swo

# patch
Expand All @@ -169,45 +161,25 @@ nb-configuration.xml
# Local environment
.env
# Gradle
.gradle/
build/

# Eclipse
.project
.classpath
.settings/
bin/

# IntelliJ
.idea
*.ipr
*.iml
*.iws

# NetBeans
nb-configuration.xml

# Visual Studio Code
.vscode
.factorypath

# OSX
.DS_Store

# Vim
*.swp
*.swo

# patch
*.orig
*.rej

# Local environment
.env
# github-bot/src/main/resources/application.properties

# Quinoa
node_modules/
build/
dist/
node/
3 changes: 2 additions & 1 deletion github-bot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ dependencies {
implementation 'io.quarkus:quarkus-arc'
implementation "io.quarkus:quarkus-scheduler"
implementation 'io.quarkus:quarkus-smallrye-health'
testImplementation 'io.quarkus:quarkus-junit5'
implementation project(path: ':spoon-analyzer')
testImplementation 'io.quarkus:quarkus-junit5'
implementation project(":code-transformation")
implementation 'io.quarkus:quarkus-mongodb-panache:3.4.3'
annotationProcessor("io.quarkus:quarkus-panache-common")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import io.github.martinwitt.laughing_train.data.FindProjectConfigRequest;
import io.github.martinwitt.laughing_train.domain.entity.ProjectConfig;
import io.github.martinwitt.laughing_train.persistence.repository.ProjectConfigRepository;
import io.smallrye.mutiny.Uni;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.util.List;
Expand All @@ -15,15 +14,6 @@ public class ProjectConfigService {

@Inject ProjectConfigRepository projectConfigRepository;

public Uni<List<ProjectConfig>> getConfig(FindProjectConfigRequest request) {
if (request instanceof FindProjectConfigRequest.ByProjectUrl byProjectUrl) {
return Uni.createFrom()
.item(projectConfigRepository.findByProjectUrl(byProjectUrl.projectUrl()));
}
logger.atWarning().log("Unknown request type %s", request.getClass());
return Uni.createFrom().failure(new IllegalArgumentException("Unknown request type"));
}

public List<ProjectConfig> getProjectConfig(FindProjectConfigRequest request) {
if (request instanceof FindProjectConfigRequest.ByProjectUrl byProjectUrl) {
return projectConfigRepository.findByProjectUrl(byProjectUrl.projectUrl());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ private Uni<QodanaResult> runQodanaWithConfig(AnalyzerRequest.WithProject projec
}

private Uni<List<ProjectConfig>> getProjectConfig(WithProject item) {
return projectConfigService.getConfig(
new FindProjectConfigRequest.ByProjectUrl(item.project().url()));
return Uni.createFrom()
.item(
projectConfigService.getProjectConfig(
new FindProjectConfigRequest.ByProjectUrl(item.project().url())));
}

private void persistResults(QodanaResult result) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,27 +108,9 @@ private String refactorSpoon(List<? extends BadSmell> badSmells) {

private void refactorQodana(List<? extends BadSmell> badSmells) {
String projectUrl = badSmells.get(0).getProjectUrl();

var projectConfig =
projectConfigService.getConfig(new FindProjectConfigRequest.ByProjectUrl(projectUrl));
logger.atInfo().log("Found %s config ", projectConfig);
projectConfig
.flatMap(
list -> {
if (list.isEmpty()) {
logger.atWarning().log("No config found for %s", projectUrl);
return Uni.createFrom()
.failure(new RuntimeException("No config found for " + projectUrl));
}
return Uni.createFrom().item(list.get(0));
})
.subscribe()
.with(
it -> {
var result =
projectService.handleProjectRequest(new ProjectRequest.WithUrl(projectUrl));
createPullRequest(result, badSmells);
});
ProjectResult projectResult =
projectService.handleProjectRequest(new ProjectRequest.WithUrl(projectUrl));
createPullRequest(projectResult, badSmells);
}

private String createPullRequest(ProjectResult message, List<? extends BadSmell> badSmells) {
Expand Down

0 comments on commit d23cf9d

Please sign in to comment.