influxdata/influxdb-java

View on GitHub

Showing 114 of 114 total issues

File InfluxDBImpl.java has 805 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package org.influxdb.impl;

import com.squareup.moshi.JsonAdapter;
import com.squareup.moshi.Moshi;
import okhttp3.Headers;
Severity: Major
Found in src/main/java/org/influxdb/impl/InfluxDBImpl.java - About 1 day to fix

    Method traverse has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
    Open

      void traverse(final MessageUnpacker unpacker, final QueryResultModelPath queryResultPath, final int readAmount)
          throws IOException {
        int amount = 0;
    
        while (unpacker.hasNext() && amount < readAmount) {
    Severity: Minor
    Found in src/main/java/org/influxdb/msgpack/MessagePackTraverser.java - About 1 day 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

    InfluxDBImpl has 62 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class InfluxDBImpl implements InfluxDB {
    
      private static final String APPLICATION_MSGPACK = "application/x-msgpack";
    
      static final okhttp3.MediaType MEDIA_TYPE_STRING = MediaType.parse("text/plain");
    Severity: Major
    Found in src/main/java/org/influxdb/impl/InfluxDBImpl.java - About 1 day to fix

      InfluxDB has 50 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public interface InfluxDB extends AutoCloseable {
      
        /**
         * The system property key to set the http logging level across the JVM.
         * @see LogLevel for available values
      Severity: Minor
      Found in src/main/java/org/influxdb/InfluxDB.java - About 7 hrs to fix

        File Point.java has 453 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        package org.influxdb.dto;
        
        import org.influxdb.BuilderException;
        import org.influxdb.InfluxDBMapperException;
        import org.influxdb.annotation.Column;
        Severity: Minor
        Found in src/main/java/org/influxdb/dto/Point.java - About 6 hrs to fix

          Method traverse has 155 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            void traverse(final MessageUnpacker unpacker, final QueryResultModelPath queryResultPath, final int readAmount)
                throws IOException {
              int amount = 0;
          
              while (unpacker.hasNext() && amount < readAmount) {
          Severity: Major
          Found in src/main/java/org/influxdb/msgpack/MessagePackTraverser.java - About 6 hrs to fix

            QueryBuilder has 32 methods (exceeds 20 allowed). Consider refactoring.
            Open

              public static final class QueryBuilder {
            
                private QueryBuilder() {
                }
            
            
            Severity: Minor
            Found in src/main/java/org/influxdb/querybuilder/BuiltQuery.java - About 4 hrs to fix

              Method addFieldsFromPOJO has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

                  public Builder addFieldsFromPOJO(final Object pojo) {
              
                    Class<?> clazz = pojo.getClass();
                    Measurement measurement = clazz.getAnnotation(Measurement.class);
                    boolean allFields = measurement != null && measurement.allFields();
              Severity: Minor
              Found in src/main/java/org/influxdb/dto/Point.java - About 3 hrs 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 parseSeriesAs has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                <T> List<T> parseSeriesAs(final QueryResult.Series series, final Class<T> clazz, final List<T> result,
                                          final TimeUnit precision) {
                  int columnSize = series.getColumns().size();
              
                  ClassInfo classInfo = CLASS_INFO_CACHE.get(clazz.getName());
              Severity: Minor
              Found in src/main/java/org/influxdb/impl/InfluxDBResultMapper.java - About 3 hrs 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

              SelectionQueryImpl has 27 methods (exceeds 20 allowed). Consider refactoring.
              Open

              public class SelectionQueryImpl implements Selection, WithInto {
              
                private final SelectionCoreImpl selectionCore;
                private boolean requiresPost;
              
              
              Severity: Minor
              Found in src/main/java/org/influxdb/querybuilder/SelectionQueryImpl.java - About 3 hrs to fix

                File BatchProcessor.java has 286 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                package org.influxdb.impl;
                
                import org.influxdb.InfluxDB;
                import org.influxdb.InfluxDB.ConsistencyLevel;
                import org.influxdb.dto.BatchPoints;
                Severity: Minor
                Found in src/main/java/org/influxdb/impl/BatchProcessor.java - About 2 hrs to fix

                  SelectionSubQueryImpl has 25 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  public class SelectionSubQueryImpl<T extends WithSubquery> extends SubQuery<T>
                      implements Selection, WithSubquery {
                  
                    private final SelectionCoreImpl selectionCore;
                  
                  
                  Severity: Minor
                  Found in src/main/java/org/influxdb/querybuilder/SelectionSubQueryImpl.java - About 2 hrs to fix

                    Method adaptValue has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private static Object adaptValue(final Class<?> fieldType, final Object value, final TimeUnit precision,
                                                       final String fieldName, final String className) {
                        try {
                          if (String.class.isAssignableFrom(fieldType)) {
                            return String.valueOf(value);
                    Severity: Minor
                    Found in src/main/java/org/influxdb/impl/InfluxDBResultMapper.java - About 2 hrs 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

                    SelectionCoreImpl has 24 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class SelectionCoreImpl implements Selection, WithInto {
                    
                      protected List<Object> columns;
                      protected boolean isDistinct;
                      private String intoMeasurement;
                    Severity: Minor
                    Found in src/main/java/org/influxdb/querybuilder/SelectionCoreImpl.java - About 2 hrs to fix

                      Method cacheMeasurementClass has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                        void cacheMeasurementClass(final Class<?>... classVarAgrs) {
                          for (Class<?> clazz : classVarAgrs) {
                            if (CLASS_INFO_CACHE.containsKey(clazz.getName())) {
                              continue;
                            }
                      Severity: Minor
                      Found in src/main/java/org/influxdb/impl/InfluxDBResultMapper.java - About 2 hrs 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 query has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        @Override
                        public void query(final Query query, final int chunkSize, final BiConsumer<Cancellable, QueryResult> onNext,
                                          final Runnable onComplete, final Consumer<Throwable> onFailure) {
                          Call<ResponseBody> call;
                          if (query instanceof BoundParameterQuery) {
                      Severity: Major
                      Found in src/main/java/org/influxdb/impl/InfluxDBImpl.java - About 2 hrs to fix

                        Method buildQueryString has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                        Open

                          @Override
                          public StringBuilder buildQueryString(final StringBuilder builder) {
                            builder.append("SELECT ");
                        
                            if (isDistinct) {
                        Severity: Minor
                        Found in src/main/java/org/influxdb/querybuilder/SelectCoreImpl.java - About 2 hrs 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 write has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                        Open

                          void write() {
                            List<Point> currentBatch = null;
                            try {
                              if (this.queue.isEmpty()) {
                                BatchProcessor.this.batchWriter.write(Collections.emptyList());
                        Severity: Minor
                        Found in src/main/java/org/influxdb/impl/BatchProcessor.java - About 2 hrs 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

                        Point has 22 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        public class Point {
                          private String measurement;
                          private Map<String, String> tags;
                          private Number time;
                          private TimeUnit precision = TimeUnit.NANOSECONDS;
                        Severity: Minor
                        Found in src/main/java/org/influxdb/dto/Point.java - About 2 hrs to fix

                          Method write has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                          Open

                            @Override
                            public synchronized void write(final Collection<BatchPoints> collection) {
                              // empty the cached data first
                              ListIterator<BatchPoints> batchQueueIterator = batchQueue.listIterator();
                              while (batchQueueIterator.hasNext()) {
                          Severity: Minor
                          Found in src/main/java/org/influxdb/impl/RetryCapableBatchWriter.java - About 2 hrs 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