Showing 167 of 167 total issues
Configuration
has 106 methods (exceeds 20 allowed). Consider refactoring. Open
public class Configuration {
private static final Logger LOGGER = LogManager.getLogger(Configuration.class);
private final Map<String, String> cliParams;
File Configuration.java
has 589 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.purbon.kafka.topology;
import static com.purbon.kafka.topology.CommandLineInterface.*;
import static com.purbon.kafka.topology.Constants.*;
File TopologyCustomDeserializer.java
has 431 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.purbon.kafka.topology.serdes;
import static com.purbon.kafka.topology.serdes.JsonSerdesUtils.validateRequiresKeys;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.mapping;
File RBACBindingsBuilder.java
has 423 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.purbon.kafka.topology.roles.rbac;
import static com.purbon.kafka.topology.api.mds.ClusterIDs.KSQL_CLUSTER_ID_LABEL;
import static com.purbon.kafka.topology.roles.rbac.RBACPredefinedRoles.DEVELOPER_READ;
import static com.purbon.kafka.topology.roles.rbac.RBACPredefinedRoles.DEVELOPER_WRITE;
Method execute
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
private void execute(Action action, boolean dryRun) throws IOException {
LOGGER.debug(String.format("Execution action %s (dryRun=%s)", action, dryRun));
if (!action.toString().isEmpty()) {
outputStream.println(action);
}
- 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 AclsBindingsBuilder.java
has 359 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.purbon.kafka.topology.roles.acls;
import static java.util.Arrays.asList;
import com.purbon.kafka.topology.BindingsBuilderProvider;
Method updatePlan
has a Cognitive Complexity of 30 (exceeds 5 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<>();
- 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
MDSApiClient
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
public class MDSApiClient extends JulieHttpClient {
private static final Logger LOGGER = LogManager.getLogger(MDSApiClient.class);
private AuthenticationCredentials authenticationCredentials;
File AccessControlManager.java
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.purbon.kafka.topology;
import static com.purbon.kafka.topology.model.Component.*;
import com.purbon.kafka.topology.actions.Action;
ProjectImpl
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
public class ProjectImpl implements Project, Cloneable {
@JsonIgnore private Configuration config;
private String name;
Method isQuotaUpdated
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private boolean isQuotaUpdated(Map<String, Double> currentQuotasForPrincipal, Quota quota) {
Double consumerByteRate = currentQuotasForPrincipal.get("consumer_byte_rate");
if (quota.getConsumer_byte_rate().isEmpty() && consumerByteRate != null
|| consumerByteRate == null && quota.getConsumer_byte_rate().isPresent()) {
return true;
- 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 parseProject
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
private Project parseProject(
JsonParser parser, JsonNode rootNode, Topology topology, Configuration config)
throws IOException {
Iterable<String> it = () -> rootNode.fieldNames();
Method build
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public static Map<String, Topology> build(
String fileOrDir, String plansFile, Configuration config) throws IOException {
PlanMap plans = buildPlans(plansFile);
List<Topology> topologies = parseListOfTopologies(fileOrDir, config, plans);
Map<String, Topology> collection = new HashMap<>();
- 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 buildOptions
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
private Options buildOptions() {
final Option topologyFileOption =
Option.builder().longOpt(TOPOLOGY_OPTION).hasArg().desc(TOPOLOGY_DESC).required().build();
JulieHttpClient
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
public class JulieHttpClient {
private static final Logger LOGGER = LogManager.getLogger(JulieHttpClient.class);
private final long DEFAULT_TIMEOUT_MS = 60000;
Method execute
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void execute(Action action, boolean dryRun) throws IOException {
LOGGER.debug(String.format("Execution action %s (dryRun=%s)", action, dryRun));
if (!action.toString().isEmpty()) {
outputStream.println(action);
}
Project
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
@JsonDeserialize(as = ProjectImpl.class)
public interface Project {
String getName();
Method buildProjectAclBindings
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private List<AclBindingsResult> buildProjectAclBindings(Topology topology) {
List<AclBindingsResult> aclBindingsResults = new ArrayList<>();
for (Project project : topology.getProjects()) {
if (config.shouldOptimizeAcls()) {
- 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 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public Topic deserialize(JsonParser parser, DeserializationContext context) throws IOException {
JsonNode rootNode = parser.getCodec().readTree(parser);
validateRequiresKeys(rootNode, "name");
Method buildBindingsForKSqlApp
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public Collection<TopologyAclBinding> buildBindingsForKSqlApp(KSqlApp app, String prefix) {
List<TopologyAclBinding> bindings = new ArrayList<>();
// Ksql cluster scope