Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
require 'yaml'

namespace :lint do
begin
require 'rspec/core/rake_task'
begin
require 'rspec/core/rake_task'
rescue LoadError
warn "Warning: RSpec is not installed. Please run `gem install rspec` to install RSpec."
end

if defined?(RSpec::Core::RakeTask)
namespace :lint do
desc "Lint reports (excluding schema validation)"
RSpec::Core::RakeTask.new(:yaml) do |t|
t.exclude_pattern = 'spec/schema_validation_spec.rb'
end

RSpec::Core::RakeTask.new(:yaml)
rescue LoadError => e
task :spec do
abort "Please run `gem install rspec` to install RSpec."
desc "Validate report schema"
RSpec::Core::RakeTask.new(:schema) do |t|
t.pattern = 'spec/schema_validation_spec.rb'
end
end

desc "Run all linting tasks"
task :lint => [ 'lint:schema', 'lint:yaml' ]
task :default => [ :lint ]
end

desc "Sync GitHub RubyGem Advisories into this project"
task :sync_github_advisories, [:gem_name] do |_, args|
require_relative "lib/github_advisory_sync"
GitHub::GitHubAdvisorySync.sync(gem_name: args[:gem_name])
end

task :lint => ['lint:yaml']
task :default => :lint