@@ -184,19 +184,23 @@ def cli(licenses_file):
184184
185185 print ()
186186 for rule in rules_data :
187+ is_negative = rule .data .get ('is_negative' )
188+ is_false_positive = rule .data .get ('is_false_positive' )
187189 existing = rule_exists (rule .text )
188- if existing :
189- print ('Skipping existing rule:' , existing , 'with text:\n ' , rule .text [:50 ].strip (), '...' )
190+ if existing and not is_negative :
191+ print ('Skipping existing non-negative rule:' , existing , 'with text:\n ' , rule .text [:50 ].strip (), '...' )
190192 continue
191-
192- if rule . data . get ( ' is_negative' ) :
193+
194+ if is_negative :
193195 base_name = 'not-a-license'
194196 else :
195197 license_expression = rule .data .get ('license_expression' )
196198 if not license_expression :
197199 raise Exception ('Missing license_expression for text:' , rule )
198200 licensing .parse (license_expression , validate = True , simple = True )
199201 base_name = license_expression
202+ if is_false_positive :
203+ base_name = 'false-positive_' + base_name
200204
201205 base_loc = find_rule_base_loc (base_name )
202206
@@ -218,8 +222,8 @@ def cli(licenses_file):
218222 else :
219223 rules_tokens .add (rule_tokens )
220224 rulerec .dump ()
221- models .update_ignorables (rulerec , verbose = True )
222- print ('Rule added:' , rulerec .identifier )
225+ models .update_ignorables (rulerec , verbose = False )
226+ print ('Rule added:' , 'file://' + rulerec .data_file , ' \n ' , 'file://' + rulerec . text_file , )
223227
224228
225229if __name__ == '__main__' :
0 commit comments