gojekfarm/beast

View on GitHub

Showing 19 of 31 total issues

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

public interface AppConfig extends Config {
    @Key("CONSUMER_POLL_TIMEOUT_MS")
    @DefaultValue("9223372036854775807")
    Long getConsumerPollTimeoutMs();

Severity: Minor
Found in src/main/java/com/gojek/beast/config/AppConfig.java - About 2 hrs to fix

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

        @Override
        public Status job() {
            offsetState.startTimer();
            try {
                Instant startTime = Instant.now();
    Severity: Minor
    Found in src/main/java/com/gojek/beast/worker/OffsetCommitWorker.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 job has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        public Status job() {
            offsetState.startTimer();
            try {
                Instant startTime = Instant.now();
    Severity: Minor
    Found in src/main/java/com/gojek/beast/worker/OffsetCommitWorker.java - About 1 hr to fix

      Method getMappings has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private Map<String, Object> getMappings(DynamicMessage message, ColumnMapping columnMapping) {
              if (message == null || columnMapping == null || columnMapping.isEmpty()) {
                  return new HashMap<>();
              }
              if (message.getUnknownFields().asMap().size() > 0) {
      Severity: Minor
      Found in src/main/java/com/gojek/beast/converter/RowMapper.java - About 1 hr to fix

        Method push has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            @Override
            public Status push(Records records) {
                InsertAllResponse response = insertIntoBQ(records.getRecords());
                if (response.hasErrors()) {
                    //parse the error records
        Severity: Minor
        Found in src/main/java/com/gojek/beast/sink/bq/BqSink.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 main has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static void main(String[] args) throws IOException, InterruptedException {
                AppConfig appConfig = ConfigFactory.create(AppConfig.class, System.getenv());
                ProtoMappingConfig protoMappingConfig = ConfigFactory.create(ProtoMappingConfig.class, System.getenv());
                BackOffConfig backOffConfig = ConfigFactory.create(BackOffConfig.class, System.getenv());
                StencilConfig stencilConfig = ConfigFactory.create(StencilConfig.class, System.getenv());
        Severity: Minor
        Found in src/main/java/com/gojek/beast/launch/Main.java - About 1 hr to fix

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

              private ProtoField parseFields(ProtoField protoField, String protoSchema, Map<String, Descriptors.Descriptor> allDescriptors,
                                             Map<String, String> typeNameToPackageNameMap, int level) {
          
                  Descriptors.Descriptor currentProto = descriptorCache.fetch(allDescriptors, typeNameToPackageNameMap, protoSchema);
                  if (currentProto == null) {
          Severity: Minor
          Found in src/main/java/com/gojek/beast/protomapping/Parser.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 upsertDatasetAndTable has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private void upsertDatasetAndTable(TableInfo tableInfo) {
                  Dataset dataSet = bigquery.getDataset(tableID.getDataset());
                  if (dataSet == null || !bigquery.getDataset(tableID.getDataset()).exists()) {
                      bigquery.create(
                              Dataset.newBuilder(tableID.getDataset())
          Severity: Minor
          Found in src/main/java/com/gojek/beast/sink/bq/BQClient.java - About 1 hr to fix

            Method push has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                public Status push(Records records) {
                    InsertAllResponse response = insertIntoBQ(records.getRecords());
                    if (response.hasErrors()) {
                        //parse the error records
            Severity: Minor
            Found in src/main/java/com/gojek/beast/sink/bq/BqSink.java - About 1 hr to fix

              Method pushToSink has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private Status pushToSink(Records poll) {
                      Status status;
                      try {
                          status = sink.push(poll);
                          statsClient.count("kafka.batch.records.size," + statsClient.getBqTags(), poll.getSize());
              Severity: Minor
              Found in src/main/java/com/gojek/beast/worker/BqQueueWorker.java - About 1 hr to fix

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

                    private void upsertDatasetAndTable(TableInfo tableInfo) {
                        Dataset dataSet = bigquery.getDataset(tableID.getDataset());
                        if (dataSet == null || !bigquery.getDataset(tableID.getDataset()).exists()) {
                            bigquery.create(
                                    Dataset.newBuilder(tableID.getDataset())
                Severity: Minor
                Found in src/main/java/com/gojek/beast/sink/bq/BQClient.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 parseResponse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public BQFilteredResponse parseResponse(final List<Record> records, final InsertAllResponse bqResponse) {
                        Map<Record, Set<BQRecordsErrorType>> filtered = parseErrors(records, bqResponse);
                        final List<Record> retryableRecords = new ArrayList<>();
                        final List<Record> unhandledRecords = new ArrayList<>();
                        final List<Record> oobRecords = new ArrayList<>();
                Severity: Minor
                Found in src/main/java/com/gojek/beast/sink/bq/handler/BQResponseParser.java - About 45 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 convert has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public List<Record> convert(final Iterable<ConsumerRecord<byte[], byte[]>> messages) throws InvalidProtocolBufferException {
                        ArrayList<Record> validRecords = new ArrayList<>();
                        ArrayList<Record> invalidRecords = new ArrayList<>();
                        for (ConsumerRecord<byte[], byte[]> message : messages) {
                            if (message.value() == null) {
                Severity: Minor
                Found in src/main/java/com/gojek/beast/converter/ConsumerRecordConverter.java - About 45 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 parseFields has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    private ProtoField parseFields(ProtoField protoField, String protoSchema, Map<String, Descriptors.Descriptor> allDescriptors,
                                                   Map<String, String> typeNameToPackageNameMap, int level) {
                Severity: Minor
                Found in src/main/java/com/gojek/beast/protomapping/Parser.java - About 35 mins to fix

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

                      @Override
                      public String toString() {
                          String errString = "InsertStatus:";
                          if (cause.getErrors().isEmpty()) {
                              return  errString + " NO_ERRORS";
                  Severity: Minor
                  Found in src/main/java/com/gojek/beast/sink/bq/InsertStatus.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

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

                      public Map<String, String> convert(Method method, String input) {
                          Map<String, String> result = new LinkedHashMap<>();
                          String[] chunks = input.split(ELEMENT_SEPARATOR, -1);
                          for (String chunk : chunks) {
                              String[] entry = chunk.split(VALUE_SEPARATOR, -1);
                  Severity: Minor
                  Found in src/main/java/com/gojek/beast/config/LabelMapConverter.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

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

                      private Status pushToSink(Records poll) {
                          Status status;
                          try {
                              status = sink.push(poll);
                              statsClient.count("kafka.batch.records.size," + statsClient.getBqTags(), poll.getSize());
                  Severity: Minor
                  Found in src/main/java/com/gojek/beast/worker/BqQueueWorker.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      @Override
                      public void run() {
                          log.info("Started worker {}", getClass().getSimpleName());
                          Status status;
                          do {
                  Severity: Minor
                  Found in src/main/java/com/gojek/beast/worker/Worker.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 generateColumnMappingsJson has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private ObjectNode generateColumnMappingsJson(List<ProtoField> fields) {
                          if (fields.size() == 0) {
                              return JsonNodeFactory.instance.objectNode();
                          }
                  
                  
                  Severity: Minor
                  Found in src/main/java/com/gojek/beast/protomapping/Converter.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