Skip to content

Commit

Permalink
Disable abcsize rubocop rule globally (#1329)
Browse files Browse the repository at this point in the history
* disable abcsize globally
  • Loading branch information
plantfansam committed Jun 23, 2022
1 parent 59a8cde commit 05d8904
Show file tree
Hide file tree
Showing 38 changed files with 57 additions and 35 deletions.
2 changes: 1 addition & 1 deletion api/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ AllCops:
Lint/UnusedMethodArgument:
Enabled: false
Metrics/AbcSize:
Max: 18
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Expand Down
2 changes: 2 additions & 0 deletions api/test/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ inherit_from: ../.rubocop.yml

Metrics/BlockLength:
Enabled: false
Metrics/AbcSize:
Enabled: false
2 changes: 1 addition & 1 deletion common/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Bundler/OrderedGems:
Lint/UnusedMethodArgument:
Enabled: false
Metrics/AbcSize:
Max: 18
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Expand Down
2 changes: 1 addition & 1 deletion exporter/jaeger/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ AllCops:
Lint/UnusedMethodArgument:
Enabled: false
Metrics/AbcSize:
Max: 18
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def encoded_tag(key, value)
)
end

def encoded_span(span_data) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
def encoded_span(span_data) # rubocop:disable Metrics/MethodLength
start_time = span_data.start_timestamp / 1_000
duration = span_data.end_timestamp / 1_000 - start_time

Expand Down
2 changes: 2 additions & 0 deletions exporter/jaeger/test/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
inherit_from: ../.rubocop.yml

Metrics/AbcSize:
Max: 18
Metrics/BlockLength:
Enabled: false
Metrics/LineLength:
Expand Down
2 changes: 1 addition & 1 deletion exporter/otlp-common/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ AllCops:
Lint/UnusedMethodArgument:
Enabled: false
Metrics/AbcSize:
Max: 18
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def as_etsr(span_data) # rubocop:disable Metrics/MethodLength

private

def as_otlp_span(span_data) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
def as_otlp_span(span_data) # rubocop:disable Metrics/MethodLength
Opentelemetry::Proto::Trace::V1::Span.new(
trace_id: span_data.trace_id,
span_id: span_data.span_id,
Expand Down
2 changes: 2 additions & 0 deletions exporter/otlp-common/test/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
inherit_from: ../.rubocop.yml

Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/LineLength:
Expand Down
2 changes: 1 addition & 1 deletion exporter/otlp-grpc/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ AllCops:
Lint/UnusedMethodArgument:
Enabled: false
Metrics/AbcSize:
Max: 18
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Expand Down
2 changes: 2 additions & 0 deletions exporter/otlp-grpc/test/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
inherit_from: ../.rubocop.yml

Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/LineLength:
Expand Down
2 changes: 1 addition & 1 deletion exporter/otlp-http/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ AllCops:
Lint/UnusedMethodArgument:
Enabled: false
Metrics/AbcSize:
Max: 18
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def around_request
OpenTelemetry::Common::Utilities.untraced { yield }
end

def send_bytes(bytes, timeout:) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
def send_bytes(bytes, timeout:) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
return FAILURE if bytes.nil?

retry_count = 0
Expand Down
2 changes: 2 additions & 0 deletions exporter/otlp-http/test/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
inherit_from: ../.rubocop.yml

Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/LineLength:
Expand Down
2 changes: 1 addition & 1 deletion exporter/otlp/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ AllCops:
Lint/UnusedMethodArgument:
Enabled: false
Metrics/AbcSize:
Max: 18
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Expand Down
6 changes: 3 additions & 3 deletions exporter/otlp/lib/opentelemetry/exporter/otlp/exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def around_request
OpenTelemetry::Common::Utilities.untraced { yield }
end

def send_bytes(bytes, timeout:) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
def send_bytes(bytes, timeout:) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
return FAILURE if bytes.nil?

@metrics_reporter.record_value('otel.otlp_exporter.message.uncompressed_size', value: bytes.bytesize)
Expand Down Expand Up @@ -270,7 +270,7 @@ def backoff?(retry_after: nil, retry_count:, reason:)
true
end

def encode(span_data) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
def encode(span_data) # rubocop:disable Metrics/MethodLength
Opentelemetry::Proto::Collector::Trace::V1::ExportTraceServiceRequest.encode(
Opentelemetry::Proto::Collector::Trace::V1::ExportTraceServiceRequest.new(
resource_spans: span_data
Expand Down Expand Up @@ -300,7 +300,7 @@ def encode(span_data) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
nil
end

def as_otlp_span(span_data) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
def as_otlp_span(span_data) # rubocop:disable Metrics/MethodLength
Opentelemetry::Proto::Trace::V1::Span.new(
trace_id: span_data.trace_id,
span_id: span_data.span_id,
Expand Down
2 changes: 2 additions & 0 deletions exporter/otlp/test/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
inherit_from: ../.rubocop.yml

Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/LineLength:
Expand Down
2 changes: 1 addition & 1 deletion exporter/zipkin/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ AllCops:
Lint/UnusedMethodArgument:
Enabled: false
Metrics/AbcSize:
Max: 29
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/ModuleLength:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def valid_headers?(headers)
false
end

def send_spans(zipkin_spans, timeout: nil) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
def send_spans(zipkin_spans, timeout: nil) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength
retry_count = 0
timeout ||= @timeout
start_time = OpenTelemetry::Common::Utilities.timeout_timestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def add_status_tags(span_data, tags)
end
end

def add_conditional_tags(zipkin_span, span_data, tags, service_name) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
def add_conditional_tags(zipkin_span, span_data, tags, service_name) # rubocop:disable Metrics/CyclomaticComplexity
dropped_attributes_count = span_data.total_recorded_attributes - span_data.attributes&.size.to_i
dropped_events_count = span_data.total_recorded_events - span_data.events&.size.to_i
dropped_links_count = span_data.total_recorded_links - span_data.links&.size.to_i
Expand Down
2 changes: 2 additions & 0 deletions exporter/zipkin/test/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
inherit_from: ../.rubocop.yml

Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/LineLength:
Expand Down
2 changes: 1 addition & 1 deletion metrics_api/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ AllCops:
Lint/UnusedMethodArgument:
Enabled: false
Metrics/AbcSize:
Max: 30
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Expand Down
2 changes: 2 additions & 0 deletions metrics_api/test/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ Metrics/BlockLength:
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/AbcSize:
Enabled: false
2 changes: 1 addition & 1 deletion propagator/b3/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ AllCops:
Lint/UnusedMethodArgument:
Enabled: false
Metrics/AbcSize:
Max: 18
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Expand Down
2 changes: 2 additions & 0 deletions propagator/b3/test/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ inherit_from: ../.rubocop.yml

Metrics/BlockLength:
Enabled: false
Metrics/AbcSize:
Enabled: false
2 changes: 1 addition & 1 deletion propagator/jaeger/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ AllCops:
Lint/UnusedMethodArgument:
Enabled: false
Metrics/AbcSize:
Max: 18
Enabled: false
Metrics/BlockLength:
Exclude:
- 'opentelemetry-propagator-jaeger.gemspec'
Expand Down
4 changes: 1 addition & 3 deletions registry/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ Bundler/OrderedGems:
Lint/UnusedMethodArgument:
Enabled: false
Metrics/AbcSize:
Max: 18
Exclude:
- "**/test/**/*"
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Expand Down
2 changes: 2 additions & 0 deletions registry/test/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ inherit_from: ../.rubocop.yml

Metrics/BlockLength:
Enabled: false
Metrics/AbcSize:
Enabled: false
2 changes: 1 addition & 1 deletion sdk/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ AllCops:
Lint/UnusedMethodArgument:
Enabled: false
Metrics/AbcSize:
Max: 18
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Expand Down
4 changes: 2 additions & 2 deletions sdk/lib/opentelemetry/sdk/configurator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def configure_span_processors
processors.each { |p| tracer_provider.add_span_processor(p) }
end

def wrapped_exporters_from_env # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize
def wrapped_exporters_from_env # rubocop:disable Metrics/CyclomaticComplexity
exporters = ENV.fetch('OTEL_TRACES_EXPORTER', 'otlp')
exporters.split(',').map do |exporter|
case exporter.strip
Expand All @@ -193,7 +193,7 @@ def wrapped_exporters_from_env # rubocop:disable Metrics/CyclomaticComplexity, M
end
end

def configure_propagation # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize
def configure_propagation # rubocop:disable Metrics/CyclomaticComplexity
propagators = ENV.fetch('OTEL_PROPAGATORS', 'tracecontext,baggage').split(',').uniq.collect do |propagator|
case propagator
when 'tracecontext' then OpenTelemetry::Trace::Propagation::TraceContext.text_map_propagator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def initialize(exporter,
def on_start(_span, _parent_context); end

# Adds a span to the batch. Thread-safe; may block on lock.
def on_finish(span) # rubocop:disable Metrics/AbcSize
def on_finish(span)
return unless span.context.trace_flags.sampled?

lock do
Expand All @@ -100,7 +100,7 @@ def on_finish(span) # rubocop:disable Metrics/AbcSize
# @param [optional Numeric] timeout An optional timeout in seconds.
# @return [Integer] SUCCESS if no error occurred, FAILURE if a
# non-specific failure occurred, TIMEOUT if a timeout occurred.
def force_flush(timeout: nil) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
def force_flush(timeout: nil) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
start_time = OpenTelemetry::Common::Utilities.timeout_timestamp
snapshot = lock do
reset_on_fork if @keep_running
Expand Down Expand Up @@ -155,7 +155,7 @@ def shutdown(timeout: nil)

attr_reader :spans, :max_queue_size, :batch_size

def work # rubocop:disable Metrics/AbcSize
def work
loop do
batch = lock do
@condition.wait(@mutex, @delay_seconds) if spans.size < batch_size && @keep_running
Expand Down
6 changes: 3 additions & 3 deletions sdk/lib/opentelemetry/sdk/trace/span.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def to_span_data
end

# @api private
def initialize(context, parent_context, parent_span, name, kind, parent_span_id, span_limits, span_processors, attributes, links, start_timestamp, resource, instrumentation_library) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
def initialize(context, parent_context, parent_span, name, kind, parent_span_id, span_limits, span_processors, attributes, links, start_timestamp, resource, instrumentation_library) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
super(span_context: context)
@mutex = Mutex.new
@name = name
Expand Down Expand Up @@ -357,7 +357,7 @@ def truncate_attribute_values(attrs)
attrs
end

def trim_links(links, link_count_limit, link_attribute_count_limit) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def trim_links(links, link_count_limit, link_attribute_count_limit) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
# Fast path (likely) common cases.
return nil if links.nil?

Expand All @@ -379,7 +379,7 @@ def trim_links(links, link_count_limit, link_attribute_count_limit) # rubocop:di
end.freeze
end

def append_event(events, event) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def append_event(events, event) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
event_count_limit = @span_limits.event_count_limit
event_attribute_count_limit = @span_limits.event_attribute_count_limit
valid_attributes = Internal.valid_attributes?(name, 'event', event.attributes)
Expand Down
2 changes: 1 addition & 1 deletion sdk/lib/opentelemetry/sdk/trace/span_limits.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SpanLimits
#
# @return [SpanLimits] with the desired values.
# @raise [ArgumentError] if any of the max numbers are not positive.
def initialize(attribute_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT', 'OTEL_ATTRIBUTE_COUNT_LIMIT', default: 128)), # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def initialize(attribute_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT', 'OTEL_ATTRIBUTE_COUNT_LIMIT', default: 128)), # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
attribute_length_limit: OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT', 'OTEL_RUBY_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT', 'OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT'),
event_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_EVENT_COUNT_LIMIT', default: 128)),
link_count_limit: Integer(OpenTelemetry::Common::Utilities.config_opt('OTEL_SPAN_LINK_COUNT_LIMIT', default: 128)),
Expand Down
2 changes: 1 addition & 1 deletion sdk/lib/opentelemetry/sdk/trace/tracer_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def add_span_processor(span_processor)
end

# @api private
def internal_create_span(name, kind, attributes, links, start_timestamp, parent_context, instrumentation_library) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
def internal_create_span(name, kind, attributes, links, start_timestamp, parent_context, instrumentation_library) # rubocop:disable Metrics/MethodLength
parent_span = OpenTelemetry::Trace.current_span(parent_context)
parent_span_context = parent_span.context

Expand Down
2 changes: 2 additions & 0 deletions sdk/test/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ Metrics/BlockLength:
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/AbcSize:
Enabled: false
2 changes: 1 addition & 1 deletion semantic_conventions/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Bundler/OrderedGems:
Lint/UnusedMethodArgument:
Enabled: false
Metrics/AbcSize:
Max: 18
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Expand Down
2 changes: 1 addition & 1 deletion test_helpers/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ AllCops:
Lint/UnusedMethodArgument:
Enabled: false
Metrics/AbcSize:
Max: 18
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Expand Down
2 changes: 2 additions & 0 deletions test_helpers/test/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
inherit_from: ../.rubocop.yml

Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/LineLength:
Expand Down

0 comments on commit 05d8904

Please sign in to comment.