Showing 67 of 91 total issues
Method nextColumn
has a Cognitive Complexity of 104 (exceeds 5 allowed). Consider refactoring. Open
public String nextColumn()
{
if (!hasNextColumn()) {
throw new TooFewColumnsException("Too few columns");
}
- 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 CsvTokenizer.java
has 596 lines of code (exceeds 250 allowed). Consider refactoring. Open
package org.embulk.input.marketo;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonValue;
import com.google.common.base.Preconditions;
File MarketoRestClient.java
has 531 lines of code (exceeds 250 allowed). Consider refactoring. Open
package org.embulk.input.marketo.rest;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
Method nextColumn
has 174 lines of code (exceeds 25 allowed). Consider refactoring. Open
public String nextColumn()
{
if (!hasNextColumn()) {
throw new TooFewColumnsException("Too few columns");
}
MarketoRestClient
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
public class MarketoRestClient extends MarketoBaseRestClient
{
private static final String BATCH_SIZE = "batchSize";
private static final String NEXT_PAGE_TOKEN = "nextPageToken";
Method validateInputTask
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void validateInputTask(PluginTask task)
{
super.validateInputTask(task);
// validate if query_by is selected
- 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 getCustomObjectRecordWithPagination
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private <T> RecordPagingIterable<T> getCustomObjectRecordWithPagination(final String endPoint, final String customObjectFilterType, final String customObjectFields, final Integer fromValue, final Integer toValue, final Class<T> recordClass)
{
return new RecordPagingIterable<>(new RecordPagingIterable.PagingFunction<RecordPagingIterable.OffsetWithTokenPage<T>>()
{
@Override
- 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 doRequest
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected <T> T doRequest(final String target, final HttpMethod method, final Map<String, String> headers, final Multimap<String, String> params, final ContentProvider contentProvider, Jetty94ResponseReader<T> responseReader)
{
return retryHelper.requestWithRetry(responseReader, new Jetty94SingleRequester()
{
@Override
Method flatMap
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public static <T, R> Iterable<R> flatMap(final Iterable<T> iterable, final Function<T, Iterable<R>> function)
{
final Iterator<T> iterator = iterable.iterator();
return new Iterable<R>()
{
- 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
MarketoServiceImpl
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
public class MarketoServiceImpl implements MarketoService
{
private final Logger logger = LoggerFactory.getLogger(getClass());
private static final String DEFAULT_FILE_FORMAT = "csv";
File MarketoBaseRestClient.java
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
package org.embulk.input.marketo.rest;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ArrayListMultimap;
Method getCustomObjectRecordWithPagination
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
private <T> RecordPagingIterable<T> getCustomObjectRecordWithPagination(final String endPoint, final String customObjectFilterType, final String customObjectFields, final Integer fromValue, final Integer toValue, final Class<T> recordClass)
{
return new RecordPagingIterable<>(new RecordPagingIterable.PagingFunction<RecordPagingIterable.OffsetWithTokenPage<T>>()
{
@Override
Method requestAccessToken
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
private String requestAccessToken()
{
final Multimap<String, String> params = ArrayListMultimap.create();
params.put("client_id", clientId.trim());
params.put("client_secret", clientSecret.trim());
Method createFutureTask
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private Future<?> createFutureTask(PluginTask task, RecordImporter recordImporter, PageBuilder pageBuilder, ThreadPoolExecutor executor, MarketoRestClient restClient, List<String> fieldNames, Integer programId)
{
Runnable exportTask = () -> {
String exportJobID = restClient.createProgramMembersBulkExtract(fieldNames, programId);
restClient.startProgramMembersBulkExtract(exportJobID);
Method validateInputTask
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void validateInputTask(PluginTask task)
{
super.validateInputTask(task);
try (MarketoRestClient marketoRestClient = createMarketoRestClient(task)) {
Method importMockPreviewData
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static TaskReport importMockPreviewData(final PageBuilder pageBuilder, int numberRecords)
{
final JsonParser jsonParser = new JsonParser();
Schema schema = pageBuilder.getSchema();
for (int i = 1; i <= numberRecords; i++) {
Method flatMap
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static <T, R> Iterable<R> flatMap(final Iterable<T> iterable, final Function<T, Iterable<R>> function)
{
final Iterator<T> iterator = iterable.iterator();
return new Iterable<R>()
{
Method validateInputTask
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void validateInputTask(PluginTask task)
{
super.validateInputTask(task);
// validate if query_by is selected
Method nextLine
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private boolean nextLine(boolean skipEmptyLine)
{
while (true) {
if (!unreadLines.isEmpty()) {
line = unreadLines.removeFirst();
- 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 getOffsetPage
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private RecordPagingIterable.OffsetWithTokenPage<T> getOffsetPage(int offset, String nextPageToken)
{
boolean isMoreResult = true;
boolean isEndOffset = false;
int nextOffset = offset + MAX_REQUEST_SIZE;
- 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"