Skip to content

Commit

Permalink
TS-31571 Some rework
Browse files Browse the repository at this point in the history
  • Loading branch information
stahlbauer committed Oct 17, 2024
1 parent fa4b88d commit 55f347c
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.conqat.lib.commons.collections.IdentityHashSet;
import retrofit2.Call;

import java.net.ConnectException;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collection;

Check warning on line 17 in agent/src/main/java/com/teamscale/jacoco/agent/logging/LogToTeamscaleAppender.java

View check run for this annotation

cqse.teamscale.io / teamscale-findings

agent/src/main/java/com/teamscale/jacoco/agent/logging/LogToTeamscaleAppender.java#L17

Unused import: `java.util.Collection` https://cqse.teamscale.io/findings/details/teamscale-jacoco-agent?t=ts%2F31571_send_log_to_teamscale_via_appender%3AHEAD&id=3069D0A4E6A3DDACA34D8928F3F0E77F
Expand Down Expand Up @@ -57,6 +58,7 @@ public void start() {
super.start();
scheduler.scheduleAtFixedRate(() -> {
synchronized (activeLogFlushes) {
activeLogFlushes.removeIf(CompletableFuture::isDone);
if (this.activeLogFlushes.isEmpty()) {
flush();
}
Expand Down Expand Up @@ -114,10 +116,15 @@ private void sendLogs(List<ProfilerLogEntry> logsToSend) {
logsToSend.forEach(logBuffer::remove);

Check warning on line 116 in agent/src/main/java/com/teamscale/jacoco/agent/logging/LogToTeamscaleAppender.java

View check run for this annotation

cqse.teamscale.io / teamscale-findings

agent/src/main/java/com/teamscale/jacoco/agent/logging/LogToTeamscaleAppender.java#L116

Violation of nesting depth threshold of 3: 4 https://cqse.teamscale.io/findings/details/teamscale-jacoco-agent?t=ts%2F31571_send_log_to_teamscale_via_appender%3AHEAD&id=3135BA3867989F8F4CB633D2DC7C0F61
}
} catch (Exception e) {
System.err.println("Sending logs to Teamscale failed: " + e.getMessage());
// We do not report on connection exceptions here.
if (!(e instanceof ConnectException)) {

Check warning on line 120 in agent/src/main/java/com/teamscale/jacoco/agent/logging/LogToTeamscaleAppender.java

View check run for this annotation

cqse.teamscale.io / teamscale-findings

agent/src/main/java/com/teamscale/jacoco/agent/logging/LogToTeamscaleAppender.java#L120

`instanceof` check for `e` within catch block https://cqse.teamscale.io/findings/details/teamscale-jacoco-agent?t=ts%2F31571_send_log_to_teamscale_via_appender%3AHEAD&id=7BA13F9BD69698D40BCC5FC7E8C8F142
System.err.println("Sending logs to Teamscale failed: " + e.getMessage());

Check warning on line 121 in agent/src/main/java/com/teamscale/jacoco/agent/logging/LogToTeamscaleAppender.java

View check run for this annotation

cqse.teamscale.io / teamscale-findings

agent/src/main/java/com/teamscale/jacoco/agent/logging/LogToTeamscaleAppender.java#L121

Method `System.err.println` should not be called https://cqse.teamscale.io/findings/details/teamscale-jacoco-agent?t=ts%2F31571_send_log_to_teamscale_via_appender%3AHEAD&id=53BE4AA54E99ED7DCD55878D93D6D1CC

Check warning on line 121 in agent/src/main/java/com/teamscale/jacoco/agent/logging/LogToTeamscaleAppender.java

View check run for this annotation

cqse.teamscale.io / teamscale-findings

agent/src/main/java/com/teamscale/jacoco/agent/logging/LogToTeamscaleAppender.java#L121

Violation of nesting depth threshold of 3: 4 https://cqse.teamscale.io/findings/details/teamscale-jacoco-agent?t=ts%2F31571_send_log_to_teamscale_via_appender%3AHEAD&id=82556EF5CFB2AFA783485C296BBF5BEB
}
}

Check failure on line 123 in agent/src/main/java/com/teamscale/jacoco/agent/logging/LogToTeamscaleAppender.java

View check run for this annotation

cqse.teamscale.io / teamscale-findings

agent/src/main/java/com/teamscale/jacoco/agent/logging/LogToTeamscaleAppender.java#L118-L123

Catch clause catches generic exception `Exception` https://cqse.teamscale.io/findings/details/teamscale-jacoco-agent?t=ts%2F31571_send_log_to_teamscale_via_appender%3AHEAD&id=D703581B7FC61F46D42D1C9EA3B59C48
}).whenComplete((result, throwable) -> {
activeLogFlushes.removeIf(CompletableFuture::isDone);
synchronized (activeLogFlushes) {
activeLogFlushes.removeIf(CompletableFuture::isDone);
}
}));
}
}
Expand Down

0 comments on commit 55f347c

Please sign in to comment.