File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 3434require 'active_support/core_ext/hash'
3535
3636class Bombuilder
37+ SUPPORTED_BOM_FORMATS = %w[ xml json ]
38+
3739 def self . build ( path )
3840 original_working_directory = Dir . pwd
3941 setup ( path )
@@ -123,12 +125,12 @@ def self.setup(path)
123125 abort
124126 end
125127
126- if @options [ :bom_output_format ] . nil? || @options [ :bom_output_format ] == "xml"
128+ if @options [ :bom_output_format ] . nil?
127129 @bom_output_format = 'xml'
128- elsif @options [ :bom_output_format ] == "json"
129- @bom_output_format = 'json'
130+ elsif SUPPORTED_BOM_FORMATS . include? ( @options [ :bom_output_format ] )
131+ @bom_output_format = @options [ :bom_output_format ]
130132 else
131- @logger . error ( "Unrecognized cyclonedx bom output format provided: #{ @options [ :bom_output_format ] } " )
133+ @logger . error ( "Unrecognized cyclonedx bom output format provided. Please choose one of #{ SUPPORTED_BOM_FORMATS } " )
132134 abort
133135 end
134136
You can’t perform that action at this time.
0 commit comments