From 9385fff538eae2e97b8ed339548bfe298f8f518c Mon Sep 17 00:00:00 2001 From: Gustavo Caso Date: Thu, 5 Oct 2023 13:12:48 +0200 Subject: [PATCH] Update Rubocop todo file with the FileName offenders --- .rubocop.yml | 28 +++++++++++++ .rubocop_todo.yml | 44 ++++----------------- lib/datadog/opentelemetry/sdk/trace/span.rb | 3 +- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 1e44ecdfeea..0566b3358d9 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -437,6 +437,34 @@ Style/WordArray: Style/DoubleNegation: Enabled: false +Naming/FileName: + ExpectMatchingDefinition: true + CheckDefinitionPathHierarchy: true + Include: + - 'lib/**/*.rb' + AllowedAcronyms: + - HTTP + - MongoDB + - GRPC + - QL + - SQS + - SNS + - AWS + - OpenSearch + - AppSec + - SQL + - API + - CRuby + - GC + - OpenTelemetry + - OpenTracer + - VM + - SDK + - GraphQL + - DynamoDB + - YJIT + - IO + Lint/RedundantRequireStatement: Enabled: true Exclude: diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index e310aaf712d..fe05330f2de 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --exclude-limit 99999` -# on 2023-09-29 10:01:10 UTC using RuboCop version 1.50.2. +# on 2023-10-05 14:04:51 UTC using RuboCop version 1.44.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -36,26 +36,16 @@ Lint/MissingSuper: Metrics/BlockNesting: Max: 4 -# Offense count: 21 +# Offense count: 26 # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms. # CheckDefinitionPathHierarchyRoots: lib, spec, test, src # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS Naming/FileName: - ExpectMatchingDefinition: true - CheckDefinitionPathHierarchy: true Exclude: - - 'integration/**/Gemfile' - - 'integration/**/Rakefile' - - 'Steepfile' - - 'spec/**/*.rb' - - 'yard/**/*.rb' - - 'lib/ddtrace/**/*.rb' - - 'ext/**/*' - - 'bin/**/*' - 'lib/datadog/appsec/autoload.rb' - 'lib/datadog/core/backport.rb' - 'lib/datadog/opentelemetry/api/trace/span.rb' - - 'lib/datadog/opentracer.rb' + - 'lib/datadog/opentelemetry/sdk/trace/span.rb' - 'lib/datadog/profiling/load_native_extension.rb' - 'lib/datadog/profiling/preload.rb' - 'lib/datadog/tracing/buffer.rb' @@ -73,28 +63,11 @@ Naming/FileName: - 'lib/datadog/tracing/contrib/rails/railtie.rb' - 'lib/datadog/tracing/propagation/http.rb' - 'lib/ddtrace.rb' - AllowedAcronyms: - - HTTP - - MongoDB - - GRPC - - QL - - SQS - - SNS - - AWS - - OpenSearch - - AppSec - - SQL - - API - - CRuby - - GC - - OpenTelemetry - - OpenTracer - - VM - - SDK - - GraphQL - - DynamoDB - - YJIT - - IO + - 'lib/ddtrace/auto_instrument.rb' + - 'lib/ddtrace/auto_instrument_base.rb' + - 'lib/ddtrace/profiling/preload.rb' + - 'lib/ddtrace/transport/ext.rb' + - 'lib/ddtrace/version.rb' # Offense count: 3 # This cop supports unsafe autocorrection (--autocorrect-all). @@ -142,7 +115,6 @@ RSpec/RepeatedExampleGroupDescription: - 'spec/datadog/tracing/contrib/redis/quantize_spec.rb' # Offense count: 40 -# This cop supports safe autocorrection (--autocorrect). RSpec/ScatteredSetup: Exclude: - 'spec/datadog/opentracer/span_spec.rb' diff --git a/lib/datadog/opentelemetry/sdk/trace/span.rb b/lib/datadog/opentelemetry/sdk/trace/span.rb index a366cccc62f..bf001263977 100644 --- a/lib/datadog/opentelemetry/sdk/trace/span.rb +++ b/lib/datadog/opentelemetry/sdk/trace/span.rb @@ -39,7 +39,8 @@ def status=(s) private def datadog_set_attribute(key) - return unless defined?(@attributes) && @attributes # Return if attributes are currently disabled by OpenTelemetry. + # Return if attributes are currently disabled by OpenTelemetry. + return unless defined?(@attributes) && @attributes return unless (span = datadog_span) # DEV: Accesses `@attributes` directly, since using `#attributes`