diff --git a/lib/salus/scanners/pattern_search.rb b/lib/salus/scanners/pattern_search.rb index 340b5ae4..86f0a691 100644 --- a/lib/salus/scanners/pattern_search.rb +++ b/lib/salus/scanners/pattern_search.rb @@ -38,7 +38,8 @@ def run match_exclude_directory_flags = flag_list( '--exclude-dirs', match['exclude_directory'] ) - match_exclude_extension_flags = extension_flag('--exclude-ext', match['exclude_extension']) + match_exclude_extension_flags = extension_flag('--exclude-ext', \ + match['exclude_extension']) match_include_extension_flags = extension_flag('--ext', match['include_extension']) command_string = [ @@ -114,9 +115,9 @@ def should_run? private def extension_flag(flag, file_extensions) - if file_extensions.nil? or flag.nil? + if file_extensions.nil? || flag.nil? nil - elsif file_extensions.empty? or flag.empty? + elsif file_extensions.empty? || flag.empty? "" else flag << '=' diff --git a/spec/lib/salus/scanners/pattern_search_spec.rb b/spec/lib/salus/scanners/pattern_search_spec.rb index 355d8258..dadcc033 100644 --- a/spec/lib/salus/scanners/pattern_search_spec.rb +++ b/spec/lib/salus/scanners/pattern_search_spec.rb @@ -202,7 +202,7 @@ 'matches' => [ { regex: 'UN' }, { 'regex' => 'lance', 'forbidden' => true }, - { regex: 'fancy'} + { regex: 'fancy' } ], 'include_extension' => ['md'] } @@ -255,7 +255,8 @@ config = { 'matches' => [ { 'regex' => 'fancy', 'include_extension' => ['md'] }, - { 'regex' => 'lance', 'forbidden' => true, 'exclude_extension' => ['txt'], 'include_extension' => ['md'] } + { 'regex' => 'lance', 'forbidden' => true, 'exclude_extension' => ['txt'], \ + 'include_extension' => ['md'] } ] } @@ -272,8 +273,9 @@ repo = Salus::Repo.new('spec/fixtures/pattern_search') config = { 'matches' => [ - { 'regex' => 'fancy', 'include_extension' => ['md'], 'exclude_extension' => ['md'] }, - { 'regex' => 'lance', 'forbidden' => true, 'exclude_extension' => ['txt'], 'include_extension' => ['md'] } + { 'regex' => 'fancy', 'include_extension' => ['md'], 'exclude_extension' => ['md'] }, + { 'regex' => 'lance', 'forbidden' => true, 'exclude_extension' => ['txt'], \ + 'include_extension' => ['md'] } ] } @@ -289,7 +291,7 @@ repo = Salus::Repo.new('spec/fixtures/pattern_search') config = { 'matches' => [ - { 'regex' => 'fancy', 'include_extension' => ['md'] }, + { 'regex' => 'fancy', 'include_extension' => ['md'] }, { 'regex' => 'lance', 'forbidden' => true, 'include_extension' => ['md'] } ], 'exclude_extension' => %w[txt md]