@@ -1832,10 +1832,6 @@ def license_flags(self):
18321832 for license_flag_name in self .license_flag_names
18331833 }
18341834
1835- @property
1836- def license_flag_values (self ):
1837- return self .license_flags .values ()
1838-
18391835 def validate (self , licensing = None , thorough = False ):
18401836 """
18411837 Validate this rule using the provided ``licensing`` Licensing and yield
@@ -1844,8 +1840,7 @@ def validate(self, licensing=None, thorough=False):
18441840 is_false_positive = self .is_false_positive
18451841
18461842 has_license_flags = any (self .license_flag_values )
1847- has_no_license_flags = len ([l for l in self .license_flag_values if l ]) == 0
1848- has_many_license_flags = len ([l for l in self .license_flag_values if l ]) > 1
1843+ license_flags_count = sum (self .license_flags .values ())
18491844
18501845 license_expression = self .license_expression
18511846
@@ -1888,11 +1883,8 @@ def validate(self, licensing=None, thorough=False):
18881883
18891884 if not (0 <= self .relevance <= 100 ):
18901885 yield 'Invalid rule relevance. Should be between 0 and 100.'
1891-
1892- if has_no_license_flags :
1893- yield 'Invalid rule no is_license_* flags present.'
18941886
1895- if has_many_license_flags :
1887+ if license_flags_count :
18961888 yield 'Invalid rule is_license_* flags. Only one allowed.'
18971889
18981890 if not has_license_flags :
@@ -2295,6 +2287,8 @@ def dump(self, rules_data_dir, **kwargs):
22952287 rule_file = self .rule_file (rules_data_dir = rules_data_dir )
22962288
22972289 metadata = self .to_dict ()
2290+ # This can be used to pass objects to dump on the rule file with
2291+ # other rule metadata, like debugging collection of required phrases
22982292 if kwargs :
22992293 metadata .update (kwargs )
23002294 content = self .text
@@ -2328,7 +2322,7 @@ def load(self, rule_file, with_checks=True):
23282322 raise e
23292323
23302324 known_attributes = set (attr .fields_dict (self .__class__ ))
2331- # This is an attirbute used to debug marking required phrases, and is not needed
2325+ # This is an attribute used to debug marking required phrases, and is not needed
23322326 if "sources" in data :
23332327 data .pop ("sources" )
23342328 data_file_attributes = set (data )
0 commit comments