Skip to content

Commit

Permalink
Merge pull request #3187 from DataDog/fix-file-name-constant-missmatch
Browse files Browse the repository at this point in the history
Update rubocop and rubocop_todo configuration for Naming/FileName
  • Loading branch information
anmarchenko authored Oct 5, 2023
2 parents f34efe7 + 9385fff commit 6795298
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 37 deletions.
28 changes: 28 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
44 changes: 8 additions & 36 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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'
Expand All @@ -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).
Expand Down Expand Up @@ -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'
Expand Down
3 changes: 2 additions & 1 deletion lib/datadog/opentelemetry/sdk/trace/span.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit 6795298

Please sign in to comment.