cs-xml/src/main/java/io/cloudslang/content/xml/utils/XmlUtils.java
XmlUtils
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public class XmlUtils {
private static final String OK_STATUS_CODE = "200";
private XmlUtils() {
}
File XmlUtils.java
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
* Copyright 2022-2024 Open Text
* This program and the accompanying materials
* are made available under the terms of the Apache License v2.0 which accompany this distribution.
*
Method getNamespaceContext
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public static NamespaceContext getNamespaceContext(String xmlString, String xmlFilePath) throws Exception {
InputStream inputXML = getStream(xmlString, xmlFilePath);
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
XMLStreamReader reader = inputFactory.createXMLStreamReader(inputXML);
Map<String, String> namespaces = 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 createXmlDocumentFromUrl
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static String createXmlDocumentFromUrl(CommonInputs commonInputs) throws Exception {
HttpClientService scoreHttpClient = new HttpClientService();
HttpClientInputs httpClientInputs = new HttpClientInputs();
httpClientInputs.setMethod(HttpGet.METHOD_NAME);
httpClientInputs.setUrl(commonInputs.getXmlDocument());
Method getStream
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public static InputStream getStream(String xml, String filePath) throws IOException {
InputStream inputXML;
if (StringUtils.isEmpty(filePath)) {
inputXML = new ByteArrayInputStream(xml.getBytes());
} else {
- 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"