treasure-data/embulk-input-zendesk

View on GitHub

Showing 31 of 49 total issues

Method getDataFromPath has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public JsonNode getDataFromPath(final String path, final int page, final boolean isPreview, final long startTime)
    {
        Preconditions.checkArgument(isPreview, "IsPreview should be true to use this method");

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

    private void storeStartTimeForConfigDiff(final TaskReport taskReport, final long initStartTime, final long resultEndTime)
    {
        if (task.getIncremental()) {
            long nextStartTime;
            long now = Instant.now().getEpochSecond();

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

    private String sendGetRequest(final String url, final PluginTask task)
        throws ZendeskException
    {
        try {
            final HttpClient client = createHttpClient();

    Method isContinue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        protected boolean isContinue(final JsonNode jsonNode, final Consumer<? super JsonNode> action)
        {
            final Iterator<JsonNode> iterator = ZendeskUtils.getListRecords(jsonNode, task.getTarget().getJsonName());
    
    

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

        private void validateCredentials(PluginTask task)
        {
            switch (task.getAuthenticationMethod()) {
                case OAUTH:
                    if (!task.getAccessToken().isPresent()) {
    Severity: Minor
    Found in src/main/java/org/embulk/input/zendesk/ZendeskInputPlugin.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 tryAdvance has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        public boolean tryAdvance(final Consumer<? super JsonNode> action)
        {
            try {
                final String result = zendeskRestClient.doGet(path, task, 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

    Avoid deeply nested control flow statements.
    Open

                            if (type.equals(Types.TIMESTAMP.getName())) {
                                entry.remove("format");
                            }
    Severity: Major
    Found in src/main/java/org/embulk/input/zendesk/ZendeskInputPlugin.java - About 45 mins to fix

      Method validateIncremental has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          private void validateIncremental(PluginTask task)
          {
              if (task.getIncremental() && getZendeskService(task).isSupportIncremental()) {
                  if (!task.getDedup()) {
                      logger.warn("You've selected to skip de-duplicating records, result may contain duplicated data");
      Severity: Minor
      Found in src/main/java/org/embulk/input/zendesk/ZendeskInputPlugin.java - About 35 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

      Avoid too many return statements within this method.
      Open

              return true;
      Severity: Major
      Found in src/main/java/org/embulk/input/zendesk/clients/ZendeskRestClient.java - About 30 mins to fix

        Method run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            @Override
            public TaskReport run(final TaskSource taskSource, final Schema schema, final int taskIndex, final PageOutput output)
            {
                final PluginTask task = TASK_MAPPER.map(taskSource, PluginTask.class);
        
        
        Severity: Minor
        Found in src/main/java/org/embulk/input/zendesk/ZendeskInputPlugin.java - About 25 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 unifiedFieldNames has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private List<String> unifiedFieldNames(JsonNode jsonNode, String targetJsonName)
            {
                List<String> columnNames = new ArrayList<>();
                Iterator<JsonNode> records = ZendeskUtils.getListRecords(jsonNode, targetJsonName);
                while (records.hasNext()) {
        Severity: Minor
        Found in src/main/java/org/embulk/input/zendesk/ZendeskInputPlugin.java - About 25 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

        Severity
        Category
        Status
        Source
        Language