treasure-data/embulk-input-google_analytics

View on GitHub
lib/embulk/input/google_analytics/plugin.rb

Summary

Maintainability
C
1 day
Test Coverage

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

        def self.transaction(config, &control)
          task = task_from_config(config)
          unless %w(ga:date ga:dateHour).include?(task["time_series"])
            raise ConfigError.new("Unknown time_series '#{task["time_series"]}'. Use 'ga:dateHour' or 'ga:date'")
          end
Severity: Minor
Found in lib/embulk/input/google_analytics/plugin.rb - 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 transaction has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def self.transaction(config, &control)
          task = task_from_config(config)
          unless %w(ga:date ga:dateHour).include?(task["time_series"])
            raise ConfigError.new("Unknown time_series '#{task["time_series"]}'. Use 'ga:dateHour' or 'ga:date'")
          end
Severity: Minor
Found in lib/embulk/input/google_analytics/plugin.rb - About 1 hr to fix

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

            def calculate_next_times(client_time_zone, fetched_latest_time)
              task_report = {}
              if fetched_latest_time
                # Convert fetched_last_time to user timezone
                timezone = ActiveSupport::TimeZone[client_time_zone]
    Severity: Minor
    Found in lib/embulk/input/google_analytics/plugin.rb - 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 run has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def run
              client = Client.new(task, preview?)
              columns = self.class.columns_from_task(task) + ["view_id"]
    
              last_record_time = Time.parse(task["last_record_time"]) if task['incremental'] && !task["last_record_time"].blank?
    Severity: Minor
    Found in lib/embulk/input/google_analytics/plugin.rb - About 1 hr to fix

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

              def run
                client = Client.new(task, preview?)
                columns = self.class.columns_from_task(task) + ["view_id"]
      
                last_record_time = Time.parse(task["last_record_time"]) if task['incremental'] && !task["last_record_time"].blank?
      Severity: Minor
      Found in lib/embulk/input/google_analytics/plugin.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

      There are no issues that match your filters.

      Category
      Status