From 67e0807eab519047bea381db846fa3054ce5768a Mon Sep 17 00:00:00 2001 From: Matt Schreiber Date: Wed, 20 Jan 2016 21:49:01 -0500 Subject: [PATCH] Updated .rubocop.yml to fix Style/TrailingComma deprecation error and fixed rubocop errors --- .rubocop.yml | 5 ++++- lib/bashcov/lexer.rb | 6 +++--- lib/bashcov/runner.rb | 5 ++++- lib/bashcov/xtrace.rb | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 4946433..e5abdb7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -23,5 +23,8 @@ Style/SpecialGlobalVars: Style/StringLiterals: EnforcedStyle: double_quotes -Style/TrailingComma: +Style/TrailingCommaInLiteral: + Enabled: false + +Style/TrailingCommaInArguments: Enabled: false diff --git a/lib/bashcov/lexer.rb b/lib/bashcov/lexer.rb index 517ffbc..9f69777 100644 --- a/lib/bashcov/lexer.rb +++ b/lib/bashcov/lexer.rb @@ -3,13 +3,13 @@ module Bashcov # coverage class Lexer # Lines starting with one of these tokens are irrelevant for coverage - IGNORE_START_WITH = %w(# function) + IGNORE_START_WITH = %w(# function).freeze # Lines ending with one of these tokens are irrelevant for coverage - IGNORE_END_WITH = %w|(| + IGNORE_END_WITH = %w|(|.freeze # Lines containing only one of these keywords are irrelevant for coverage - IGNORE_IS = %w(esac if then else elif fi while do done { } ;;) + IGNORE_IS = %w(esac if then else elif fi while do done { } ;;).freeze # @param [String] filename File to analyze # @param [Hash] coverage Coverage with executed lines marked diff --git a/lib/bashcov/runner.rb b/lib/bashcov/runner.rb index 3ea5856..f84d55d 100644 --- a/lib/bashcov/runner.rb +++ b/lib/bashcov/runner.rb @@ -15,7 +15,10 @@ def run @xtrace = Xtrace.new fd = @xtrace.file_descriptor options = { :in => :in, fd => fd } # bind FDs to the child process - options.merge!(out: "/dev/null", err: "/dev/null") if Bashcov.options.mute + if Bashcov.options.mute + options[:out] = "/dev/null" + options[:err] = "/dev/null" + end env = { "BASH_XTRACEFD" => fd.to_s, "PS4" => Xtrace::PS4 } command_pid = Process.spawn env, @command, options # spawn the command diff --git a/lib/bashcov/xtrace.rb b/lib/bashcov/xtrace.rb index 2d07df2..b6cb636 100644 --- a/lib/bashcov/xtrace.rb +++ b/lib/bashcov/xtrace.rb @@ -8,10 +8,10 @@ module Bashcov class Xtrace # [String] Character that will be used to indicate the nesting level of # +xtrace+d instructions - DEPTH_CHAR = "+" + DEPTH_CHAR = "+".freeze # [String] Prefix used in +PS4+ to identify relevant output - PREFIX = "BASHCOV>" + PREFIX = "BASHCOV>".freeze # [String] A randomly-generated token for delimiting the fields of the # +{PS4}+