Showing 167 of 167 total issues
AclsBindingsBuilder
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
public class AclsBindingsBuilder implements BindingsBuilderProvider {
private static final Logger LOGGER = LogManager.getLogger(AclsBindingsBuilder.class);
private static final String KAFKA_CLUSTER_NAME = "kafka-cluster";
File JulieHttpClient.java
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.purbon.kafka.topology.clients;
import static java.net.http.HttpRequest.BodyPublishers.noBody;
import static java.net.http.HttpRequest.BodyPublishers.ofString;
File MDSApiClient.java
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.purbon.kafka.topology.api.mds;
import static com.purbon.kafka.topology.api.mds.RequestScope.RESOURCE_NAME;
import static com.purbon.kafka.topology.api.mds.RequestScope.RESOURCE_PATTERN_TYPE;
import static com.purbon.kafka.topology.api.mds.RequestScope.RESOURCE_TYPE;
Method deserialize
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
@Override
public Topology deserialize(JsonParser parser, DeserializationContext context)
throws IOException {
JsonNode rootNode = parser.getCodec().readTree(parser);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method deserialize
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public Topology deserialize(JsonParser parser, DeserializationContext context)
throws IOException {
JsonNode rootNode = parser.getCodec().readTree(parser);
TopologyBuilderAdminClient
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
public class TopologyBuilderAdminClient {
private static final Logger LOGGER = LogManager.getLogger(TopologyBuilderAdminClient.class);
private final AdminClient adminClient;
Method updatePlan
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void updatePlan(ExecutionPlan plan, Map<String, Topology> topologies) throws IOException {
Collection<? extends Artefact> currentArtefacts = loadActualClusterStateIfAvailable(plan);
Set<Artefact> artefacts = new HashSet<>();
Similar blocks of code found in 2 locations. Consider refactoring. Open
private boolean validateReplicationFactor(short topicValue) throws ValidationException {
boolean result;
switch (replicationFactorOp) {
case "gt":
result = topicValue > replicationFactorValue;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 138.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
private boolean validatePartitionCount(int topicValue) throws ValidationException {
boolean result;
switch (partitionNumberOp) {
case "gt":
result = topicValue > partitionNumberValue;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 138.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method build
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static JulieOps build(
String topologyFileOrDir,
String plansFile,
Configuration config,
TopologyBuilderAdminClient adminClient,
Similar blocks of code found in 2 locations. Consider refactoring. Open
package com.purbon.kafka.topology.actions.access;
import com.purbon.kafka.topology.AccessControlProvider;
import com.purbon.kafka.topology.actions.BaseAccessControlAction;
import com.purbon.kafka.topology.roles.TopologyAclBinding;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 136.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
package com.purbon.kafka.topology.actions.access;
import com.purbon.kafka.topology.AccessControlProvider;
import com.purbon.kafka.topology.actions.BaseAccessControlAction;
import com.purbon.kafka.topology.roles.TopologyAclBinding;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 136.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method doKafkaConnectElements
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private Optional<PlatformSystem> doKafkaConnectElements(JsonParser parser, JsonNode node)
throws IOException {
JsonNode acNode = node;
if (node.has(ACCESS_CONTROL)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File TopologyBuilderAdminClient.java
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.purbon.kafka.topology.api.adminclient;
import com.purbon.kafka.topology.actions.topics.TopicConfigUpdatePlan;
import com.purbon.kafka.topology.model.Topic;
import com.purbon.kafka.topology.model.User;
Method buildProjectAclBindings
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
private List<AclBindingsResult> buildProjectAclBindings(Topology topology) {
List<AclBindingsResult> aclBindingsResults = new ArrayList<>();
for (Project project : topology.getProjects()) {
if (config.shouldOptimizeAcls()) {
Method getClustersState
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected Collection<? extends Artefact> getClustersState() throws IOException {
List<Either> list =
clients.values().stream()
.map(
Method buildBindingsForConnect
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public List<TopologyAclBinding> buildBindingsForConnect(Connector connector, String topicPrefix) {
String principal = connector.getPrincipal();
List<String> readTopics = connector.getTopics().get("read");
Method updatePlan
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void updatePlan(ExecutionPlan plan, Map<String, Topology> topologies) throws IOException {
// Get current quotas
try {
Map<ClientQuotaEntity, Map<String, Double>> currentQuotas =
Similar blocks of code found in 2 locations. Consider refactoring. Open
private static String getPartitionNumberOp(Configuration config) throws ConfigurationException {
List<String> validOpCodes = Arrays.asList("gt", "lt", "eq", "gte", "lte", "ne");
try {
String opCode =
config.getProperty(TOPOLOGY_VALIDATIONS_PARTITION_NUMBER_OP).toLowerCase().strip();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 106.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method getClustersState
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected Collection<? extends Artefact> getClustersState() throws IOException {
List<Either> list =
clients.values().stream()
.map(