Skip to content

Commit b230191

Browse files
plantfansamfbogsanyrobertlaurin
authored
fix: get API onto rubocop 1.3 (#1323)
* fix: get API onto rubocop 1.3 * go back to string concat * move back to single quotes * delete unneccessary disable * Update api/lib/opentelemetry/baggage/propagation/text_map_propagator.rb Co-authored-by: Francis Bogsanyi <[email protected]> Co-authored-by: Robert <[email protected]>
1 parent 5e046c0 commit b230191

File tree

9 files changed

+18
-10
lines changed

9 files changed

+18
-10
lines changed

api/.rubocop.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,13 @@ Metrics/ParameterLists:
1414
Naming/FileName:
1515
Exclude:
1616
- "lib/opentelemetry-api.rb"
17+
Lint/MissingSuper:
18+
Enabled: false
19+
Lint/ConstantDefinitionInBlock:
20+
Exclude:
21+
- "test/**/*"
22+
Style/StringConcatenation:
23+
Exclude:
24+
- "test/**/*"
1725
Style/ModuleFunction:
1826
Enabled: false

api/lib/opentelemetry.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module OpenTelemetry
2828

2929
# @return [Object, Logger] configured Logger or a default STDOUT Logger.
3030
def logger
31-
@logger ||= Logger.new(STDOUT, level: ENV['OTEL_LOG_LEVEL'] || Logger::INFO)
31+
@logger ||= Logger.new($stdout, level: ENV['OTEL_LOG_LEVEL'] || Logger::INFO)
3232
end
3333

3434
# @return [Callable] configured error handler or a default that logs the

api/lib/opentelemetry/context/propagation/composite_text_map_propagator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module Propagation
1414
# initialization.
1515
class CompositeTextMapPropagator
1616
class << self
17-
private :new # rubocop:disable Style/AccessModifierDeclarations
17+
private :new
1818

1919
# Returns a Propagator that extracts using the provided extractors
2020
# and injectors.

api/lib/opentelemetry/context/propagation/rack_env_getter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ def keys(carrier)
3232
private
3333

3434
def to_rack_key(key)
35-
ret = 'HTTP_' + key
35+
ret = 'HTTP_' + key # rubocop:disable Style/StringConcatenation
3636
ret.tr!('-', '_')
3737
ret.upcase!
3838
ret
3939
end
4040

4141
def from_rack_key(key)
4242
start = key.start_with?('HTTP_') ? 5 : 0
43-
ret = key[start..-1]
43+
ret = key[start..]
4444
ret.tr!('_', '-')
4545
ret.downcase!
4646
ret

api/lib/opentelemetry/trace/status.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Trace
1010
# status code in conjunction with an optional descriptive message.
1111
class Status
1212
class << self
13-
private :new # rubocop:disable Style/AccessModifierDeclarations
13+
private :new
1414

1515
# Returns a newly created {Status} with code == UNSET and an optional
1616
# description.

api/lib/opentelemetry/trace/trace_flags.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module Trace
1111
# boolean {sampled?} {https://www.w3.org/TR/trace-context/#trace-flags flag}.
1212
class TraceFlags
1313
class << self
14-
private :new # rubocop:disable Style/AccessModifierDeclarations
14+
private :new
1515

1616
# Returns a newly created {TraceFlags} with the specified flags.
1717
#

api/lib/opentelemetry/trace/tracer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class Tracer
2323
# span and reraised.
2424
# @yield [span, context] yields the newly created span and a context containing the
2525
# span to the block.
26-
def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil)
26+
def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil, &block)
2727
span = nil
2828
span = start_span(name, attributes: attributes, links: links, start_timestamp: start_timestamp, kind: kind)
29-
Trace.with_span(span) { |s, c| yield s, c }
29+
Trace.with_span(span, &block)
3030
rescue Exception => e # rubocop:disable Lint/RescueException
3131
span&.record_exception(e)
3232
span&.status = Status.error("Unhandled exception of type: #{e.class}")

api/lib/opentelemetry/trace/tracestate.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module Trace
1111
# specification https://www.w3.org/TR/trace-context/
1212
class Tracestate
1313
class << self
14-
private :new # rubocop:disable Style/AccessModifierDeclarations
14+
private :new
1515

1616
# Returns a newly created Tracestate parsed from the header provided.
1717
#

api/opentelemetry-api.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
3131
spec.add_development_dependency 'minitest', '~> 5.0'
3232
spec.add_development_dependency 'opentelemetry-test-helpers'
3333
spec.add_development_dependency 'rake', '~> 12.0'
34-
spec.add_development_dependency 'rubocop', '~> 0.73.0'
34+
spec.add_development_dependency 'rubocop', '~> 1.30'
3535
spec.add_development_dependency 'simplecov', '~> 0.17'
3636
spec.add_development_dependency 'yard', '~> 0.9'
3737
spec.add_development_dependency 'yard-doctest', '~> 0.1.6'

0 commit comments

Comments
 (0)