tumugi/tumugi-plugin-bigquery

View on GitHub

Showing 6 of 6 total issues

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

            def run
              unless output.is_a?(Tumugi::Plugin::FileSystemTarget)
                raise Tumugi::TumugiError.new("BigqueryExportTask#output must be return a instance of Tumugi::Plugin::FileSystemTarget")
              end
      
      
      Severity: Minor
      Found in lib/tumugi/plugin/task/bigquery_export.rb - 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 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 export_to_file_system has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def export_to_file_system(client)
              schema ||= client.table(dataset_id, table_id, project_id: client.project_id).schema.fields
              field_names = schema.map{|f| f.respond_to?(:[]) ? (f["name"] || f[:name]) : f.name }
              start_index = 0
              page_token = nil
      Severity: Minor
      Found in lib/tumugi/plugin/task/bigquery_export.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
        Severity
        Category
        Status
        Source
        Language