treasure-data/embulk-input-marketo

View on GitHub

Showing 67 of 91 total issues

Method validateInputTask has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public void validateInputTask(PluginTask task)
    {
        super.validateInputTask(task);
        try (MarketoRestClient marketoRestClient = createMarketoRestClient(task)) {

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;
Severity: Minor
Found in src/main/java/org/embulk/input/marketo/rest/MarketoRestClient.java - About 1 hr to fix

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 ingestServiceData has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public TaskReport ingestServiceData(final PluginTask task, RecordImporter recordImporter, int taskIndex, PageBuilder pageBuilder)
    {
        TaskReport taskReport = CONFIG_MAPPER_FACTORY.newTaskReport();
        if (Exec.isPreview()) {

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 getRecordWithTokenPagination has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private <T> RecordPagingIterable<T> getRecordWithTokenPagination(final String endPoint, final Multimap<String, String> parameters, final Class<T> recordClass)
    {
        return new RecordPagingIterable<>(new RecordPagingIterable.PagingFunction<RecordPagingIterable.TokenPage<T>>()
        {
            @Override
Severity: Minor
Found in src/main/java/org/embulk/input/marketo/rest/MarketoRestClient.java - About 1 hr to fix

    Method ingestServiceData has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        public TaskReport ingestServiceData(final PluginTask task, RecordImporter recordImporter, int taskIndex, PageBuilder pageBuilder)
        {
            TaskReport taskReport = CONFIG_MAPPER_FACTORY.newTaskReport();
            if (Exec.isPreview()) {

      Method waitExportJobComplete has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          private ObjectNode waitExportJobComplete(MarketoRESTEndpoint marketoRESTEndpoint, String exportId, int pollingInterval, int waitTimeout) throws InterruptedException
          {
              long waitTime = 0;
              long waitTimeoutMs = waitTimeout * 1000L;
              long now = System.currentTimeMillis();
      Severity: Minor
      Found in src/main/java/org/embulk/input/marketo/rest/MarketoRestClient.java - About 1 hr to fix

      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 getRecordWithTokenPagination has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          private <T> RecordPagingIterable<T> getRecordWithTokenPagination(final String endPoint, final Multimap<String, String> parameters, final Class<T> recordClass)
          {
              return new RecordPagingIterable<>(new RecordPagingIterable.PagingFunction<RecordPagingIterable.TokenPage<T>>()
              {
                  @Override
      Severity: Minor
      Found in src/main/java/org/embulk/input/marketo/rest/MarketoRestClient.java - About 1 hr to fix

      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 waitExportJobComplete has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private ObjectNode waitExportJobComplete(MarketoRESTEndpoint marketoRESTEndpoint, String exportId, int pollingInterval, int waitTimeout) throws InterruptedException
          {
              long waitTime = 0;
              long waitTimeoutMs = waitTimeout * 1000L;
              long now = System.currentTimeMillis();
      Severity: Minor
      Found in src/main/java/org/embulk/input/marketo/rest/MarketoRestClient.java - About 1 hr to fix

        Method getObjectsByIds has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected Iterable<ObjectNode> getObjectsByIds(String[] inputIds, Function<Set<String>, Iterable<ObjectNode>> getByIdFunction)
            {
                final Set<String> ids = new HashSet<>();
                final List<String> invalidIds = new ArrayList<>();
        
        

          Method createFutureTask has a Cognitive Complexity of 10 (exceeds 5 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);

          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 getObjectsByIds has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              protected Iterable<ObjectNode> getObjectsByIds(String[] inputIds, Function<Set<String>, Iterable<ObjectNode>> getByIdFunction)
              {
                  final Set<String> ids = new HashSet<>();
                  final List<String> invalidIds = new ArrayList<>();
          
          

          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 iterator has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                      @Override
                      public Iterator<R> iterator()
                      {
                          return new Iterator<R>()
                          {
          Severity: Minor
          Found in src/main/java/org/embulk/input/marketo/MarketoUtils.java - About 55 mins to fix

          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 createFutureTask has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              private Future<?> createFutureTask(PluginTask task, RecordImporter recordImporter, PageBuilder pageBuilder, ThreadPoolExecutor executor, MarketoRestClient restClient, List<String> fieldNames, Integer programId)

            Method extractLead has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                File extractLead(Date startTime, Date endTime, List<String> extractedFields, String filterField, int pollingTimeIntervalSecond, int bulkJobTimeoutSecond);
            Severity: Minor
            Found in src/main/java/org/embulk/input/marketo/MarketoService.java - About 45 mins to fix

              Method extractLead has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public File extractLead(final Date startTime, Date endTime, List<String> extractedFields, String filterField, int pollingTimeIntervalSecond, final int bulkJobTimeoutSecond)
              Severity: Minor
              Found in src/main/java/org/embulk/input/marketo/MarketoServiceImpl.java - About 45 mins to fix

                Method getCustomObjectColumns has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected List<MarketoField> getCustomObjectColumns()
                    {
                        List<MarketoField> columns = marketoService.describeCustomObject(pluginTask.getCustomObjectAPIName());
                        if (pluginTask.getCustomObjectFields().isPresent() && StringUtils.isNotBlank(pluginTask.getCustomObjectFields().get())) {
                            List<MarketoField> filteredColumns = new ArrayList<>();

                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 validateInputTask has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    @Override
                    public void validateInputTask(PluginTask task)
                    {
                        super.validateInputTask(task);
                        if (StringUtils.isBlank(task.getCustomObjectFilterType())) {

                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 getLeadColumns has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected List<MarketoField> getLeadColumns()
                    {
                        List<MarketoField> columns = marketoService.describeLead();
                        if (pluginTask.getIncludedLeadFields().isPresent() && !pluginTask.getIncludedLeadFields().get().isEmpty()) {
                            List<MarketoField> filteredColumns = new ArrayList<>();

                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 6 arguments (exceeds 4 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)
                Severity: Minor
                Found in src/main/java/org/embulk/input/marketo/rest/MarketoBaseRestClient.java - About 45 mins to fix

                  Method doRequestWithWrappedException has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      private <T> T doRequestWithWrappedException(final String target, final HttpMethod method, final Map<String, String> headers, final Multimap<String, String> params, final ContentProvider contentProvider, Jetty94ResponseReader<T> responseReader)
                  Severity: Minor
                  Found in src/main/java/org/embulk/input/marketo/rest/MarketoBaseRestClient.java - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language