Skip to content

Commit

Permalink
generate-compound.rb: generate compound.yml file for cmd line tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thypon committed May 17, 2024
1 parent 288f87a commit 620448c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions assets/semgrep_rules/generate-compound.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require 'yaml'

SEMGREP_VERSION = `semgrep --version`.strip

HOST = 'https://semgrep.dev'

files = Dir['client/*.yaml', 'services/*.yaml', 'generated/*/vulns.yaml', 'generated/*/audit.yaml']

rules = {'rules' => []}

files.each do |fname|
begin
irules = YAML.load(File.read(fname))['rules']
puts "#{fname}: #{irules.length}"

rules['rules'].concat irules
rescue
puts "Error in #{fname}"
end
end

puts "#rules: #{rules['rules'].length}"

File.write("compound.yaml", YAML.dump(rules))

# require 'pry'
# binding.pry

0 comments on commit 620448c

Please sign in to comment.