Skip to content

Commit 4a6c96d

Browse files
authored
Merge pull request #147 from mvidner/propget-error-mention-propname
Mention qualified property name in Get or Set errors
2 parents 1ccf16b + 160b673 commit 4a6c96d

21 files changed

+275
-60
lines changed

.github/workflows/ruby.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,17 @@ jobs:
2929
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
3030

3131
- name: Run tests
32-
run: bundle exec rake
32+
run: bundle exec rake spec
3333
# enable code coverage reporting
3434
env:
3535
COVERAGE: 'true'
3636
COVERAGE_LCOV: 'true'
3737

38+
- name: Run RuboCop
39+
# only for latest version, it is dropping Ruby support fster than us
40+
if: ${{ matrix.ruby-version == '3.4' }}
41+
run: bundle exec rake rubocop
42+
3843
- name: Coveralls Report
3944
# send it only for the latest version to avoid duplicate submits
4045
if: ${{ matrix.ruby-version == '3.4' }}

.rubocop.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
inherit_from: .rubocop_todo.yml
2+
13
AllCops:
24
TargetRubyVersion: 2.4
5+
SuggestExtensions: false
6+
NewCops: enable
37
Exclude:
48
# Do not check code borrowed from ActiveSupport
59
- 'lib/dbus/core_ext/**/*.rb'
@@ -73,6 +77,11 @@ Lint/RescueException:
7377
Naming/PredicateName:
7478
NamePrefix:
7579
# has_ and have_ are allowed
80+
- does_
81+
- is_
82+
ForbiddenPrefixes:
83+
# has_ and have_ are allowed
84+
- does_
7685
- is_
7786

7887
# Offense count: 1

.rubocop_todo.yml

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2025-04-03 13:59:12 UTC using RuboCop version 1.68.0.
4+
# The point is for the user to remove these configuration records
5+
# one by one as the offenses are removed from the code base.
6+
# Note that changes in the inspected code, or installation of new
7+
# versions of RuboCop, may require this file to be generated again.
8+
9+
# Offense count: 2
10+
# This cop supports safe autocorrection (--autocorrect).
11+
# Configuration parameters: Include.
12+
# Include: **/*.gemspec
13+
Gemspec/AddRuntimeDependency:
14+
Exclude:
15+
- 'ruby-dbus.gemspec'
16+
17+
# Offense count: 8
18+
# Configuration parameters: EnforcedStyle, AllowedGems, Include.
19+
# SupportedStyles: Gemfile, gems.rb, gemspec
20+
# Include: **/*.gemspec, **/Gemfile, **/gems.rb
21+
Gemspec/DevelopmentDependencies:
22+
Exclude:
23+
- 'ruby-dbus.gemspec'
24+
25+
# Offense count: 1
26+
# This cop supports safe autocorrection (--autocorrect).
27+
# Configuration parameters: Severity, Include.
28+
# Include: **/*.gemspec
29+
Gemspec/RequireMFA:
30+
Exclude:
31+
- 'ruby-dbus.gemspec'
32+
33+
# Offense count: 3
34+
# Configuration parameters: AllowComments, AllowEmptyLambdas.
35+
Lint/EmptyBlock:
36+
Exclude:
37+
- 'examples/utils/notify.rb'
38+
- 'spec/object_spec.rb'
39+
- 'spec/signal_spec.rb'
40+
41+
# Offense count: 1
42+
# This cop supports unsafe autocorrection (--autocorrect-all).
43+
Lint/IncompatibleIoSelectWithFiberScheduler:
44+
Exclude:
45+
- 'lib/dbus/message_queue.rb'
46+
47+
# Offense count: 3
48+
# This cop supports unsafe autocorrection (--autocorrect-all).
49+
Style/EnvHome:
50+
Exclude:
51+
- 'examples/no-introspect/tracker-test.rb'
52+
- 'lib/dbus/auth.rb'
53+
- 'lib/dbus/bus.rb'
54+
55+
# Offense count: 10
56+
# This cop supports safe autocorrection (--autocorrect).
57+
# Configuration parameters: AllowedVars.
58+
Style/FetchEnvVar:
59+
Exclude:
60+
- 'examples/no-introspect/tracker-test.rb'
61+
- 'lib/dbus/auth.rb'
62+
- 'lib/dbus/bus.rb'
63+
- 'lib/dbus/logger.rb'
64+
- 'spec/connection_spec.rb'
65+
- 'spec/coverage_helper.rb'
66+
- 'spec/session_bus_spec.rb'
67+
- 'spec/spec_helper.rb'
68+
69+
# Offense count: 1
70+
# This cop supports unsafe autocorrection (--autocorrect-all).
71+
# Configuration parameters: AllowSplatArgument.
72+
Style/HashConversion:
73+
Exclude:
74+
- 'lib/dbus/data.rb'
75+
76+
# Offense count: 1
77+
# This cop supports unsafe autocorrection (--autocorrect-all).
78+
Style/MapIntoArray:
79+
Exclude:
80+
- 'lib/dbus/marshall.rb'
81+
82+
# Offense count: 1
83+
# This cop supports unsafe autocorrection (--autocorrect-all).
84+
Style/MinMaxComparison:
85+
Exclude:
86+
- 'lib/dbus/auth.rb'
87+
88+
# Offense count: 2
89+
# This cop supports safe autocorrection (--autocorrect).
90+
Style/NegatedIfElseCondition:
91+
Exclude:
92+
- 'lib/dbus/connection.rb'
93+
94+
# Offense count: 3
95+
Style/OpenStructUse:
96+
Exclude:
97+
- 'spec/packet_marshaller_spec.rb'
98+
- 'spec/packet_unmarshaller_spec.rb'
99+
- 'spec/property_spec.rb'
100+
101+
# Offense count: 5
102+
# This cop supports unsafe autocorrection (--autocorrect-all).
103+
# Configuration parameters: Methods.
104+
Style/RedundantArgument:
105+
Exclude:
106+
- 'lib/dbus/auth.rb'
107+
- 'lib/dbus/introspect.rb'
108+
- 'lib/dbus/object.rb'
109+
110+
# Offense count: 4
111+
# This cop supports safe autocorrection (--autocorrect).
112+
Style/RedundantConstantBase:
113+
Exclude:
114+
- 'spec/data_spec.rb'
115+
116+
# Offense count: 1
117+
# This cop supports unsafe autocorrection (--autocorrect-all).
118+
Style/RedundantEach:
119+
Exclude:
120+
- 'spec/type_spec.rb'
121+
122+
# Offense count: 3
123+
# This cop supports safe autocorrection (--autocorrect).
124+
Style/RedundantRegexpArgument:
125+
Exclude:
126+
- 'examples/service/service_newapi.rb'
127+
- 'lib/dbus/object.rb'
128+
- 'spec/mock-service/spaghetti-monster.rb'
129+
130+
# Offense count: 2
131+
# This cop supports unsafe autocorrection (--autocorrect-all).
132+
Style/StringChars:
133+
Exclude:
134+
- 'examples/service/service_newapi.rb'
135+
- 'spec/mock-service/spaghetti-monster.rb'
136+
137+
# Offense count: 6
138+
# This cop supports safe autocorrection (--autocorrect).
139+
Style/SuperArguments:
140+
Exclude:
141+
- 'examples/service/complex-property.rb'
142+
- 'lib/dbus/data.rb'
143+
- 'lib/dbus/introspect.rb'
144+
- 'spec/mock-service/spaghetti-monster.rb'
145+
146+
# Offense count: 2
147+
# This cop supports safe autocorrection (--autocorrect).
148+
Style/SuperWithArgsParentheses:
149+
Exclude:
150+
- 'lib/dbus/object.rb'
151+
- 'spec/mock-service/spaghetti-monster.rb'

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
source "https://rubygems.org"
55
gemspec
66

7+
gem "rubocop", "~> 1.68.0" if RUBY_VERSION >= "2.7"
8+
# newer versions have a noise deprecation warning
9+
gem "rubocop-ast", "~> 1.36.0" if RUBY_VERSION >= "2.7"
10+
711
group :test do
812
# Optional dependency, we do want to test with it
913
gem "nokogiri"

NEWS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
## Unreleased
44

5+
## Ruby D-Bus 0.25.0 - 2025-04-03
6+
7+
Bug fixes:
8+
* Mention qualified property name in Get or Set errors ([#147][]).
9+
* Fix declaring logger and ostruct gems for Ruby 3.5
10+
11+
[#147]: https://github.com/mvidner/ruby-dbus/pull/147
12+
513
## Ruby D-Bus 0.24.0 - 2025-01-02
614

715
Bug fixes:

Rakefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
require "rake"
55
require "fileutils"
66
require "tmpdir"
7-
require "rspec/core/rake_task"
7+
require "shellwords"
88
begin
99
require "rubocop/rake_task"
1010
rescue LoadError
@@ -34,13 +34,18 @@ desc "Default: run specs in the proper environment"
3434
task default: [:spec, :rubocop]
3535
task test: :spec
3636

37-
RSpec::Core::RakeTask.new("bare:spec")
37+
desc "Run RSpec code examples"
38+
task "bare:spec", [:options] do |_t, args|
39+
args.with_defaults(options: "")
40+
sh "rspec #{args[:options]}"
41+
end
3842

3943
["spec"].each do |tname|
4044
desc "Run bare:#{tname} in the proper environment"
41-
task tname do |_t|
45+
task tname, [:options] do |_t, args|
46+
args.with_defaults(options: "")
4247
cd "spec/tools" do
43-
sh "./test_env rake bare:#{tname}"
48+
sh "./test_env rake bare:#{tname}[#{args[:options].shellescape}]"
4449
end
4550
end
4651
end

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.24.0
1+
0.25.0

lib/dbus/logger.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module DBus
1717
# The default one logs to STDERR,
1818
# with DEBUG if $DEBUG is set, otherwise INFO.
1919
def logger
20-
if @logger.nil?
20+
if !defined?(@logger) || @logger.nil?
2121
debug = $DEBUG || ENV["RUBY_DBUS_DEBUG"]
2222
@logger = Logger.new($stderr)
2323
@logger.level = debug ? Logger::DEBUG : Logger::INFO

lib/dbus/marshall.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def num_align(num, alignment)
180180
case alignment
181181
when 1, 2, 4, 8
182182
bits = alignment - 1
183-
num + bits & ~bits
183+
(num + bits) & ~bits
184184
else
185185
raise ArgumentError, "Unsupported alignment #{alignment}"
186186
end

lib/dbus/message.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ def initialize(mtype = INVALID)
103103

104104
def to_s
105105
"#{message_type} sender=#{sender} -> dest=#{destination} " \
106-
"serial=#{serial} reply_serial=#{reply_serial} " \
107-
"path=#{path}; interface=#{interface}; member=#{member} " \
108-
"error_name=#{error_name}"
106+
"serial=#{serial} reply_serial=#{reply_serial} " \
107+
"path=#{path}; interface=#{interface}; member=#{member} " \
108+
"error_name=#{error_name}"
109109
end
110110

111111
# @return [String] name of message type, as used in match rules:

0 commit comments

Comments
 (0)