@@ -74,17 +74,11 @@ class TestCliConfigValidation:
7474
7575 BASE_ARGS = ["--api-token" , "test-token" , "--repo" , "test-repo" ]
7676
77- def test_sarif_reachable_only_without_reach_exits (self ):
78- """--sarif-reachable-only without --reach should exit with code 1 """
77+ def test_sarif_reachable_only_is_not_supported (self ):
78+ """Legacy --sarif-reachable-only is removed; argparse should reject it. """
7979 with pytest .raises (SystemExit ) as exc_info :
80- CliConfig .from_args (self .BASE_ARGS + ["--sarif-reachable-only" ])
81- assert exc_info .value .code == 1
82-
83- def test_sarif_reachable_only_with_reach_succeeds (self ):
84- """--sarif-reachable-only with --reach should not raise"""
85- config = CliConfig .from_args (self .BASE_ARGS + ["--sarif-reachable-only" , "--reach" ])
86- assert config .sarif_reachable_only is True
87- assert config .reach is True
80+ CliConfig .from_args (self .BASE_ARGS + ["--sarif-reachable-only" , "--reach" ])
81+ assert exc_info .value .code == 2
8882
8983 def test_sarif_file_implies_enable_sarif (self ):
9084 """--sarif-file should automatically set enable_sarif=True"""
@@ -121,8 +115,8 @@ def test_sarif_grouping_alert_requires_full_scope(self):
121115 CliConfig .from_args (self .BASE_ARGS + ["--reach" , "--sarif-grouping" , "alert" ])
122116 assert exc_info .value .code == 1
123117
124- def test_legacy_sarif_reachable_only_maps_to_reachability (self ):
125- config = CliConfig .from_args (self .BASE_ARGS + ["--reach" , "--sarif-reachable-only " ])
118+ def test_sarif_reachability_reachable_with_reach_succeeds (self ):
119+ config = CliConfig .from_args (self .BASE_ARGS + ["--reach" , "--sarif-reachability" , " reachable" ])
126120 assert config .sarif_reachability == "reachable"
127121
128122 def test_config_file_toml_sets_defaults (self , tmp_path ):
@@ -160,10 +154,11 @@ def test_cli_flag_overrides_config_file(self, tmp_path):
160154 def test_config_file_json_sets_defaults (self , tmp_path ):
161155 config_path = tmp_path / "socketcli.json"
162156 config_path .write_text (
163- "{\" socketcli\" : {\" reach\" : true, \" sarif_scope\" : \" full\" , \" sarif_grouping\" : \" alert\" }}" ,
157+ "{\" socketcli\" : {\" reach\" : true, \" sarif_scope\" : \" full\" , \" sarif_grouping\" : \" alert\" , \" sarif_reachability \" : \" reachable \" }}" ,
164158 encoding = "utf-8" ,
165159 )
166160 config = CliConfig .from_args (self .BASE_ARGS + ["--config" , str (config_path )])
167161 assert config .reach is True
168162 assert config .sarif_scope == "full"
169163 assert config .sarif_grouping == "alert"
164+ assert config .sarif_reachability == "reachable"
0 commit comments