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 @@ -260,7 +260,6 @@ impl StaticAnalysisConfigFile {
260260 . use_rulesets
261261 . get_or_insert_with ( || Vec :: with_capacity ( rulesets. len ( ) ) ) ;
262262 for ruleset_name in rulesets {
263- // if list.iter().find(|&name| ruleset_name.as_ref() ==)
264263 if !list. iter ( ) . any ( |name| ruleset_name. as_ref ( ) == name) {
265264 list. push ( ruleset_name. as_ref ( ) . to_string ( ) )
266265 }
@@ -572,6 +571,19 @@ use-rulesets:
572571 }
573572 }
574573
574+ #[ test]
575+ fn empty_rulesets_v2 ( ) {
576+ // language=yaml
577+ let v2 = r"
578+ schema-version: v2
579+ " ;
580+ let expected = v2;
581+ let mut config = StaticAnalysisConfigFile :: try_from ( to_encoded_content ( v2) ) . unwrap ( ) ;
582+ config. add_rulesets ( & [ ] as & [ & str ] ) ;
583+
584+ assert_eq ! ( config. to_string( ) . unwrap( ) . trim( ) , expected. trim( ) ) ;
585+ }
586+
575587 #[ test]
576588 fn it_works_complex ( ) {
577589 // language=yaml
@@ -1184,6 +1196,3 @@ rulesets:
11841196 assert_eq ! ( config. trim( ) , expected. trim( ) ) ;
11851197 }
11861198}
1187-
1188- // test behaviors
1189- // add empty rulesets to v2 doesn't instantiate a use_rulesets
You can’t perform that action at this time.
0 commit comments