Neutrollized/rundeck-gcp-nodes-plugin

View on GitHub

Showing 10 of 10 total issues

Method instanceToNode has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

    @SuppressWarnings("unchecked")
    static INodeEntry instanceToNode(final Instance inst, final Properties mapping, String projectId) throws GeneratorException {
        final NodeEntryImpl node = new NodeEntryImpl();
        if (null != mapping.getProperty("tags.selector")) {
            final String selector = mapping.getProperty("tags.selector");

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

    public static String applySelector(final Instance inst, final String selector, final String defaultValue,
                                       final boolean tagMerge) throws GeneratorException {
        if (null != selector) {
            for (final String selPart : selector.split(",")) {
                if (tagMerge) {

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

    @SuppressWarnings("unchecked")
    static INodeEntry instanceToNode(final Instance inst, final Properties mapping, String projectId) throws GeneratorException {
        final NodeEntryImpl node = new NodeEntryImpl();
        if (null != mapping.getProperty("tags.selector")) {
            final String selector = mapping.getProperty("tags.selector");

    File InstanceToNodeMapper.java has 311 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Copyright 2011 DTO Solutions, Inc. (http://dtosolutions.com)
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.

      Method applySingleSelector has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          private static String applySingleSelector(final Instance inst, final String selector) throws
              GeneratorException {
              if (null != selector && !"".equals(selector)) {
                  try {
                      String value = null;

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

          private void loadMapping() {
              if (useDefaultMapping) {
                  mapping.putAll(defaultMapping);
              }
              if (null != mappingFile) {

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

          private void loadMapping() {
              if (useDefaultMapping) {
                  mapping.putAll(defaultMapping);
              }
              if (null != mappingFile) {

        Method applySingleSelector has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static String applySingleSelector(final Instance inst, final String selector) throws
                GeneratorException {
                if (null != selector && !"".equals(selector)) {
                    try {
                        String value = null;

          Avoid deeply nested control flow statements.
          Open

                                  if (null != val && sb.length() > 0) {
                                      sb.append(",");
                                      sb.append(val);
                                  } else if (null != val) {
                                      sb.append(val);

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

                private void checkFuture() {
                    if (null != futureResult && futureResult.isDone()) {
                        try {
                            iNodeSet = futureResult.get();
                        } catch (InterruptedException e) {

            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