Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rubocop and rubocop_todo configuration for Naming/FileName #3187

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading