summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-09-08 23:39:40 -0700
committerTim Smith <tsmith84@gmail.com>2020-09-08 23:39:40 -0700
commit979a46f33856eee18f6334396935b9025b37d221 (patch)
treeb6ec820fc30c51dada116dfa07890e3efa5a751a
parent4a288201d1290a8adf06febbdcd836d88e8da42f (diff)
downloadmixlib-log-979a46f33856eee18f6334396935b9025b37d221.tar.gz
Replace __FILE__ with __dir__ and other minor chefstyle fixes
A few new chefstyle rules to improve readability here. Signed-off-by: Tim Smith <tsmith@chef.io>
-rwxr-xr-xGemfile2
-rw-r--r--lib/mixlib/log.rb2
-rw-r--r--mixlib-log.gemspec2
-rw-r--r--spec/mixlib/log/formatter_spec.rb2
-rw-r--r--spec/spec_helper.rb2
5 files changed, 5 insertions, 5 deletions
diff --git a/Gemfile b/Gemfile
index 259b272..7fe0cf8 100755
--- a/Gemfile
+++ b/Gemfile
@@ -10,9 +10,9 @@ group :docs do
end
group :test do
+ gem "activesupport", "< 6" # this dep can be removed when we drop Ruby 2.4 support
gem "chefstyle"
gem "cucumber", "< 5" # remove the version pin when we drop Ruby 2.4 support
- gem "activesupport", "< 6" # this dep can be removed when we drop Ruby 2.4 support
gem "rake"
gem "rspec", "~> 3.7"
end
diff --git a/lib/mixlib/log.rb b/lib/mixlib/log.rb
index cfffb48..e2eb7eb 100644
--- a/lib/mixlib/log.rb
+++ b/lib/mixlib/log.rb
@@ -118,7 +118,7 @@ module Mixlib
if new_level.nil?
LEVEL_NAMES[logger.level]
else
- self.level = (new_level)
+ self.level = new_level
end
end
diff --git a/mixlib-log.gemspec b/mixlib-log.gemspec
index 3f51174..310bc2b 100644
--- a/mixlib-log.gemspec
+++ b/mixlib-log.gemspec
@@ -1,4 +1,4 @@
-$:.unshift File.expand_path("../lib", __FILE__)
+$:.unshift File.expand_path("lib", __dir__)
require "mixlib/log/version"
Gem::Specification.new do |gem|
diff --git a/spec/mixlib/log/formatter_spec.rb b/spec/mixlib/log/formatter_spec.rb
index ee7de09..d06ea51 100644
--- a/spec/mixlib/log/formatter_spec.rb
+++ b/spec/mixlib/log/formatter_spec.rb
@@ -17,7 +17,7 @@
#
require "time" unless defined?(Time.zone_offset)
-require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper"))
+require File.expand_path(File.join(__dir__, "..", "..", "spec_helper"))
RSpec.describe Mixlib::Log::Formatter do
before(:each) do
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index e8a1bb1..e48f1af 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -18,7 +18,7 @@
#
$TESTING = true
-$:.push File.join(File.dirname(__FILE__), "..", "lib")
+$:.push File.join(__dir__, "..", "lib")
require "rspec"
require "mixlib/log"