Class: ScaBox::CodebaseScanner
- Defined in:
- lib/scabox_sdk/codebase.rb
Constant Summary
Constants inherited from Scanner
Instance Attribute Summary
Attributes inherited from Scanner
#description, #issues, #name, #support, #timeout
Instance Method Summary collapse
-
#initialize(params) ⇒ CodebaseScanner
constructor
A new instance of CodebaseScanner.
- #parse_opts(args) ⇒ Object
- #run ⇒ Object
Methods inherited from Scanner
#add_issue, #build_title, #check_info_flag, #check_output_flag, #enable_color, #filename_for_plugin, #gen_random_tmp_filename, #gen_random_tmp_filename_json, #get_code_version, #info, #parse_json_from_file, #parse_json_from_str, #save_results, #start_scan, #txt_output
Methods included from Runner
#command?, #run_cmd, #run_cmd_with_timeout
Methods included from Printer
#coloring, included, #print_debug, #print_error, #print_normal, #print_success, #print_title, #print_with_label, #suppress_output?
Constructor Details
#initialize(params) ⇒ CodebaseScanner
Returns a new instance of CodebaseScanner.
8 9 10 |
# File 'lib/scabox_sdk/codebase.rb', line 8 def initialize(params) super(params) end |
Instance Method Details
#parse_opts(args) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/scabox_sdk/codebase.rb', line 24 def parse_opts(args) @opts = OpenStruct.new @opts.codebase = nil @opts.output = nil @opts.format = :json @opts.verbose = false @opts.info = false @opts.color = true @opts.output_stdout = false opt_parser = OptionParser.new do |opts| opts.on('-c', '--codebase=CODEBASE', 'Codebase to be scanned') do |codebase| @opts.codebase = codebase end opts.on('-f', '--format=FORMAT', 'Format to save result (json or txt)') do |f| @opts.format = f.to_sym end opts.on('-o', '--output=OUTPUT', 'File to save result') do |output| @opts.output = output end opts.on('--output-stdout', 'Print result to stdout') do @opts.output_stdout = true end opts.on("-v", '--[no-]verbose', 'Run verbosely') do |v| @opts.verbose = v end opts.on("-i", '--info', 'Info about the scanner') do @opts.info = true end opts.on('', '--[no-]color', 'Enable/disable coloring') do |v| @opts.color = v enable_color(@opts.color) end end opt_parser.parse!(args) print_debug(@opts.inspect) if @opts.verbose @opts end |
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/scabox_sdk/codebase.rb', line 12 def run parse_opts(ARGV) check_info_flag if @opts.codebase.nil? print_error("No codebase passed") exit 1 end check_output_flag start_scan end |