roqua/physiqual

View on GitHub

Showing 12 of 12 total issues

Class Token has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Token < ActiveRecord::Base
    self.table_name = 'physiqual_tokens'

    belongs_to :physiqual_user, class_name: 'Physiqual::User'
    validates :physiqual_user_id, presence: true
Severity: Minor
Found in app/models/physiqual/token.rb - About 2 hrs to fix

Method create_buckets has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def create_buckets(buckets, data)
        current_bucket = 0
        data.each do |entry|
          next unless entry.measurement_moment

Severity: Minor
Found in lib/physiqual/data_services/bucketeer_data_service.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 profile has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def profile
        {
          user: {
            age: 24,
            avatar: 'https://static0.fitbit.com/images/profile/defaultProfile_100_male.gif',
Severity: Minor
Found in lib/physiqual/data_services/mock_service.rb - About 1 hr to fix

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

      def generate(from, to)
        currently = Time.zone.now
        first_measurement_of_the_day = from
        bucket_start = -1
        bucket_end = -1
Severity: Minor
Found in lib/physiqual/bucket_generators/equidistant_bucket_generator.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 generate_time_series has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def generate_time_series(from, to)
        time = from
        res = []
        index = 0
        while time < to
Severity: Minor
Found in lib/physiqual/data_services/mock_service.rb - 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 lower_and_upper_bounds has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def lower_and_upper_bounds(arr, value)
        return [0, 0] if arr.size == 1
        return [0, 0] if value <= arr[0] # does not occur, included for correctness only
        return [arr.size - 1, arr.size - 1] if value > arr[-1] # does not occur, included for correctness only
        l = 0
Severity: Minor
Found in lib/physiqual/data_services/summarized_data_service.rb - 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 process_impute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def process_impute(array)
        array.each_with_index do |current, index|
          next unless need_imputation? current
          from = [0, (index - @k)].max
          to = [array.length - 1, (index + @k)].min
Severity: Minor
Found in lib/physiqual/imputers/k_nearest_neighbor_imputer.rb - 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 process_impute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def process_impute(y_array)
        return y_array if y_array.compact.blank?
        len = y_array.length
        x_array = []
        y_array = y_array.map.with_index do |current, index|
Severity: Minor
Found in lib/physiqual/imputers/spline_imputer.rb - 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 activity_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def activity_data(from, to, url, value_type)
        res = point_results(from, to, url)
        loop_through_results(res) do |value, start, endd, results_array|
          current_value = value[value_type].to_i
          current_value = [(block_given? ? yield(current_value) : current_value)]
Severity: Minor
Found in lib/physiqual/data_services/google_service.rb - 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 specific_activity_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def specific_activity_data(from, to, url, activity_type)
        res = point_results(from, to, url)
        loop_through_results(res) do |value, start, endd, results_array|
          # If the current activity is not the specified activity, skip it
          next if value['intVal'] != activity_type
Severity: Minor
Found in lib/physiqual/data_services/google_service.rb - 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 process_impute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def process_impute(array)
        array.each_with_index do |current, index|
          array[index] = index >= 1 ? array[index - 1] : 0 if need_imputation? current
        end
        array
Severity: Minor
Found in lib/physiqual/imputers/last_observation_carried_forward_imputer.rb - 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 index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def index
      @sources = 'No google token'
      return unless session['physiqual_user_id'] && User.find_by_user_id(user_session)
      user = User.find_by_user_id(user_session)
      tok = Token.find_provider_token(GoogleToken.csrf_token, user)
Severity: Minor
Found in app/controllers/physiqual/test_login_controller.rb - 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