ppostma/milight-v6-api

View on GitHub

Showing 9 of 9 total issues

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

def brightness(value)
raise ArgumentError, "Please supply a brightness value between 0-100." if value.negative? || value > 100
 
@command.execute(0, [0x31, 0x00, 0x00, 0x08, 0x03, value, 0x00, 0x00, 0x00])
 
 
Severity: Minor
Found in lib/milight/v6/all.rb and 3 other locations - About 15 mins to fix
lib/milight/v6/all.rb on lines 42..47
lib/milight/v6/all.rb on lines 71..76
lib/milight/v6/bridge.rb on lines 26..31

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

def brightness(value)
raise ArgumentError, "Please supply a brightness value between 0-100." if value.negative? || value > 100
 
@command.execute(1, [0x31, 0x00, 0x00, 0x00, 0x02, value, 0x00, 0x00, 0x00])
 
 
Severity: Minor
Found in lib/milight/v6/bridge.rb and 3 other locations - About 15 mins to fix
lib/milight/v6/all.rb on lines 33..38
lib/milight/v6/all.rb on lines 42..47
lib/milight/v6/all.rb on lines 71..76

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

def saturation(value)
raise ArgumentError, "Please supply a saturation value between 0-100." if value.negative? || value > 100
 
@command.execute(zone_id, [0x31, 0x00, 0x00, 0x08, 0x02, value, 0x00, 0x00, 0x00])
 
 
Severity: Minor
Found in lib/milight/v6/zone.rb and 2 other locations - About 15 mins to fix
lib/milight/v6/zone.rb on lines 50..55
lib/milight/v6/zone.rb on lines 59..64

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

def hue(value)
raise ArgumentError, "Please supply a hue value between 0-255." if value.negative? || value > 255
 
@command.execute(1, [0x31, 0x00, 0x00, 0x00, 0x01, value, value, value, value])
 
 
Severity: Minor
Found in lib/milight/v6/bridge.rb and 1 other location - About 15 mins to fix
lib/milight/v6/all.rb on lines 62..67

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

def hue(value)
raise ArgumentError, "Please supply a hue value between 0-255." if value.negative? || value > 255
 
@command.execute(0, [0x31, 0x00, 0x00, 0x08, 0x01, value, value, value, value])
 
 
Severity: Minor
Found in lib/milight/v6/all.rb and 1 other location - About 15 mins to fix
lib/milight/v6/bridge.rb on lines 43..48

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

def temperature(value)
raise ArgumentError, "Please supply a temperature value between 0-100 (2700K to 6500K)." if value.negative? || value > 100
 
@command.execute(0, [0x31, 0x00, 0x00, 0x08, 0x05, value, 0x00, 0x00, 0x00])
 
 
Severity: Minor
Found in lib/milight/v6/all.rb and 3 other locations - About 15 mins to fix
lib/milight/v6/all.rb on lines 33..38
lib/milight/v6/all.rb on lines 71..76
lib/milight/v6/bridge.rb on lines 26..31

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

def temperature(value)
raise ArgumentError, "Please supply a temperature value between 0-100 (2700K to 6500K)." if value.negative? || value > 100
 
@command.execute(zone_id, [0x31, 0x00, 0x00, 0x08, 0x05, value, 0x00, 0x00, 0x00])
 
 
Severity: Minor
Found in lib/milight/v6/zone.rb and 2 other locations - About 15 mins to fix
lib/milight/v6/zone.rb on lines 50..55
lib/milight/v6/zone.rb on lines 88..93

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

def brightness(value)
raise ArgumentError, "Please supply a brightness value between 0-100." if value.negative? || value > 100
 
@command.execute(zone_id, [0x31, 0x00, 0x00, 0x08, 0x03, value, 0x00, 0x00, 0x00])
 
 
Severity: Minor
Found in lib/milight/v6/zone.rb and 2 other locations - About 15 mins to fix
lib/milight/v6/zone.rb on lines 59..64
lib/milight/v6/zone.rb on lines 88..93

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

def saturation(value)
raise ArgumentError, "Please supply a saturation value between 0-100." if value.negative? || value > 100
 
@command.execute(0, [0x31, 0x00, 0x00, 0x08, 0x02, value, 0x00, 0x00, 0x00])
 
 
Severity: Minor
Found in lib/milight/v6/all.rb and 3 other locations - About 15 mins to fix
lib/milight/v6/all.rb on lines 33..38
lib/milight/v6/all.rb on lines 42..47
lib/milight/v6/bridge.rb on lines 26..31
Severity
Category
Status
Source
Language