tumugi/tumugi-plugin-bigquery

View on GitHub
lib/tumugi/plugin/bigquery/client.rb

Summary

Maintainability
C
7 hrs
Test Coverage

File client.rb has 288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'kura'
require 'json'
require_relative './error'

Tumugi::Config.register_section('bigquery', :project_id, :client_email, :private_key, :private_key_file)
Severity: Minor
Found in lib/tumugi/plugin/bigquery/client.rb - About 2 hrs to fix

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

          class Client
            attr_reader :project_id
    
            def initialize(project_id: nil, client_email: nil, private_key: nil, private_key_file: nil)
              @project_id = project_id
    Severity: Minor
    Found in lib/tumugi/plugin/bigquery/client.rb - About 2 hrs to fix

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

              def initialize(project_id: nil, client_email: nil, private_key: nil, private_key_file: nil)
                @project_id = project_id
      
                if client_email.nil? && private_key.nil? && !private_key_file.nil?
                  @client = Kura.client(private_key_file)
      Severity: Minor
      Found in lib/tumugi/plugin/bigquery/client.rb - 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 copy has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def copy(src_dataset_id, src_table_id, dest_dataset_id, dest_table_id,
                       mode: :truncate,
                       src_project_id: nil,
                       dest_project_id: nil,
                       job_project_id: dest_project_id,
      Severity: Minor
      Found in lib/tumugi/plugin/bigquery/client.rb - About 35 mins to fix

        There are no issues that match your filters.

        Category
        Status