helium/helium-ruby

View on GitHub

Showing 27 of 27 total issues

Class Collection has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

class Collection
include Enumerable
 
attr_reader :filter_criteria
 
 
Severity: Minor
Found in lib/helium/collection.rb - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    def sensor_timeseries(sensor, opts = {})
    path = "/sensor/#{sensor.id}/timeseries"
     
    params = {
    "page[size]" => opts.fetch(:size, nil),
    Severity: Major
    Found in lib/helium/client/sensors.rb and 1 other location - About 1 hr to fix
    lib/helium/client/elements.rb on lines 20..36

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    def element_timeseries(element, opts = {})
    path = "/element/#{element.id}/timeseries"
     
    params = {
    "page[size]" => opts.fetch(:size, nil),
    Severity: Major
    Found in lib/helium/client/elements.rb and 1 other location - About 1 hr to fix
    lib/helium/client/sensors.rb on lines 29..45

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    def timeseries(opts = {})
    size = opts.fetch(:size, 1000)
    port = opts.fetch(:port, nil)
    start_time = opts.fetch(:start_time, nil)
    end_time = opts.fetch(:end_time, nil)
    Severity: Major
    Found in lib/helium/element.rb and 1 other location - About 1 hr to fix
    lib/helium/sensor.rb on lines 35..50

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    def timeseries(opts = {})
    size = opts.fetch(:size, 1000)
    port = opts.fetch(:port, nil)
    start_time = opts.fetch(:start_time, nil)
    end_time = opts.fetch(:end_time, nil)
    Severity: Major
    Found in lib/helium/sensor.rb and 1 other location - About 1 hr to fix
    lib/helium/element.rb on lines 36..51

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class Library < Resource
    attr_reader :name
     
    def initialize(opts = {})
    super(opts)
    Severity: Minor
    Found in lib/helium/helium_script.rb and 1 other location - About 35 mins to fix
    lib/helium/helium_script.rb on lines 3..15

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class Script < Resource
    attr_reader :name
     
    def initialize(opts = {})
    super(opts)
    Severity: Minor
    Found in lib/helium/helium_script.rb and 1 other location - About 35 mins to fix
    lib/helium/helium_script.rb on lines 18..30

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    def sensor_element(sensor)
    path = "/sensor/#{sensor.id}/element"
    response = get(path)
    elementj = JSON.parse(response.body)["data"]
    element = Element.new(client: self, params: elementj)
    Severity: Minor
    Found in lib/helium/client/sensors.rb and 1 other location - About 20 mins to fix
    lib/helium/client/device_configurations.rb on lines 13..18

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    def device_configuration_configuration(device_config)
    path = "/device-configuration/#{device_config.id}/configuration"
    response = get(path)
    configj = JSON.parse(response.body)["data"]
    config = Configuration.new(client: self, params: configj)
    Severity: Minor
    Found in lib/helium/client/device_configurations.rb and 1 other location - About 20 mins to fix
    lib/helium/client/sensors.rb on lines 12..18

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    def sensor_device_configuration(sensor)
    path = "/sensor/#{sensor.id}/device-configuration"
    response = get(path)
    dc_data = JSON.parse(response.body)["data"]
    # dc_data is an array, but there will only be one for one
    Severity: Minor
    Found in lib/helium/client/sensors.rb and 1 other location - About 20 mins to fix
    lib/helium/client/elements.rb on lines 12..17

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    def element_device_configuration(element)
    path = "/element/#{element.id}/device-configuration"
    response = get(path)
    dc_data = JSON.parse(response.body)["data"]
    # dc_data is an array, but there will only be one for one
    Severity: Minor
    Found in lib/helium/client/elements.rb and 1 other location - About 20 mins to fix
    lib/helium/client/sensors.rb on lines 21..26

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class Client
    module Configurations
     
    def configurations
    Configuration.all(client: self)
    Severity: Minor
    Found in lib/helium/client/configurations.rb and 1 other location - About 15 mins to fix
    lib/helium/client/labels.rb on lines 2..13

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class Client
    module Labels
    def labels
    Label.all(client: self)
    end
    Severity: Minor
    Found in lib/helium/client/labels.rb and 1 other location - About 15 mins to fix
    lib/helium/client/configurations.rb on lines 2..15

    Unused method argument - block. If it's necessary, use _ or _block as an argument name to indicate that it won't be used.
    Open

    def stream_from(path, opts = {}, &block)
    Severity: Minor
    Found in lib/helium/client/http.rb by rubocop

    Method Helium::DataPoint#timestamp is defined at both lib/helium/data_point.rb:3 and lib/helium/data_point.rb:13.
    Open

    def timestamp
    Severity: Minor
    Found in lib/helium/data_point.rb by rubocop

    Method Helium::Element#last_seen is defined at both lib/helium/element.rb:3 and lib/helium/element.rb:31.
    Open

    def last_seen
    Severity: Minor
    Found in lib/helium/element.rb by rubocop

    Method Helium::Sensor#last_seen is defined at both lib/helium/sensor.rb:3 and lib/helium/sensor.rb:70.
    Open

    def last_seen
    Severity: Minor
    Found in lib/helium/sensor.rb by rubocop

    Unused block argument - m. You can omit the argument if you don't care about it.
    Open

    watch(%r{^lib/(.+).rb$}) do |m|
    Severity: Minor
    Found in Guardfile by rubocop

    Use == if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition.
    Open

    if existing_value = @filter_criteria[key]
    Severity: Minor
    Found in lib/helium/collection.rb by rubocop

    Do not suppress exceptions.
    Open

    rescue LoadError
    Severity: Minor
    Found in Rakefile by rubocop
    Severity
    Category
    Status
    Source
    Language