Skip to content

Commit

Permalink
linter appeasement
Browse files Browse the repository at this point in the history
  • Loading branch information
jamis committed Jan 11, 2024
1 parent 4de937c commit a38599e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ Layout/SpaceInsideArrayLiteralBrackets:
Layout/SpaceInsidePercentLiteralDelimiters:
Enabled: false

Metrics/ClassLength:
Max: 200

Metrics/ModuleLength:
Enabled: false

Expand Down
14 changes: 7 additions & 7 deletions lib/mongo/server/app_metadata/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ValueTooLong < Mongo::Error; end

# The name and location of the .dockerenv file that will signal the
# presence of Docker.
DOCKERENV_PATH = '/.dockerenv'.freeze
DOCKERENV_PATH = '/.dockerenv'

# This value is not explicitly specified in the spec, only implied to be
# less than 512.
Expand Down Expand Up @@ -223,11 +223,11 @@ def detect_container
runtime = docker_present? && 'docker'
orchestrator = kubernetes_present? && 'kubernetes'

if runtime || orchestrator
fields[:container] = {}
fields[:container][:runtime] = runtime if runtime
fields[:container][:orchestrator] = orchestrator if orchestrator
end
return unless runtime || orchestrator

fields[:container] = {}
fields[:container][:runtime] = runtime if runtime
fields[:container][:orchestrator] = orchestrator if orchestrator
end

# Checks for the existence of a .dockerenv in the root directory.
Expand All @@ -244,7 +244,7 @@ def dockerenv_path
# Checks for the presence of a non-empty KUBERNETES_SERVICE_HOST
# environment variable.
def kubernetes_present?
ENV['KUBERNETES_SERVICE_HOST'].to_s.length > 0
!ENV['KUBERNETES_SERVICE_HOST'].to_s.empty?
end

# Determines whether the named environment variable exists, and (if
Expand Down
1 change: 1 addition & 0 deletions spec/mongo/server/app_metadata/environment_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true
# rubocop:todo all

require 'spec_helper'
require 'fileutils'
Expand Down

0 comments on commit a38599e

Please sign in to comment.