File tree Expand file tree Collapse file tree
crates/bins/src/bin/datadog_static_analyzer_server/ide/configuration_file Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,15 +47,21 @@ impl TryFrom<String> for StaticAnalysisConfigFile {
4747 if content. trim ( ) . is_empty ( ) {
4848 return Ok ( Self :: default ( ) ) ;
4949 }
50- let parsed = parse_any_schema_yaml ( & content) . map_err ( |err| {
51- match err {
52- // Artificially represent this as a "parse" error for backwards compatibility.
53- ConfigError :: UnsupportedSchema ( _) => ConfigFileError :: Parser {
54- source : serde_yaml:: Error :: custom ( err) ,
55- } ,
56- ConfigError :: Parse ( err) => ConfigFileError :: Parser { source : err } ,
57- }
58- } ) ?;
50+ let parsed = if cfg ! ( test) {
51+ parse_any_schema_yaml ( & content) . map_err ( |err| {
52+ match err {
53+ // Artificially represent this as a "parse" error for backwards compatibility.
54+ ConfigError :: UnsupportedSchema ( _) => ConfigFileError :: Parser {
55+ source : serde_yaml:: Error :: custom ( err) ,
56+ } ,
57+ ConfigError :: Parse ( err) => ConfigFileError :: Parser { source : err } ,
58+ }
59+ } )
60+ } else {
61+ file_legacy:: parse_yaml ( & content)
62+ . map ( WithVersion :: Legacy )
63+ . map_err ( |err| ConfigFileError :: Parser { source : err } )
64+ } ?;
5965 let config_file = match parsed {
6066 WithVersion :: Legacy ( yaml) => WithVersion :: Legacy ( file_legacy:: ConfigFile :: from ( yaml) ) ,
6167 WithVersion :: CodeSecurity ( yaml) => WithVersion :: CodeSecurity ( yaml) ,
You can’t perform that action at this time.
0 commit comments