From 979a46f33856eee18f6334396935b9025b37d221 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Tue, 8 Sep 2020 23:39:40 -0700 Subject: Replace __FILE__ with __dir__ and other minor chefstyle fixes A few new chefstyle rules to improve readability here. Signed-off-by: Tim Smith --- Gemfile | 2 +- lib/mixlib/log.rb | 2 +- mixlib-log.gemspec | 2 +- spec/mixlib/log/formatter_spec.rb | 2 +- spec/spec_helper.rb | 2 +- 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" -- cgit v1.2.1