Skip to content

Commit 64dd7fb

Browse files
author
gazbert
committed
chore: Sonar fixes (#169)
1 parent e0e976d commit 64dd7fb

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

bxbot-repository/src/main/java/com/gazbert/bxbot/repository/yaml/MarketConfigYamlRepository.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import java.util.Collections;
3333
import java.util.List;
3434
import java.util.UUID;
35-
import java.util.stream.Collectors;
3635
import lombok.extern.log4j.Log4j2;
3736
import org.springframework.stereotype.Repository;
3837
import org.springframework.transaction.annotation.Transactional;
@@ -79,7 +78,7 @@ public MarketConfig findById(String id) {
7978
marketsType.getMarkets().stream()
8079
.filter(item -> item.getId().equals(id))
8180
.distinct()
82-
.collect(Collectors.toList()));
81+
.toList());
8382
}
8483

8584
@Override
@@ -130,7 +129,7 @@ public MarketConfig save(MarketConfig config) {
130129
updatedMarketsType.getMarkets().stream()
131130
.filter(item -> item.getId().equals(config.getId()))
132131
.distinct()
133-
.collect(Collectors.toList()));
132+
.toList());
134133
} else {
135134
log.warn(
136135
"Trying to update MarketConfig but id does not exist MarketConfig: {}"

bxbot-repository/src/main/java/com/gazbert/bxbot/repository/yaml/StrategyConfigYamlRepository.java

+8-9
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import java.util.Collections;
3333
import java.util.List;
3434
import java.util.UUID;
35-
import java.util.stream.Collectors;
3635
import lombok.extern.log4j.Log4j2;
3736
import org.springframework.stereotype.Repository;
3837
import org.springframework.transaction.annotation.Transactional;
@@ -77,7 +76,7 @@ public StrategyConfig findById(String id) {
7776
strategiesType.getStrategies().stream()
7877
.filter(item -> item.getId().equals(id))
7978
.distinct()
80-
.collect(Collectors.toList()));
79+
.toList());
8180
}
8281

8382
@Override
@@ -129,13 +128,13 @@ public StrategyConfig save(StrategyConfig config) {
129128
updatedStrategiesType.getStrategies().stream()
130129
.filter(item -> item.getId().equals(config.getId()))
131130
.distinct()
132-
.collect(Collectors.toList()));
131+
.toList());
133132
} else {
134133
log.warn(
135134
"Trying to update StrategyConfig but id does not exist StrategyConfig: "
136-
+ config
137-
+ " Existing StrategyConfig: "
138-
+ strategiesType.getStrategies());
135+
+ "{} Existing StrategyConfig: {}",
136+
config,
137+
strategiesType.getStrategies());
139138
return null;
140139
}
141140
}
@@ -163,9 +162,9 @@ public StrategyConfig delete(String id) {
163162
} else {
164163
log.warn(
165164
"Trying to delete StrategyConfig but id does not exist. StrategyConfig id: "
166-
+ id
167-
+ " Existing StrategyConfig: "
168-
+ strategiesType.getStrategies());
165+
+ "{} Existing StrategyConfig: {}",
166+
id,
167+
strategiesType.getStrategies());
169168
return null;
170169
}
171170
}

bxbot-services/src/main/java/com/gazbert/bxbot/services/runtime/impl/BotLogfileServiceImpl.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.nio.file.Path;
3131
import java.nio.file.Paths;
3232
import java.util.List;
33-
import java.util.stream.Collectors;
3433
import java.util.stream.IntStream;
3534
import java.util.stream.Stream;
3635
import lombok.extern.log4j.Log4j2;
@@ -152,14 +151,14 @@ List<String> getTailLines() {
152151
// Truncates the file head if file line count > maxLines
153152
return IntStream.range(offset < maxLines ? 0 : offset - maxLines, offset)
154153
.mapToObj(idx -> lines[idx % maxLines])
155-
.collect(Collectors.toList());
154+
.toList();
156155
}
157156

158157
List<String> getHeadLines() {
159158
// Truncates the file tail if file line count > maxLines
160159
return IntStream.range(0, maxLines > offset ? offset : maxLines)
161160
.mapToObj(idx -> lines[idx % maxLines])
162-
.collect(Collectors.toList());
161+
.toList();
163162
}
164163
}
165164
}

0 commit comments

Comments
 (0)