Skip to content

Commit

Permalink
fix rubocop errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nishils committed Jun 5, 2019
1 parent 1bd2582 commit c65c4d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 4 additions & 3 deletions lib/salus/scanners/pattern_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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 << '='
Expand Down
12 changes: 7 additions & 5 deletions spec/lib/salus/scanners/pattern_search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
'matches' => [
{ regex: 'UN' },
{ 'regex' => 'lance', 'forbidden' => true },
{ regex: 'fancy'}
{ regex: 'fancy' }
],
'include_extension' => ['md']
}
Expand Down Expand Up @@ -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'] }
]
}

Expand All @@ -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'] }
]
}

Expand All @@ -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]
Expand Down

0 comments on commit c65c4d0

Please sign in to comment.