Skip to content

Commit

Permalink
bundle update
Browse files Browse the repository at this point in the history
including rubocop, and applying new cops

Signed-off-by: Cody Cutrer <[email protected]>
  • Loading branch information
ccutrer committed Sep 8, 2023
1 parent d561e30 commit 85b7ac0
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 62 deletions.
7 changes: 7 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Bundler/GemFilename:
Exclude:
- lib/openhab/dsl/gems.rb

Gemspec/DevelopmentDependencies:
EnforcedStyle: gemspec

Layout/LineLength:
AllowedPatterns:
- "# @example" # YARD example titles can't be broken up onto multiple lines.
Expand Down Expand Up @@ -58,6 +61,10 @@ RSpec/FilePath:
RSpec/IdenticalEqualityAssertion:
Exclude:
- spec/openhab/core/types/*_spec.rb
RSpec/IndexedLet:
Enabled: false
RSpec/MatchArray:
Enabled: false
RSpec/MessageSpies:
Enabled: false
RSpec/MultipleExpectations:
Expand Down
93 changes: 47 additions & 46 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ PATH
GEM
remote: https://rubygems.org/
specs:
activesupport (6.1.7.3)
activesupport (6.1.7.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.3)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
async (1.31.0)
Expand All @@ -39,18 +39,18 @@ GEM
protocol-http1 (~> 0.14.0)
protocol-http2 (~> 0.14.0)
traces (>= 0.8.0)
async-http-faraday (0.11.0)
async-http-faraday (0.12.0)
async-http (~> 0.42)
faraday
async-io (1.34.3)
async-io (1.35.0)
async
async-pool (0.4.0)
async (>= 1.25)
builder (3.2.4)
byebug (11.1.3)
coderay (1.1.3)
commonmarker (0.23.8)
concurrent-ruby (1.2.0)
commonmarker (0.23.10)
concurrent-ruby (1.2.2)
console (1.15.3)
fiber-local
cucumber (8.0.0)
Expand All @@ -65,7 +65,7 @@ GEM
mime-types (~> 3.4, >= 3.4.1)
multi_test (~> 1.1, >= 1.1.0)
sys-uname (~> 1.2, >= 1.2.2)
cucumber-ci-environment (9.1.0)
cucumber-ci-environment (9.2.0)
cucumber-core (11.0.0)
cucumber-gherkin (~> 23.0, >= 23.0.1)
cucumber-messages (~> 18.0, >= 18.0.0)
Expand All @@ -85,13 +85,13 @@ GEM
diff-lcs (1.5.0)
eventmachine (1.2.7)
eventmachine (1.2.7-java)
faraday (2.7.4)
faraday (2.7.10)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-http-cache (2.4.1)
faraday-http-cache (2.5.0)
faraday (>= 0.8)
faraday-net_http (3.0.2)
faraday-retry (2.1.0)
faraday-retry (2.2.0)
faraday (~> 2.0)
ffi (1.15.5)
ffi (1.15.5-java)
Expand Down Expand Up @@ -131,25 +131,25 @@ GEM
httparty (0.21.0)
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
i18n (1.12.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
io-console (0.6.0)
io-console (0.6.0-java)
irb (1.6.2)
irb (1.6.3)
reline (>= 0.3.0)
json (2.6.3)
json (2.6.3-java)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
lumberjack (1.2.8)
lumberjack (1.2.9)
marcel (1.0.2)
method_source (1.0.0)
mime-types (3.4.1)
mime-types (3.5.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2023.0218.1)
mini_mime (1.1.2)
minitest (5.18.0)
mime-types-data (3.2023.0808)
mini_mime (1.1.5)
minitest (5.20.0)
multi_json (1.15.0)
multi_test (1.1.0)
multi_xml (0.6.0)
Expand All @@ -170,9 +170,10 @@ GEM
octokit (4.25.1)
faraday (>= 1, < 3)
sawyer (~> 0.9)
parallel (1.22.1)
parser (3.2.1.0)
parallel (1.23.0)
parser (3.2.2.3)
ast (~> 2.4.1)
racc
pastel (0.8.0)
tty-color (~> 0.5)
persistent_http (1.0.6)
Expand All @@ -182,7 +183,7 @@ GEM
persistent_http (< 2)
process_exists (0.2.0)
protocol-hpack (1.4.2)
protocol-http (0.24.1)
protocol-http (0.24.4)
protocol-http1 (0.14.6)
protocol-http (~> 0.22)
protocol-http2 (0.14.2)
Expand All @@ -195,72 +196,72 @@ GEM
coderay (~> 1.1)
method_source (~> 1.0)
spoon (~> 0.0)
public_suffix (5.0.1)
racc (1.6.2)
racc (1.6.2-java)
rack (2.2.6.2)
public_suffix (5.0.3)
racc (1.7.1)
racc (1.7.1-java)
rack (2.2.8)
rainbow (3.1.1)
rake (13.0.6)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
regexp_parser (2.7.0)
reline (0.3.2)
regexp_parser (2.8.1)
reline (0.3.8)
io-console (~> 0.5)
rexml (3.2.5)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.1)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.2)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.3)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (1.45.1)
rspec-support (3.12.1)
rubocop (1.50.2)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.24.1, < 2.0)
rubocop-ast (>= 1.28.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.26.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.17.1)
rubocop-capybara (2.18.0)
rubocop (~> 1.41)
rubocop-performance (1.16.0)
rubocop-performance (1.17.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.18.1)
rubocop-rspec (2.20.0)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
ruby-progressbar (1.11.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
shellany (0.0.1)
spoon (0.0.6)
ffi
sys-uname (1.2.2)
sys-uname (1.2.3)
ffi (~> 1.1)
thin (1.8.1)
thin (1.8.2)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
thor (1.2.1)
timecop (0.9.6)
thor (1.2.2)
timecop (0.9.8)
timers (4.3.5)
traces (0.9.1)
traces (0.11.1)
tty-color (0.6.0)
tty-command (0.10.1)
pastel (~> 0.8)
Expand All @@ -269,7 +270,7 @@ GEM
unicode-display_width (2.4.2)
webrick (1.7.0)
yaml-lint (0.1.2)
zeitwerk (2.6.7)
zeitwerk (2.6.11)

PLATFORMS
arm64-darwin-21
Expand All @@ -292,7 +293,7 @@ DEPENDENCIES
guard-yard (~> 2.2)
httparty (~> 0.20)
irb (~> 1.4)
nokogiri (~> 1.13.9)
nokogiri (~> 1.13)
openhab-scripting!
persistent_httparty (~> 0.1)
process_exists (~> 0.2)
Expand All @@ -309,4 +310,4 @@ DEPENDENCIES
yard!

BUNDLED WITH
2.3.26
2.4.19
2 changes: 1 addition & 1 deletion lib/openhab/core/items/semantics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def add(label: nil, synonyms: "", description: "", **tags)
raise ArgumentError, "Additional options can only be specified when creating one tag"
end

synonyms = Array.wrap(synonyms).map(&:to_s).map(&:strip)
synonyms = Array.wrap(synonyms).map { |s| s.to_s.strip }

tags.map do |name, parent|
# @deprecated OH4.0.0.M4 missing registry
Expand Down
3 changes: 2 additions & 1 deletion lib/openhab/core/types/date_time_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ def <=>(other)
def coerce(other)
logger.trace("Coercing #{self} as a request from #{other.class}")
return [other, zoned_date_time] if other.respond_to?(:to_zoned_date_time)
return [DateTimeType.new(other), self] if other.respond_to?(:to_time)

[DateTimeType.new(other), self] if other.respond_to?(:to_time)
end

#
Expand Down
3 changes: 2 additions & 1 deletion lib/openhab/core/types/open_closed_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class OpenClosedType
# @return [OpenClosedType] {OPEN} if {closed?}, {CLOSED} if {open?}
def !
return CLOSED if open?
return OPEN if closed?

OPEN if closed?
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/openhab/core/types/string_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def <=>(other)
#
def coerce(other)
logger.trace("Coercing #{self} as a request from #{other.class}")
return [other.to_str, self] if other.respond_to?(:to_str)
[other.to_str, self] if other.respond_to?(:to_str)
end

# any method that exists on String gets forwarded to to_s
Expand Down
3 changes: 2 additions & 1 deletion lib/openhab/core/types/up_down_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class UpDownType
#
def !
return UP if down?
return DOWN if up?

DOWN if up?
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion lib/openhab/core_ext/java/duration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def <=>(other)
#
def coerce(other)
return [other.seconds, self] if other.is_a?(Numeric)
return [other.to_i.seconds, self] if other.is_a?(Period)

[other.to_i.seconds, self] if other.is_a?(Period)
end

{
Expand Down
2 changes: 1 addition & 1 deletion lib/openhab/core_ext/java/period.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def <=>(other)
# @return [Array, nil]
#
def coerce(other)
return [other.seconds, to_i.seconds] if other.is_a?(Numeric)
[other.seconds, to_i.seconds] if other.is_a?(Numeric)
end

{
Expand Down
2 changes: 1 addition & 1 deletion lib/openhab/osgi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def register_service(instance, *interfaces, **properties)

bundle = org.osgi.framework.FrameworkUtil.get_bundle(interfaces.first.java_class)
bundle.bundle_context.register_service(
interfaces.map(&:java_class).map(&:name).to_java(java.lang.String),
interfaces.map { |i| i.java_class.name }.to_java(java.lang.String),
instance,
java.util.Hashtable.new(properties)
)
Expand Down
2 changes: 1 addition & 1 deletion openhab-scripting.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "guard-yard", "~> 2.2"
spec.add_development_dependency "httparty", "~> 0.20"
spec.add_development_dependency "irb", "~> 1.4"
spec.add_development_dependency "nokogiri", "~> 1.13.9"
spec.add_development_dependency "nokogiri", "~> 1.13"
spec.add_development_dependency "persistent_httparty", "~> 0.1"
spec.add_development_dependency "process_exists", "~> 0.2"
spec.add_development_dependency "rake", "~> 13.0"
Expand Down
2 changes: 1 addition & 1 deletion rakelib/openhab.rake
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace :openhab do

# There can be a delay between when openHAB is running and ready to process commands
def ready?(fail_on_error: false)
return unless running?
return false unless running?

command = "#{@karaf_client} 'system:start-level'"

Expand Down
8 changes: 4 additions & 4 deletions spec/openhab/core/items/semantics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
end
group_item "LivingRoom_Light2_Bulb", tags: [Semantics::Lightbulb, "CustomTag"] do
dimmer_item "LivingRoom_Light2_Brightness", tags: [Semantics::Control, Semantics::Level]
color_item "LivingRoom_LIght2_Color", tags: [Semantics::Control, Semantics::Light]
color_item "LivingRoom_Light2_Color", tags: [Semantics::Control, Semantics::Light]
end
switch_item "LivingRoom_Motion", tag: Semantics::MotionDetector
end
Expand Down Expand Up @@ -225,7 +225,7 @@ def points(*args)
LivingRoom_Light1_Color,
LivingRoom_Light1_Custom,
LivingRoom_Light2_Brightness,
LivingRoom_LIght2_Color,
LivingRoom_Light2_Color,
LivingRoom_Motion
]
)
Expand All @@ -235,7 +235,7 @@ def points(*args)
describe "#groups" do
it "gets all groups" do
expect([LivingRoom_Light1_Custom,
LivingRoom_LIght2_Color,
LivingRoom_Light2_Color,
LivingRoom_Light1_Bulb].groups).to match_array([
gMyGroup,
gLivingRoom,
Expand All @@ -248,7 +248,7 @@ def points(*args)
describe "#all_groups" do
it "gets all groups recursively" do
expect([LivingRoom_Light1_Custom,
LivingRoom_LIght2_Color,
LivingRoom_Light2_Color,
LivingRoom_Light1_Bulb].all_groups).to match_array([
gMyGroup,
LivingRoom_Light1_Bulb,
Expand Down
2 changes: 1 addition & 1 deletion spec/openhab/core/things/thing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

describe "things" do
it "provides access to all things" do
expect(things.map(&:uid).map(&:to_s)).to include("astro:sun:home")
expect(things.map { |t| t.uid.to_s }).to include("astro:sun:home")
end

it "supports [] lookup" do
Expand Down
Loading

0 comments on commit 85b7ac0

Please sign in to comment.