Skip to content

Commit

Permalink
Merge pull request #625 from rodjek/pdk-1276
Browse files Browse the repository at this point in the history
(PDK-1276) Skip non-file YAML validator targets
  • Loading branch information
bmjen authored Feb 11, 2019
2 parents 0ca65ed + 1981846 commit 85e3dc2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/pdk/validate/yaml/syntax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def self.invoke(report, options = {})
create_spinner(targets, options)

targets.each do |target|
next unless File.file?(target)

unless File.readable?(target)
report.add_event(
file: target,
Expand Down
12 changes: 12 additions & 0 deletions spec/unit/pdk/validate/yaml/syntax_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@
end
end

context 'when a target is provided that is not a file' do
let(:targets) do
[
{ name: 'a_directory.yml', file: false },
]
end

it 'skips the target' do
expect(report).not_to receive(:add_event)
end
end

context 'when a target is provided that contains valid YAML' do
let(:targets) do
[
Expand Down

0 comments on commit 85e3dc2

Please sign in to comment.